-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
ConcurrentModificationException occurs when failPendingMessages #11783
Comments
I just figure out why, because the client code retry to send messages when exception occurred to avoid network "Jitter"(Translate on google). the sample code are like this String topic = "test";
PulsarClient pulsarClient = PulsarClient.builder()
.serviceUrl("http://127.0.0.1:8080")
.build();
ProducerBuilder<String> producerBuilder = pulsarClient.newProducer(Schema.STRING).enableBatching(true);
Producer<String> producer = producerBuilder.topic(topic).create();
final TypedMessageBuilder<String> stringTypedMessageBuilder = producer.newMessage();
final TypedMessageBuilder<String> value = stringTypedMessageBuilder.key("1").value("2");
final CompletableFuture<MessageId> completableFuture = value.sendAsync();
completableFuture.exceptionally(throwable -> {
producer.sendAsync("xxxx");
return null;
}); The I have a question. Should we allow to retry on @315157973 @eolivelli @merlimat , thanks |
In my opinion, we can only use interfaces to restrict the use of methods, verbal conventions are not a good way |
Cannot prevent the user to call |
Good catch @shoothzj !
I think that this is a bug that needs to be fixed. I took a quick look and I have a relatively simple way to solve it. |
I created #11884 as a draft PR to fix the issue. I don't have a way to reproduce the problem in a test case and that's one of the problems. |
Is there any progress here? Why not just set the queue to concurrent? |
there's progress in #11884, it's currently in draft. @315157973 I replied in #11884 (comment) . Does that answer your question? |
Describe the bug
To Reproduce
It's hard to reproduce.
Expected behavior
Keep the list operation safely.
Additional context
It occurs when restarting one of brokers(there were 2 running brokers), first client recevied
DisConnected
event, and then ConcurrentModificationException and some recycled already exception in timer task's OpSendMsgThe text was updated successfully, but these errors were encountered: