[Issue-11282] Fix NPE in OpReadEntry#11292
Conversation
littleorca
left a comment
There was a problem hiding this comment.
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.readEntriesFailedinManagedLedgerImpl::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
yeswas chosen, please highlight the changesDocumentation
Check the box below and label this PR (if you have committer privilege).
Need to update docs?
no-need-docbug fix.