-
Notifications
You must be signed in to change notification settings - Fork 63
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
Use LazyThreadSafteyMode.PUBLICATION instead of NONE #433
Conversation
LazyThreadSafetyMode.NONE literally means that accessing the lazy value from multiple threads can cause an NPE. Unfortunately, we assumed NONE would be implemented such that a lazy value could be initialized by multiple threads without throwing an NPE, with race conditions only possibly occurring inside the initializer block. However, that is actually the behavior is for LazyThreadSafeteyMode.PUBLICATION. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Codecov Report
@@ Coverage Diff @@
## main #433 +/- ##
=========================================
Coverage 82.33% 82.33%
Complexity 1396 1396
=========================================
Files 171 171
Lines 10724 10724
Branches 1768 1768
=========================================
Hits 8830 8830
Misses 1353 1353
Partials 541 541
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
FWIW, without this fix I was able to reproduce the issue ~10% of the time with this code, but was never able to reproduce it with the fix. |
I should add; given the inconsistency of the test in the gist, I don't think we should add that test to our suite. |
LazyThreadSafetyMode.NONE literally means that accessing the lazy value from multiple threads can cause an NPE. Unfortunately, we assumed NONE would be implemented such that a lazy value could be initialized by multiple threads without throwing an NPE, with race conditions only possibly occurring inside the initializer block. However, that is actually the behavior is for LazyThreadSafeteyMode.PUBLICATION. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. (cherry picked from commit eef183c)
LazyThreadSafetyMode.NONE literally means that accessing the lazy value from multiple threads can cause an NPE. Unfortunately, we assumed NONE would be implemented such that a lazy value could be initialized by multiple threads without throwing an NPE, with race conditions only possibly occurring inside the initializer block. However, that is actually the behavior is for LazyThreadSafeteyMode.PUBLICATION. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. (cherry picked from commit eef183c)
LazyThreadSafetyMode.NONE literally means that accessing the lazy value from multiple threads can cause an NPE. Unfortunately, we assumed NONE would be implemented such that a lazy value could be initialized by multiple threads without throwing an NPE, with race conditions only possibly occurring inside the initializer block. However, that is actually the behavior is for LazyThreadSafeteyMode.PUBLICATION. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. (cherry picked from commit eef183c)
LazyThreadSafetyMode.NONE literally means that accessing the lazy value from multiple threads can cause an NPE. Unfortunately, we assumed NONE would be implemented such that a lazy value could be initialized by multiple threads without throwing an NPE, with race conditions only possibly occurring inside the initializer block. However, that is actually the behavior is for LazyThreadSafeteyMode.PUBLICATION. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. (cherry picked from commit eef183c)
Issue #367
LazyThreadSafetyMode.NONE literally means that accessing the lazy value from multiple threads can cause an NPE.
Unfortunately, we assumed NONE would be implemented such that a lazy value could be initialized by multiple
threads without throwing an NPE, with race conditions only possibly occurring inside the initializer block.
However, that is actually the behavior is for LazyThreadSafeteyMode.PUBLICATION.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.