maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Gudian (JIRA)" <>
Subject [jira] (SUREFIRE-946) Maven hangs on SIGTERM when using Surefire forking (CommandLineUtils.ProcessHook)
Date Sat, 05 Jan 2013 20:15:13 GMT


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:
>             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

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message