You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@merlimat@rdhabalia
I just got a coulpe of NPE's when calling resetCursor on a subscription with active consumers.
The stack is:
java.lang.NullPointerException
at org.apache.bookkeeper.mledger.impl.ManagedCursorImpl.persistPosition(ManagedCursorImpl.java:1858)
at org.apache.bookkeeper.mledger.impl.ManagedCursorImpl.internalResetCursor(ManagedCursorImpl.java:700)
at org.apache.bookkeeper.mledger.impl.ManagedCursorImpl.lambda$asyncResetCursor$4(ManagedCursorImpl.java:765)
at org.apache.bookkeeper.mledger.util.SafeRun$1.safeRun(SafeRun.java:27)
at org.apache.bookkeeper.util.SafeRunnable.run(SafeRunnable.java:31)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:144)
at java.lang.Thread.run(Thread.java:745)
Apparently, the ManagedCursorImpl has a null cursorLedger so the ends up passingnull as LedgerHandle to persistPosition which fails when calling lh.asyncAddEntryhere.
This leaves the subscription in a inconsistent state because the callback is never called and the subrscription is never unfenced.
Is it OK for a ManagedCursorImpl to have no cursor ledger? is it because data is stored in ZK? what should we do in this case?
Yes, after recovery the ledger is not immediately created (to avoid doing it in case the topic is not used). The cursor position data will be either stored on the old ledger or on the z-node, depending on how the managed-ledger was closed.
A new request to perform mark-delete should trigger the ledger creation, though we need to make sure the mark-delete request does not get rate-limited.
But how do we handle this case here? we're resetting the cursor, all consumers have been disconected, but we have no ledger.
Should we create one and the continue?
Activity
merlimat commentedon Feb 21, 2017
Yes, after recovery the ledger is not immediately created (to avoid doing it in case the topic is not used). The cursor position data will be either stored on the old ledger or on the z-node, depending on how the managed-ledger was closed.
A new request to perform mark-delete should trigger the ledger creation, though we need to make sure the mark-delete request does not get rate-limited.
sschepens commentedon Feb 21, 2017
But how do we handle this case here? we're resetting the cursor, all consumers have been disconected, but we have no ledger.
Should we create one and the continue?
Removed unnecessary flush in sync Send() operation (apache#230)
Fill the offset field of PartitionResponse (apache#245)