[GRADLE-3290] Test task and '-XstartOnFirstThread' makes gradle hang Created: 24/Apr/15  Updated: 15/Nov/16  Resolved: 15/Nov/16

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Sterling Greene Assignee: Unassigned
Resolution: Duplicate Votes: 1


 Description   

I'm having problems with test run hanging when using the '-XstartOnFirstThread' flag.

I want to run functional tests with UISpec4J, and using SWT which requires the '-XstartOnFirstThread' flag. Hence I use the configuration:

test

{ jvmArgs '-XstartOnFirstThread' }

But the tests hang indefinitely. The execution doesn't even get to the first line of the setup method in the tests (running junit).

Can this be related to how gradle runs tests regarding threads? The hanging doesn't occur with maven and the surefire plugin (also using the -XstartOnFirstThread flag).

https://discuss.gradle.org/t/gradle-test-task-and-xstartonfirstthread-makes-gradle-hang/9296



 Comments   
Comment by Ned Twigg [ 22/Nov/15 ]

There's a workaround using the ant task: https://github.com/ReadyTalk/swt-bling/issues/4

Comment by Ned Twigg [ 07/May/16 ]

Three years old relative to forum post, one year old relative to this bug. Can any core devs point out the code that starts the Gradle test VM? Maybe one of us external users will find time to put together a PR. Seems like it must be possible to swap which thread is running tests and which thread is doing the reporting.

Comment by Stefan Wolf [ 09/May/16 ]

The Gradle test VM is started by org.gradle.api.internal.tasks.testing.worker.ForkingTestClassProcessor which uses org.gradle.process.internal.worker.DefaultWorkerProcessBuilder to create a WorkerProcess and start it.
All this is called from org.gradle.api.internal.tasks.testing.detection.DefaultTestExecuter

Comment by Ned Twigg [ 09/May/16 ]

Great, thanks very much Stefan!

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Ned Twigg [ 15/Nov/16 ]

I migrated this to https://github.com/gradle/gradle/issues/864

Comment by Benjamin Muschko [ 15/Nov/16 ]

Marking as duplicate as the issue has been migrated to GitHub.

Generated at Wed Jun 30 12:44:56 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.