lhotari commented on pull request #10480:
URL: https://github.com/apache/pulsar/pull/10480#issuecomment-834093102
> At this point, we can actually get rid of AbstractCASReferenceCounted. It
was added in #2995 as a temporary measure to work around a change in behavior
in Netty. The Netty issue was then fixed in 4.1.32 and we don't need the
special treatment anymore.
I'm thinking of replacing it with something that would give extra protection
against bugs. Let's see what it evolves into. I'll push changes to this PR once
there's something presentable.
> was added as a way to handle the same bug, but I agree that it's really
dangerous in that we don't really what got wrong, as in where the corruption
was...
>
> As for the 2nd part (the Cursor.readEntryFailed), that seems ok to me. The
entries there are the partial entries that were already
About these 2 lines of code together:
```
invalidateAllEntries(lh.getId());
callback.readEntryFailed(createManagedLedgerException(t), ctx);
```
The problem here seems to be that invalidateAllEntries will call
`.release()` and then the `callback.readEntryFailed` will also call
`.release()` for the same set of entries and this leads to the "double release"
which can cause the entry to be returned to the recycler (when there's one more
outstanding usage of the entry). Once it's returned to the recycler, it can get
used in some other usage at the same time. After that, the outstanding usage of
the entry in the first place calls `.release()` and it could lead to the NPE
that was reported. Makes sense?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]