-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Optimize cache usage in DefaultConversionService and fix race condition #10143
Optimize cache usage in DefaultConversionService and fix race condition #10143
Conversation
bbafea4
to
73f72aa
Compare
Also, the original issue is not reproduced in this fix. @wetted Do you think this fix is good enough? |
@PakhomovAlexander thank you for the PR. I'm asking for reviews from those who know micronaut core better than I. |
in which scenario did you get the race condition. In tests? |
@sdelamo I've described the case with the race condition in this issue #10091 Here is the repo wich reproduces it https://github.com/wetted/core-10091-race-condition TLDR; Yes, first I got the race condition on tests but then I managed to reproduce it in the main code. Basically, any application that starts context from different threads can face this issue. |
Hi @sdelamo, could you please clarify the state of this PR? I wonder if the fix will appear in the upcoming 3.10.x release. Thanks! |
@PakhomovAlexander it will be part of a 3.10.x release. |
The usage of
typeConverters
andconverterCache
are optimized.Redundant operations are removed, which boosts the performance (according to the
ConversionServiceBenchmark
) at ~ 2x.The synchronized keyword is added to the critical methods that can be called from several threads. Now
typeConverters
andconverterCache
are consistent.Here are the benchmark results that I've run on my Macbook 2,6 GHz 6-Core Intel Core i7, jdk-11.0.12.jdk: