-
Notifications
You must be signed in to change notification settings - Fork 179
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
#1306 add test that reproduces the flaky problem with CopyOnWriteMap #1310
Conversation
PR Summary
The overall goal of these changes is to ensure that our |
it's a simplified version of what happens with FakeValuesService.MAP_OF_METHOD_AND_COERCED_ARGS
3882237
to
43e1fff
Compare
Instead of two separate calls `putIfAbsent` and `get`, now we use `computeIfAbsent`. Before this change, `get` sometimes returned null (apparently, because of GC or parallel threads or something similar).
…ervice Instead of three separate calls `containsKey`, `get` and `put`, now we use a single `computeIfAbsent`.
this partially reverts commit 43e1fff
Hi @asolntsev , how about getting rid of the COWMap? I just did a performance test with Spring Boot native, and I did about 300.000 requests, and in my "production" code I'm getting nullpointers. For some reason, I got more NPEs in GraalVM than while using a JVM. If you want, you can easily reproduce it here by running the k6 performance test: https://github.com/datafaker-net/datafaker-native-demo |
Wasn't the COWMap originally introduced to address performance issues? |
@kingthorin I believe the idea is that it has some benefits regarding performance, but at the cost that the library no longer works reliably. |
Yes, I like the idea. The argument against it was that COWMap is faster. But I never checked this statement by myself. And I don't think this speed is really important. |
Here is where it was introduced (I believe), it has further details. |
Will using a synchronized map alleviate the issue? I know that might cause a slight performance hit but hopefully it still facilitates the original case. Edit: or ConcurrentHashMap |
Instead of two-three separate calls like `containsKey`, `get` and `put`, now we use a single `computeIfAbsent`.
@kingthorin @bodiam I investigated the problem a bit more. Conclusion: When we have map of maps, then we often call I submitted PR #1381 that should fix our flaky problem. |
<option name="Make" enabled="true" /> | ||
</method> | ||
</configuration> | ||
</component> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this file?
The problem was fixed in PR #1381. |
it's a simplified version of what happens with
FakeValuesService.MAP_OF_METHOD_AND_COERCED_ARGS
.@snuyanzin Can you help with fixing
CopyOnWriteMap
?