[
https://jira.codehaus.org/browse/SUREFIRE-946?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=317047#comment-317047
]
Andreas Gudian commented on SUREFIRE-946:
-----------------------------------------
@Kristian:
* indeed, {{closed}} needs to be volatile. Then it should be thread-safe again.
* {{BOOTERCODE_CRASH}} is the way for the forked process to let the main
process know that it terminated unexpectedly. The reason why I added this is to
repair the crash-detection, which would not work without actively closing the
TestProvidingInputStream at some point. See the extended CrashDetectionIT: it
fails without that part of the fix (well, to be more precise: the test will
hang). However, as I have mentioned in one of my comments above, this only
fixes the crash detection for those cases where the VM is still able to execute
the shutdown hook successfully. To really fix it for that case as well, I yet
have not any other idea than to implement the heart-beat feature. Hmm, or
perhaps if we extend the CommandLineUtils to allow passing a custom hook to
execute before it starts waiting on the streams. That could work, I guess and I
could remove the BOOTERCODE_CRASH stuff again... I'll try that... :)
* Integration-Tests: yeah. For the VM termination in the forked process, I
extended the CrashDetectionIT. To test the brutal VM crash of the forked
process, I will further extend it (and call Runtime#halt). The exact issue that
Jesse had was that the main process tried to shut down, but the locks held in
the TestProvidingInputStream prevented the shutdown hooks to finish. So what we
would need is a test that sends a kill signal to the main process started by
the IT. I don't know the internal guts of the Verifier - but is that possible?
Ok, looked at Process#destroy() and it seems do-able. Requires some more work
on CommandLineUtils, Verifier and everything in between. Sounds like fun :)
> Maven hangs on SIGTERM when using Surefire forking
> (CommandLineUtils.ProcessHook)
> ---------------------------------------------------------------------------------
>
> Key: SUREFIRE-946
> URL: https://jira.codehaus.org/browse/SUREFIRE-946
> Project: Maven Surefire
> Issue Type: Bug
> Affects Versions: 2.13
> Reporter: Jesse Glick
> Fix For: 2.14
>
> Attachments: stack.txt, SUREFIRE-946.patch
>
>
> Java 7u7, Surefire with JUnit {{forkMode="perthread"}} + {{threadCount="1"}}
> + {{reuseForks="true"}}. After pressing Ctrl-C to stop the Maven test run,
> the process hangs and must be killed with SIGKILL. From the thread dump,
> {{CommandLineUtils.ProcessHook}} and {{StreamFeeder}} look responsible.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira