slachiewicz opened a new pull request, #1868: URL: https://github.com/apache/maven-mvnd/pull/1868
Fixes a race that makes the daemon-reuse ITs flaky: "Daemon registry size should be 1 … but was 2" (for example `NewManagedModuleNativeIT` on ubuntu-24.04-arm in https://github.com/apache/maven-mvnd/actions/runs/40085418965, `ResidentExtensionsTest` on macOS-15). The message receiver thread outlives the build. When the client closes its socket after `BuildFinished`, the receiver's `RecoverableMessageIOException` handler set the state to `Canceled` after the build had already returned the daemon to `Idle`. The daemon log from the ARM job shows it: ``` 10:29:36.160 I Updating state to: Idle 10:29:36.216 I Updating state to: Canceled ``` A canceled daemon with no build is never reused (`awaitStop` → `cancelNow` waits for `Idle`, then stops it), so the next client starts a second daemon. Users can lose their warm daemon the same way. The receiver now moves to `Canceled` only from `Busy` or `StopRequested`, under `stateLock`. I have not reproduced the race locally: on macOS the client's close arrives as end-of-stream and never reaches that handler. Verified: `./mvnw test -pl daemon -am` and `spotless:check` pass (JDK 25 and 17, macOS) --- - [ ] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) - [x] I hereby declare that I have filed an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
