gnodet opened a new pull request, #12478:
URL: https://github.com/apache/maven/pull/12478

   ## Summary
   
   - Adds regression tests for the cross-thread deadlock in 
`AbstractRequestCache` that caused Maven 4.0.0-rc-5 to hang indefinitely on 24 
out of 966 tested Apache projects 
([#12472](https://github.com/apache/maven/issues/12472))
   - The root cause was a deadlock when two threads both called `requests()` 
(batch) with overlapping keys through an equals-based cache 
(`SoftIdentityMap`), sharing the same `CachingSupplier` instance. Thread B 
would wait on Thread A's `IdentityHashMap` via the old `individualSupplier`, 
but the identity-based lookup could never match Thread B's request references, 
creating a permanent deadlock.
   - The fix in c6de104bff replaced the wait-on-map pattern with 
`CachingSupplier.complete()` + ThreadLocal re-entrancy guard. These tests 
ensure the fix cannot regress.
   
   ### New tests
   
   | Test | Scenario |
   |------|----------|
   | `testConcurrentBatchRequestsWithSharedKeyDoNotDeadlock` | Two threads 
simultaneously execute batch `requests()` with overlapping keys, using a 
`CyclicBarrier` to force concurrent execution inside the batch supplier |
   | `testSequentialBatchRequestsWithSharedKeyReuseResult` | Sequential batch 
calls with shared keys correctly reuse cached results without redundant 
resolution |
   
   ## Test plan
   
   - [x] All 10 `AbstractRequestCacheTest` tests pass (including 2 new ones)
   - [x] Checkstyle passes
   - [ ] CI build succeeds
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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