[ 
https://jira.codehaus.org/browse/SUREFIRE-946?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=316801#comment-316801
 ] 

Andreas Gudian commented on SUREFIRE-946:
-----------------------------------------

On my Windows PC, hitting Ctrl+C correctly kills all processes. From the stack 
dumps, it looked to me as if the _forked_ process was killed off without the 
main process knowing. So I executed some test classes from which one calls 
{{System.exit(0)}} in its test method. Bang, I got the exact same stack dumps.

I fixed that by adding a shutdown hook in the forked process that will say 
"bye" to the main process if everything went fine, and report an abnormal 
termination if something else went wrong (such as a test calling 
{{System.exit}}). The main process then closes the 
{{TestProvidingInputStream}}, allowing the {{StreamFeeder}} thread to terminate.

Still, in case the shutdown hooks are not executed (e.g. due to 
{{Runtime.halt(..)}} or some other brutal external process termination, we will 
end up having the same problem. We would be back with that heartbeat thing... 

Pull-request is open.
                
> 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
>         Attachments: stack.txt
>
>
> 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

        

Reply via email to