Gradle test hangs forever without any error message


(marc) #1

I have a project where when I run gradle clean test, it will hang forever without any error message. I tried to run different unit tests, single ones. My project has got both groovy/java tests but it’s the same result for any of them. I have no problem running the tests in Intellij IDEA. I have tried with gradle 1.12 and 2.0, same result.

Here is where it hangs with --debug: https://gist.github.com/ttux/5610ea225db66317a388

And now is the output when I do kill -3 (sorry, this is quite long): https://gist.github.com/ttux/9bf6a2345ff59273151e

And this is from another gradle process where I did kill -3 as well: https://gist.github.com/ttux/d582e0f631eff91c6af7

Note that in the stacktraces of kill -3, there is nothing about my code. Any help would be much appreciated.


Clean waits forever w/non-standard buildDir
(Luke Daley) #2

Hi Marc,

Are there no other processes? Your first process is Gradle, the second is a compiler daemon. I would expect to see another process which is running the tests.

Is there any chance you could create a reproducible sample that we can run?


(marc) #3

Indeed, there are 3 processes.

The output after I did kill -3 on the 3 of them: https://gist.github.com/ttux/b3473e4028364cc70adc

About creating a reproducible sample, I will give it a try but it might be difficult because this is happening on a big project with lot of dependencies on other projects. I have a similar setup on a different smaller project but there is no problem there. I’ll try to make it happen on something smaller which I could give you.


(marc) #4

I am lucky, I managed to create a small project where I can reproduce the problem.

You can clone it here: git clone git@ttux.net:test-gradle-bug

Run “gradle clean test” and it will hang forever.

Although with this little project I can see 1 thing more in the logs:

13:05:10.837 [DEBUG] [org.gradle.cache.internal.DefaultCacheAccess] Detected file lock contention of artifact cache (/home/marc/.gradle/caches/modules-2) (fileLock=true, contended=false, owner=null)
13:05:10.840 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache artifact-at-repository.bin (/home/marc/.gradle/caches/modules-2/metadata-2.12/artifact-at-repository.bin)
13:05:10.840 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Closing cache module-metadata.bin (/home/marc/.gradle/caches/modules-2/metadata-2.12/module-metadata.bin)
13:05:10.845 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on artifact cache (/home/marc/.gradle/caches/modules-2).

Thank you in advance for your help.


(marc) #5

I found the source of the problem:

testCompile("com.googlecode.jmockit:jmockit:1.0")

If I remove this dependency it doesn’t hang anymore.


(marc) #6

And so it turns out there is some incompatibility issue between the jacoco and the jmockit versions I use: http://forums.gradle.org/gradle/topics/jacocoplugin_makes_tests_fail_not_finding_junit_runner


(Luke Daley) #7

Hi Marc,

I can’t clone that project without a password. I’d still like to pursue this to see if we can catch this kind of exception and provide better feedback.


(marc) #8

Sorry, you should actually clone with: git clone git://ttux.net/test-gradle-bug


(Luke Daley) #9

This doesn’t build. It requires connectivity to http://ukicdjabroni.


(marc) #10

In the repositories section, remove:

maven {
                url "http://ukicdjabroni/repository/"
        }
          maven {
                url "http://ukicdjabroni/snapshots/"
        }