Fix a NPE bug after refactor recycler of BookieClient#4610
Merged
StevenLuMT merged 1 commit intoJun 6, 2025
Conversation
3 tasks
zymap
approved these changes
Jun 5, 2025
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a Null Pointer Exception in CompletionValue.timeout by reordering the execution sequence.
- The latency registration is now executed before calling errorOut.
- The change prevents the timeoutOpLogger from being recycled before its usage.
Comments suppressed due to low confidence (1)
bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/CompletionValue.java:92
- The reordering of the latency registration before errorOut should resolve the NPE issue by ensuring that timeoutOpLogger is not recycled before its use. Please verify that this change does not introduce any side effects in the error handling logic.
errorOut(BKException.Code.TimeoutException);
merlimat
approved these changes
Jun 5, 2025
Member
|
StevenLuMT
pushed a commit
that referenced
this pull request
Jun 12, 2025
Co-authored-by: fanjianye <fanjianye@bigo.sg> (cherry picked from commit 23289b7)
priyanshu-ctds
pushed a commit
to datastax/bookkeeper
that referenced
this pull request
Jul 11, 2025
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.
Motivation
After refactor recycler of bookieClient and test for a few days in cluster, there is a NPE bug.
In CompletionValue#timeout(), it would do errorOut() and then register latency in timeoutOpLogger. But errorOut() would trigger writeComplete() and then recycle the completionValue object. So the timeoutOpLogger is also recycle and throw NPE.
Changes
change the execute order: register latency first and then do errorOut().
Alternative fix is like:
But I think it is unnecessary to record the errorOut() time in prometheus, because this time cost has no influence of this timeout metric.