arturobernalg opened a new pull request, #3603:
URL: https://github.com/apache/maven-surefire/pull/3603

   Fixes #3366.
   
   `CountdownCloseable.awaitClosed()` called `wait()` inside an `if` instead of 
a `while`, so a spurious wakeup (allowed by the JLS `Object.wait()` contract) 
could make it return before `close()` had actually decremented the countdown to 
zero and called `notifyAll()`.
   
   This is used by `CommandlineExecutor.awaitExit()` (and transitively by 
`ForkStarter`) to wait for the stream-reader threads to finish draining a 
forked process's stdout/stderr/event channel before treating the fork as done. 
A spurious wakeup there lets Surefire proceed while output is still in flight - 
exactly the symptom reported in #3366 (`CommandlineExecutorTest` intermittently 
sees zero interactions with the output handler on Windows).
   
   Added a test that deterministically reproduces the defect: it sends a 
spurious notification on the monitor without reaching the real 
countdown-to-zero close, asserts the waiting thread is still blocked, then 
performs the real close and asserts it unblocks.
   
   ---
   
   To make clear that you license your contribution under
   the [Apache License Version 2.0, January 
2004](https://www.apache.org/licenses/LICENSE-2.0)
   check one of the following:
   
   - [x] 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).
   
   https://claude.ai/code/session_01BrsHTdDq7PD1DoqeA9vs66


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

Reply via email to