Fix safeLock not run when interrupt & Fix partial notification being cancelled in ServiceInstancesChangedListener#14730
Merged
AlbumenJ merged 6 commits intoapache:3.3from Sep 30, 2024
Merged
Conversation
4 tasks
marmot-z
reviewed
Mar 4, 2025
| logger.warn(LoggerCodeConstants.INTERNAL_ERROR, "", "", "Try to lock failed", e); | ||
| interrupted = true; | ||
| } | ||
| runnable.run(); |
There was a problem hiding this comment.
This may seem a bit strange, because generally the tryLock method is used like this:
Lock lock = ...;
if (lock.tryLock()) {
try {
// do something with lock
runnable.run();
} finally {
lock.unlock();
}
} Wouldn't this really lead to some race conditions?
Member
Author
There was a problem hiding this comment.
safeLock here is to try best to wait. In Dubbo, those actions needed safeLock can accept delay, but cannot accept skip.
Member
Author
There was a problem hiding this comment.
Also, the patch indubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/event/listener/ServiceInstancesChangedListener.java is the real code to fix #14470. The original issue is once invoke failed, submitRetryTask won't being invoked because of the code order.
There was a problem hiding this comment.
i got it, thanks for your patient explanation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change?
Checklist