gnodet commented on PR #12478:
URL: https://github.com/apache/maven/pull/12478#issuecomment-5058398170

   Thanks for the thorough empirical verification @ascheman! You're absolutely 
right — the existing concurrent test doesn't actually deadlock on the pre-fix 
code because the keys remain identity-stable throughout resolution.
   
   I've added the mutable-hashCode variant you suggested in 3079c63881:
   
   - **New test:** 
`testConcurrentBatchRequestsWithMutatingSharedKeyDoNotDeadlock` — uses 
`MutableHashCodeRequest` instances whose `equals()`/`hashCode()` change during 
batch resolution (mirroring mutable `RequestTrace` data). Thread A's supplier 
sleeps 1.5s then mutates trace data; Thread B's supplier also mutates. Pre-fix, 
this deadlocks because Thread B waits on Thread A's equals-based map for a key 
that no longer matches.
   - **New helper:** `GenericCachingTestRequestCache` — equals-based cache that 
accepts any `Request` type (needed since `MutableHashCodeRequest` doesn't 
implement `TestRequest`).
   
   The existing identity-stable test is kept as a complement — it still 
validates concurrent batch resolution doesn't deadlock, even if it doesn't 
specifically bite on the pre-fix regression.


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