Skip to content

build: make surefire enableProcessChecker overridable for Windows 11 compatibility.#1968

Open
anmol-saxena-14 wants to merge 1 commit into
apache:mainfrom
anmol-saxena-14:Issue#1816-B
Open

build: make surefire enableProcessChecker overridable for Windows 11 compatibility.#1968
anmol-saxena-14 wants to merge 1 commit into
apache:mainfrom
anmol-saxena-14:Issue#1816-B

Conversation

@anmol-saxena-14
Copy link
Copy Markdown
Contributor

## Problem
Surefire 3.x uses wmic to periodically check whether the parent Maven process is still alive. wmic was removed in Windows 11 22H2, so the check always fails — the forked test, JVM concludes the parent has died and calls System.exit(1) before any test runs.

Symptoms on Windows 11:
[ERROR] The forked VM terminated without properly saying goodbye.
[ERROR] Process Exit Code: 1

## Change
Extract enableProcessChecker into an overridable property with default all . Windows 11 developers can now run tests using: mvn test -Dsurefire.enableProcessChecker=ping.

No behaviour change for CI or any other environment.

Note: ping uses the stdin pipe to detect parent-process death rather than wmic, and works correctly on all platforms.

@anmol-saxena-14 anmol-saxena-14 marked this pull request as ready for review April 26, 2026 01:07
@jbonofre jbonofre self-requested a review April 27, 2026 04:01
Comment thread pom.xml
<reuseForks>false</reuseForks>
<forkedProcessTimeoutInSeconds>${surefire.forkedProcessTimeout}</forkedProcessTimeoutInSeconds>
<enableProcessChecker>all</enableProcessChecker>
<enableProcessChecker>${surefire.enableProcessChecker}</enableProcessChecker>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already the case right?

My understanding is that you are using just a Maven property instead of having the setting all inline (in the test profile).

Can you elaborate?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is exactly what this change does.

Before, the value was hardcoded inline in the surefire plugin configuration:
<enableProcessChecker>all</enableProcessChecker>

After, it is driven by a Maven property with all as the default:
<!-- in <properties> -->
<surefire.enableProcessChecker>all</surefire.enableProcessChecker>

<!-- in surefire plugin config -->
<enableProcessChecker>${surefire.enableProcessChecker}</enableProcessChecker>

The default value is unchanged so CI and all existing environments behave identically. The only difference is that a developer on Windows 11 (where wmic is no longer available) can now override it on the command line without patching the pom:
mvn test -Dsurefire.enableProcessChecker=ping

This change follows the same pattern already used in this pom for surefire.forkedProcessTimeout and surefire.argLine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants