Absolutey stumped on this.
I have two controller integration tests that pass successfully. However, when running in Intellij or via gradle check
, the JVM never exits. If I comment out the entire integration tests, the JVM exits cleanly.
When debugging any of the integration tests, I can hit pause and see that there are several threads in different states: WAITING, RUNNING, SLEEPING.
The database used in application.yml
is purely an in-memory one:
url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
Changing this to file based does not fix the problem. Changing DB_CLOSE_ON_EXIT=TRUE
does not help either.
I've tried removing @Rollback
and even using @Transactional
with a timeout, but that doesn't fix it.
Creating an integration test on a fresh project works with no deadlock/hanging/waiting.
I have moved back through revisions to find the changeset where this behaviour started, but the changes were purely in GSPs, Controllers and an additional assertion & test method in one of the integration tests.
The last lines in the logs are:
INFO org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext - Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@73386d72: startup date [Mon May 30 18:48:25 BST 2016]; root of context hierarchy
INFO org.springframework.context.support.DefaultLifecycleProcessor - Stopping beans in phase -2147483648
INFO org.grails.plugins.datasource.TomcatJDBCPoolMBeanExporter - Unregistering JMX-exposed beans on shutdown
INFO org.grails.plugins.datasource.TomcatJDBCPoolMBeanExporter - Unregistering JMX-exposed beans
INFO org.hibernate.tool.hbm2ddl.SchemaExport - HHH000227: Running hbm2ddl schema export
INFO org.hibernate.tool.hbm2ddl.SchemaExport - HHH000230: Schema export complete
I've tried cutting the integration test methods down to one method and the issue still occurs.
The versions I'm using are:
$ ~/apps/grails-3.1.5/bin/grails --version
|Grails Version: 3.1.5
|Groovy Version: 2.4.6
|JVM Version: 1.8.0_92
Windows 10 64bit.
Here's a thread dump.
I have no idea how to debug this further. Any ideas?
DB_CLOSE_ON_EXIT=TRUE
on the database url ?@Rollback
but with@Transactional
and a timeout) but that doesn't help. Totally clueless as to what's causing it. Going to debug with JMX next.