Gradle build hangs when tests task is executed

I am running to into a scenario where the gradle build hangs intermittently. It happens right before the tests are executed. I have tried adding more logging for the tests, but I believe the the build is not even reaching the point where it runs the tests and hangs before that.

I am running the build on teamcity.
Gradle command: ./gradlew clean assemble test --no-daemon --info
Gradle version: 2.7
OS: Linux 3.8.13-26.2.2.el6uek.x86_64 Red Hat Enterprise Linux Server release 6.5 (Santiago)
Java: 1.7.0_80
gradle.properties:
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx6g -XX:MaxPermSize=4g -XX:ReservedCodeCacheSize=1024m
org.gradle.parallel=true

I have attached the thread dump below:

Thanks @ankitS

I raised GRADLE-3367. We’re taking a look at a fix.

Hey Sterling,

There were 2 builds which hung overnight. I have attached the thread dump.

Thanks!

This looks like something else (it’s hanging in the test worker process instead of in the main gradle process), which usually means it’s something with a test.

These lines look suspicious: https://gist.github.com/ankits/a5028ec70a2df841645e#file-threaddump-with-2-10-L1274-L1277

I’d check some things…

  1. Is the test doing anything that could make it flaky/race condition?
  2. Is the test depending on anything outside of the test (e.g., shared directory, shared service) that could conflict with another project’s test?
  3. Does this test fail only with --parallel and are you using maxParallelForks on the Test-task level?

Thanks Sterling. I will look into the tests. Regarding 3, the test fails only when I use --parallel. We are not using maxParallelForks on the Test task yet.