-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[tryout fix] concurrency bug in NamespacedHierarchicalStore#computeIfAbsent(Object, Object, Function) #5171 #5209
#5223
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
Conversation
✅ All tests passed ✅Test Summary
🏷️ Commit: 0f9c064 Test FailuresNamespacedHierarchicalStoreTests > ConcurrencyIssue5171 > computeIfAbsentWithMultipleExceptionsAndConcurrentModifications() (:platform-tests:test in OpenJ9 21)NamespacedHierarchicalStoreTests > ConcurrencyIssue5171 > computeIfAbsentWithMultipleExceptionsAndConcurrentModifications() (:platform-tests:test in OpenJDK 26 (ea))NamespacedHierarchicalStoreTests > ConcurrencyIssue5171 > computeIfAbsentWithMultipleExceptionsAndConcurrentModifications() (:platform-tests:test in OpenJDK 26 (ea))Learn more about TestLens at testlens.app. |
| public <K, V> Object computeIfAbsent(N namespace, K key, Function<? super K, ? extends V> defaultCreator) { | ||
| Preconditions.notNull(defaultCreator, "defaultCreator must not be null"); | ||
| CompositeKey<N> compositeKey = new CompositeKey<>(namespace, key); | ||
| StoredValue storedValue = getStoredValue(compositeKey); |
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.
I see that it is harder to review. On the other hand, it is also difficult (for me) to access this code without. This can be helpful when working on a close, low-level perspective.
I do not consider code at all, because everything ultimately becomes some kind of random implementation detail.
If I need to consider code seriously, I must structure it properly and understand how it actually flows, while adhering to best practices and SOLID design principles that reflect what the code is truly doing and how it whispers how it wants to be structured. I know not everyone has the sense to recognize this level of intent.
I cannot process an endless number of requirements and concerns. I can only operate like a computer: one thing at a time, within a very limited scope—effectively binary. While 0 and 1 represent two states, they never truly add up to 2. Because of this, I have to work at a one-to-one level; anything beyond that exceeds my strict mental limitations. Please excuse my shortcomings in this regard.
|
kindly asking if this is any good and or any better? Of course will undo the unrelated var stuff if you demand it. |
...ngine/src/main/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStore.java
Show resolved
Hide resolved
02e511d to
d87f48c
Compare
|
kindly asking how to link local junit version with the assertj project? Also can not find the tag to activate failing regression test. Thanks. |
…fAbsent(Object, Object, Function)` junit-team#5171 junit-team#5209 Signed-off-by: Vincent Potucek <[email protected]>
d87f48c to
0f9c064
Compare
| @Nullable | ||
| private volatile Object value = NO_VALUE_SET; | ||
|
|
||
| private MemoizingSupplier(Supplier<@Nullable Object> delegate) { |
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.
seems like a typo missing r
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.
They're similar words but mean different things.
|
strange like this one stable flaky when running with TC: org.junit.platform.engine.support.store.NamespacedHierarchicalStoreTests.ConcurrencyIssue5171#computeIfAbsentWithMultipleExceptionsAndConcurrentModifications |
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.
Thanks for trying to fix this! But this still appears to be based on #5209 and that pull request was based on an incomplete understanding of the problem.
I've given what I think is a complete description of the actual problem in #5171. And while I think I know what the problem is I haven't quite had the time available to work out what the solution should be. I also don't have the time available to coach you towards an understanding of the problem to such a degree that you can develop a solution.
As such, and in addition to the reasons given in #5213 (review), I don't think it a good use of your time to submit pull requests for this issue.
| @Nullable | ||
| private volatile Object value = NO_VALUE_SET; | ||
|
|
||
| private MemoizingSupplier(Supplier<@Nullable Object> delegate) { |
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.
They're similar words but mean different things.
[tryout fix] concurrency bug in
NamespacedHierarchicalStore#computeIfAbsent(Object, Object, Function)#5171 #5209I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
@APIannotationscoverage:
before:
after: