-
-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An impossible race condition #3888
Comments
Could this be some weird threading issue? Would it help to put the whole |
I think it must be, but the |
Well the first line of |
Why/how? This could only be a potential problem if elements from the |
As far as I understand the code of Java's During rearranging, however, elements may be temporarily removed from the tree. This can result in previously inserted keys not being in the map during the iteration of the map's nodes and thus in |
That sound like a damn good explanation of the problem @tapetis 👍 |
Oh wow, I never thought of that. One lives and learns. Makes me wonder what would happen if one adds another value (in another thread) while the rearranging process is being done. Anyway, so either I have to use synchronized everywhere when accessing a HashMap or use ConcurrentHashMap. |
I've used this pattern in 2 more places, they should be fixed now. Thank you @tapetis ! |
I got this crash report recently:
But the code in qestion is
Anyone, any idea how this is possible? I.e. how it is possible that the key does not exist in the map at the return statement? (
String.toElementFilterExpression()
returns anElementFilterExpression
, not nullable)The text was updated successfully, but these errors were encountered: