[SUREFIRE-1722] JVM is not killed after forkedProcessTimeoutInSeconds has elapsed
John Bergqvist opened SUREFIRE-1722 and commented
I frequently encounter situations where after setting the forkedProcessTimeoutInSeconds property, a JVM with a test that hangs is not killed after the settings have elapsed.
I have attached the particular test (tika-example/src/test/java/org/apache/tika/example/DirListParserTest.java), which is is used as an example to demonstrate a test that causes the JVM to hang, and have configured my surefire plugin as follows (junit 4.12):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<configuration>
<enableProcessChecker>all</enableProcessChecker>
<forkCount>0.5C</forkCount>
<forkedProcessTimeoutInSeconds>5</forkedProcessTimeoutInSeconds>
<forkedProcessExitTimeoutInSeconds>5</forkedProcessExitTimeoutInSeconds>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
Affects: 3.0.0-M4
Attachments:
- DirListParserTest.java (336 bytes)
- ForkTest.java (153 bytes)
- pom.xml (2.73 kB)
1 votes, 5 watchers
Attila Doroszlai commented
Attached simple repro ( [^ForkTest.java] and [^pom.xml]) without any dependencies. Fork is killed after fork timeout in 3.0.0-M5 and earlier (tried M3, M4). It runs until test timeout with M6 and newer, including latest 3.2.5.
CC tibordigana
Richard Cyganiak commented
Problem still present in 3.5.0. Forked JVM is NOT killed on fork timeout, but is allowed to continue normally. If the forked JVM exits later, the build will fail with message “There was a timeout in the fork”. If the forked JVM hangs indefinitely, the build will hang indefinitely.
Hi, I can also confirm the issue in version 3.5.3. Due to a wrong (too short) configuration for forkedProcessTimeoutInSeconds we had builds failing on CI (Jenkins) with the message "There was a timeout in the fork" in VerifyMojo.
The parameter forkedProcessTimeoutInSeconds was set to 300s (5 Minutes) by accident but our test suite ran about 2 hours successfully without any test failures. After 2h and a successfull test run our build suddenly failed in verify phase with "There was a timeout in the fork" but no error message during tests.
It took us long time to connect the timeout error with the forkedProcessTimeoutInSeconds=300 setting.
While forkedProcessTimeoutInSeconds has no effect on the forked test process this setting is useless. We'll remove this setting from our Maven configuration until this bug has been resolved. In the far past (10y+) this setting worked and helped us killing tests hanging due to problems in the setup of integration tests with fast feedback.
Hi, I was able to reproduce the issue and perform a dichotomy on the maven-surefire-plugin. The behavior started since: https://github.com/apache/maven-surefire/commit/c59ffeed87e938259823178e6a2e6010d8138f9f committed by @Tibor17. @Tibor17 do you think we can prioritize fixing it in the upcoming release?