Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.3
-
Fix Version/s: None
-
Component/s: Core
-
Labels:None
-
Number of attachments :
Description
We are using paranamer as part of LiftJson. On very rare occassions the call to lookupParameterNames returns null (one in four million calls).
We couldn't reproduce the problem reliably, but there are two hypotheses:
1. The containsKey returns true, then GC kicks in and removes the key, before the get happens (we saw GC activity at the time of the failure)
2. The map doesn't deal with the concurrent access gracefully (we were running something like 50 concurrent threads).
If 1. holds true, the solution could be to get and then check for null instead of calling containsKey first. I do however fear that the WeakHashMap has more issues...
Will see whether I can reproduce the problem outside our longevity test environment.
What do you think of this - https://github.com/paul-hammant/paranamer/commit/8b6453b0f3f4d8915d5bff27fe49c2bc826f168d ?