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
{{ message }}
Repository navigation
Consumer can't get messages with earliest position subscription type under some circumstances #7941
Hello
We have severe issue with partitioned topics and key_shared subscriptions with multiple consumers per subscription.
After some time (could be few hours or few days) the consumers are stopping to consume messages . The backlog continues to grow.
The problem being observed in 2.5.2, 2.6.0, 2.6.1. (we didn't work with earlier versions)
(I am not sure that this error is related to the issue)
The issue more likely occurs when we do some change in the consumers like remove consumer, add another one.
It seems that it more likely happens with earliest subscription types .
I see enough available permits, no other problems that can explain this problem.
The problem is very serious and preventing us to move to production.
How can we start to troubleshooting this kind of problem ?
changed the title [-]Error while replaying entries org.apache.bookkeeper.mledger.ManagedLedgerException: Unknown exception[/-][+]Consumer can't get messages with earliest position subscription type under some circumstances [/+]on Aug 31, 2020
@BewareMyPower Hi. I also sometimes slightly different behaviors,
Sometimes it was working for a while (10-40 sec) and sometimes was stopping immediately on the third consumer
I think we have here more complex bug then may be probably have thought .
I succeeded to reproduce the same issue under other conditions.
For example when i create quickly very large backlog that issue happens again .
It always occurs with Key_Shared subscriptions.
For example
bin/pulsar-perf produce --warmup-time 5 --batch-time-window 3000 --num-producers 1 --size 900 --rate 10000 --num-topic 150--test-duration 43200 --stats-interval-seconds 60 internal/testtest
The second simulates the slow consumer.I executed a few similar shells and after few minutes i started to see "dead" topics with growing backlogs and lot of errors in the brokers
@alexku7 I have tested on my laptop, but the error information looks a bit different
java.lang.IndexOutOfBoundsException: Index -125 out of bounds for length 5
at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) ~[?:?]
at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) ~[?:?]
at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248) ~[?:?]
at java.util.Objects.checkIndex(Objects.java:372) ~[?:?]
at java.util.ArrayList.get(ArrayList.java:458) ~[?:?]
at org.apache.pulsar.broker.service.persistent.PersistentStickyKeyDispatcherMultipleConsumers.sendMessagesToConsumers(PersistentStickyKeyDispatcherMultipleConsumers.java:173) ~[org.apache.pulsar-pulsar-broker-2.6.1.jar:2.6.1]
at org.apache.pulsar.broker.service.persistent.PersistentDispatcherMultipleConsumers.readEntriesComplete(PersistentDispatcherMultipleConsumers.java:480) ~[org.apache.pulsar-pulsar-broker-2.6.1.jar:2.6.1]
at org.apache.bookkeeper.mledger.impl.OpReadEntry.lambda$checkReadCompletion$2(OpReadEntry.java:152) ~[org.apache.pulsar-managed-ledger-2.6.1.jar:2.6.1]
at org.apache.bookkeeper.mledger.util.SafeRun$1.safeRun(SafeRun.java:32) ~[org.apache.pulsar-managed-ledger-2.6.1.jar:2.6.1]
at org.apache.bookkeeper.common.util.SafeRunnable.run(SafeRunnable.java:36) [org.apache.bookkeeper-bookkeeper-common-4.10.0.jar:4.10.0]
at org.apache.bookkeeper.common.util.OrderedExecutor$TimedRunnable.run(OrderedExecutor.java:203) [org.apache.bookkeeper-bookkeeper-common-4.10.0.jar:4.10.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [io.netty-netty-common-4.1.48.Final.jar:4.1.48.Final]
at java.lang.Thread.run(Thread.java:834) [?:?]
Could you please help verify without message batching? I suspect to the batch message and I have verified on my laptop(2.6.1). So I can confirm if they are the same issue.
@codelipenghui Hi
Did you disable the batching on the consumer or producer?
I just wondering how i can disable the batching on the pulsar-client or probably i need my own java client ?
Activity
[-]Error while replaying entries org.apache.bookkeeper.mledger.ManagedLedgerException: Unknown exception[/-][+]Consumer can't get messages with earliest position subscription type under some circumstances [/+]alexku7 commentedon Aug 31, 2020
Hello
I am pretty sure that i succeeded to reproduce the conditions for this issue.
bin/pulsar-client consume -p Earliest -n 0 -s alex_test -t Key_Shared persistent://my-tenant/my-namespace/my/topic
3, after 1-2 minutes , create third consumer with the same settings.
You should see after 10-40 seconds that the all partitions are stuck with zero rate out and the backlog continues to grow .
Interesting, that if i remove the third consumer, all are starting working again but if i remove the first or second consumer it's still stuck.
The issue doesn't occur with Latest position.
BewareMyPower commentedon Sep 1, 2020
I also reproduced the problem, though a little different. When I start 3rd consumer, it cannot consume any messages.
I found these logs from the broker:
Also, there're some
ManagedLedgerExceptionlogs around the large amountArrayIndexOutOfBoundsExceptionlogsalexku7 commentedon Sep 1, 2020
@BewareMyPower Hi. I also sometimes slightly different behaviors,
Sometimes it was working for a while (10-40 sec) and sometimes was stopping immediately on the third consumer
jiazhai commentedon Sep 4, 2020
@codelipenghui could this be related with #7682 ?
alexku7 commentedon Sep 5, 2020
I think we have here more complex bug then may be probably have thought .
I succeeded to reproduce the same issue under other conditions.
For example when i create quickly very large backlog that issue happens again .
It always occurs with Key_Shared subscriptions.
For example
bin/pulsar-perf produce --warmup-time 5 --batch-time-window 3000 --num-producers 1 --size 900 --rate 10000 --num-topic 150--test-duration 43200 --stats-interval-seconds 60 internal/testtest
consume: bin/pulsar-perf consume --num-topics 150 --rate 1000 --stats-interval-seconds 60 --subscription-type Key_Shared internal/test/test
The second simulates the slow consumer.I executed a few similar shells and after few minutes i started to see "dead" topics with growing backlogs and lot of errors in the brokers
[bookkeeper-ml-workers-OrderedExecutor-3-0] ERROR org.apache.bookkeeper.common.util.SafeRunnable - Unexpected throwable caught
and
[bookkeeper-ml-workers-OrderedExecutor-3-0] ERROR org.apache.bookkeeper.common.util.SafeRunnable - Unexpected throwable caught
java.lang.ArrayIndexOutOfBoundsException: null
Very strange and very annoying .The problem is that this issue is real blocker for us because we must working with key_shared :(
codelipenghui commentedon Sep 9, 2020
@alexku7 I have tested on my laptop, but the error information looks a bit different
Could you please help verify without message batching? I suspect to the batch message and I have verified on my laptop(2.6.1). So I can confirm if they are the same issue.
alexku7 commentedon Sep 9, 2020
@codelipenghui Hi
Did you disable the batching on the consumer or producer?
I just wondering how i can disable the batching on the pulsar-client or probably i need my own java client ?
alexku7 commentedon Sep 9, 2020
@codelipenghui sorry but one question
did you succeed to reproduce this issue with pulsar-client as was mentioned in my first message and also in the @BewareMyPower ?
codelipenghui commentedon Sep 9, 2020
@alexku7 Yes, I reproduced it when enable message batching. When I disable the message batching, looks the problem does not appear.
I test by pulsar-perf and add
-bm 1to disable message batching.Avoid consumer stuck when available permits is a negative value. (#8024)
Avoid consumer stuck when available permits is a negative value. (apa…
Avoid consumer stuck when available permits is a negative value. (apa…
Avoid consumer stuck when available permits is a negative value. (#8024)