netliomax25-code opened a new pull request, #2698:
URL: https://github.com/apache/groovy/pull/2698

   Repro: on one thread call metaClass.mixin(someCategory) while another thread 
dispatches a method on the same class, so findMixinMethod iterates mixinClasses 
while addMixinClass adds to it.
   Cause: mixinClasses is a plain LinkedHashSet with no locking, while every 
other backing collection in ExpandoMetaClass is a ConcurrentHashMap held 
alongside the read/write lock. A structural add during iteration throws 
ConcurrentModificationException in the dispatching thread.
   Fix: keep the mixins in a CopyOnWriteArraySet, which is safe for concurrent 
read-while-modify and preserves insertion order plus the boolean add() dedup 
that GROOVY-11775 depends on.
   
   Verified with a new test that throws ConcurrentModificationException on the 
old set and passes with the change; the existing mixin and ExpandoMetaClass 
suites stay green.


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