elharo opened a new issue, #386:
URL: https://github.com/apache/maven-shared-utils/issues/386

   `StreamPollFeeder.exception` (line 38) is not declared `volatile`, but is 
written by the `run()` thread (line 79) and read from other threads via 
`getException()` (line 101). While `waitUntilDone()` calls `join()` which 
establishes a happens-before for reads that happen after the thread terminates, 
if `getException()` is called concurrently from another thread before 
`waitUntilDone()`, the read may see stale `null`.
   
   `StreamPumper` already uses `volatile` for its `exception` field (line 41). 
`StreamPollFeeder` should follow the same pattern for consistency and 
correctness.
   
   Fix: declare `exception` as `volatile`.


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