rootvector2 commented on PR #419:
URL: 
https://github.com/apache/commons-beanutils/pull/419#issuecomment-5036518607

   Looked into it. The synchronization here is fine; the test asserted more 
than the weak cache guarantees. The `CacheKey` is only reachable through the 
weak-keyed cache, so a GC landing inside a round evicts the fresh entry and a 
late thread legitimately builds a second instance. Reproduces single threaded 
on unmodified `1.X`: `createDynaClass`, then `System.gc()`, then 
`createDynaClass` returns a distinct instance. Master doesn't hit this because 
the beanutils2 cache holds soft references, which survive ordinary GCs. Fix is 
in #425: each round only asserts when a `WeakReference` canary shows no GC ran 
during it, so the race check stays (still fails on the pre-#419 code) but GC 
evictions no longer trip it. Verified it passes under a `System.gc()` hammer 
that made the old test fail with exactly the CI error. Sorry for the noise, and 
thanks for merging this one.


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