Builds hangs while running tests that put restrictive security manager policy in place

The Groovy project is (slowly) migrating to Gradle for its build. However, we encounter a problem with a test suite which makes Gradle hang after running a bunch of tests. The problem is described here: http://gradle.1045684.n5.nabble.com/Infinite-wait-running-tests-tp5561210p5561210.html

A JIRA issue has been created for this: GRADLE-2169

HI Cedric,

I closed off GRADLE-2169 and opened GRADLE-2170 in its place. The reason is that we can’t link forum entries to existing JIRA topics. We have to create the issue from the forum entry. This way, when we resolve the issue it gets updated in both places.

Cheers.

I’m seeing the same issue with 1.0-m9

Unfortunately, I cannot find a workaround. The worker process runs and consumes almost 100% cpu. This is the last output when running with --debug:

  15:57:05.323 [DEBUG] [org.gradle.messaging.remote.internal.WorkerProtocol] Dispatching request to worker: [Request consumer: 0e1a39be-637b-4810-bb9d-afff784b57ab, payload: [MethodInvocation method: started()]]  15:57:05.321 [INFO] [org.gradle.api.tasks.testing.Test] Test CompanyStructureService getTree should::return a subtree with no parent(fleetzone.unittest.service.CompanyStructureSpec) PASSED  15:57:05.324 [DEBUG] [org.gradle.api.tasks.testing.Test] Started test CompanyStructureService getTree should::return Empty if no match(fleetzone.unittest.service.CompanyStructureSpec)  15:57:05.324 [INFO] [org.gradle.api.tasks.testing.Test] Test CompanyStructureService getTree should::return Empty if no match(fleetzone.unittest.service.CompanyStructureSpec) PASSED  15:57:05.324 [DEBUG] [org.gradle.api.tasks.testing.Test] Started test CompanyStructureService saveAll should::create new records for nodes with no id(fleetzone.unittest.service.CompanyStructureSpec)  15:57:05.324 [DEBUG] [org.gradle.messaging.remote.internal.WorkerProtocol] Dispatching request to worker: [Request consumer: 0e1a39be-637b-4810-bb9d-afff784b57ab, payload: [MethodInvocation method: completed()]]  15:57:05.325 [INFO] [org.gradle.api.tasks.testing.Test] Test CompanyStructureService saveAll should::create new records for nodes with no id(fleetzone.unittest.service.CompanyStructureSpec) PASSED  15:57:05.325 [DEBUG] [org.gradle.messaging.remote.internal.WorkerProtocol] Dispatching request to worker: [Request consumer: 0e1a39be-637b-4810-bb9d-afff784b57ab, payload: [MethodInvocation method: output()]]  15:57:05.326 [DEBUG] [org.gradle.messaging.remote.internal.WorkerProtocol] Dispatching request to worker: [Request consumer: 0e1a39be-637b-4810-bb9d-afff784b57ab, payload: [MethodInvocation method: started()]]  15:57:05.326 [DEBUG] [org.gradle.api.tasks.testing.Test] Started test CompanyStructureService saveAll should::update names & parentPath of records with id(fleetzone.unittest.service.CompanyStructureSpec)  15:57:05.326 [DEBUG] [org.gradle.messaging.remote.internal.WorkerProtocol] Dispatching request to worker: [Request consumer: 0e1a39be-637b-4810-bb9d-afff784b57ab, payload: [MethodInvocation method: completed()]]  15:57:05.326 [INFO] [org.gradle.api.tasks.testing.Test] Test CompanyStructureService saveAll should::update names & parentPath of records with id(fleetzone.unittest.service.CompanyStructureSpec) PASSED  15:57:05.326 [DEBUG] [org.gradle.messaging.remote.internal.WorkerProtocol] Dispatching request to worker: [Request consumer: 0e1a39be-637b-4810-bb9d-afff784b57ab, payload: [MethodInvocation method: output()]]  15:57:05.327 [DEBUG] [org.gradle.messaging.remote.internal.WorkerProtocol] Dispatching request to worker: [Request consumer: 0e1a39be-637b-4810-bb9d-afff784b57ab, payload: [MethodInvocation method: started()]]  15:57:05.327 [DEBUG] [org.gradle.api.tasks.testing.Test] Started test CompanyStructureService saveAll should::update parent path correcly for sub tree(fleetzone.unittest.service.CompanyStructureSpec)  15:57:05.327 [DEBUG] [org.gradle.messaging.remote.internal.WorkerProtocol] Dispatching request to worker: [Request consumer: 0e1a39be-637b-4810-bb9d-afff784b57ab, payload: [MethodInvocation method: completed()]]  15:57:05.328 [INFO] [org.gradle.api.tasks.testing.Test] Test CompanyStructureService saveAll should::update parent path correcly for sub tree(fleetzone.unittest.service.CompanyStructureSpec) PASSED  > Building > :test > 238 tests completed  

Can you rule out that one of your tests is simply hanging, at least when using the exact some class path etc. as the Gradle test task?

I cannot rule it out, but tried the following:

Remove half the tests. The remaining tests run fine. Readd all tests. Remove the other half. The remaining tests run fine.

I think I’ve solved the issue I was seeing (which may be unrelated to the bug reported here):

After bumping the memory for the forked test process everything works fine. So my guess is the worker stops at some point with an OME but this is not handled well by the main gradle process…

Hi Jeppe, do you mind opening a new thread for this so we can track it seperately?

Done. http://forums.gradle.org/gradle/topics/gradle_hangs_if_worker_process_fails_with_e_g_outofmemory_exception

I also run into this issue when running hibernate testsuite

To be clear… Strong runs into the same symptom: builds hanging during test execution. Hibernate build is not swapping security managers during tests.