-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Issue-11282] Fix NPE in OpReadEntry #11292
Conversation
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 think this won't work. When readEntriesFailed is called during initiate readPosition, the property readPosition was not assigned yet, and readEntriesFailed has a chance to call readPosition.getLedgerId(),which will cause another NPE.
Further more, I guess the callbacks should be concerned also.
It's NoMoreEntriesToReadException in And the |
@littleorca After deep looking into this case, I found that more serious issue is that, when ManagedLedgerException.NoMoreEntriesToReadException occurs in |
Seems you are right. I've tried to reorder statements in create() method and ended up in failure, I probably messed up some details about the failure. |
FYI, there are some thread safety issues in OpReadEntry . PR #11387 attempts to fix some of the thread safety issues. |
move to 2.8.2. |
There seems to be an alternative approach to solve the NPE in PR #11813 . I currently prefer that change since it's fairly simple. |
@Jason918:Thanks for your contribution. For this PR, do we need to update docs? |
@Jason918 seems this is a bug fix (no need to update docs)? |
Yes. |
@Jason918:Thanks for providing doc info! |
Close by duplication. |
Removing release label and milestone since the PR is closed. Please re-add if we need to open the PR. |
Fixes #11282
Motivation
fix NPE in OpReadEntry, see issue #11282 .
Modifications
remove
opReadEntry.readEntriesFailed
inManagedLedgerImpl::startReadOperationOnLedger
, the state checking is handled by all the callers in OpReadEntry.Verifying this change
Added new test case
testManagedLedgerWithReadEntryWithoutNewerEntry
.Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation
Check the box below and label this PR (if you have committer privilege).
Need to update docs?
no-need-doc
bug fix.