The GitHub Actions job "Java CI" on commons-lang.git/fix-eventlistenersupport-toctou has failed. Run started by GitHub user shreshthkharbanda (triggered by shreshthkharbanda).
Head commit for run: 2ee5d1680047201a0a390a2ad0d00c314fbc0d93 / Shreshth Kharbanda <[email protected]> Fix check-then-act race in EventListenerSupport.addListener EventListenerSupport.addListener(listener, false) checked listeners.contains(listener) and then called listeners.add(listener) as two separate operations on the shared CopyOnWriteArrayList. Two threads registering the same listener concurrently could both pass the contains check and both add, registering a duplicate despite allowDuplicate being false. CopyOnWriteArrayList provides the atomic form of exactly this compound operation, so the fix narrows the field's declared type to CopyOnWriteArrayList (which the Javadoc already documents as the intentional implementation) and uses addIfAbsent() when duplicates are disallowed. Single-threaded behavior is unchanged; the existing testAddListenerNoDuplicates still passes, and a new multi-threaded regression test registers one listener from eight threads and asserts a single registration. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01BnA6jPsqhsGZ9idxJQi3ZG Report URL: https://github.com/apache/commons-lang/actions/runs/33345329407 With regards, GitHub Actions via GitBox
