You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Pavel Borik (Jira)" <ji...@apache.org> on 2025/04/08 06:44:00 UTC

[jira] [Created] (CAMEL-21940) KafkaProducerCallBack can execute the continuation twice

Pavel Borik created CAMEL-21940:
-----------------------------------

             Summary: KafkaProducerCallBack can execute the continuation twice
                 Key: CAMEL-21940
                 URL: https://issues.apache.org/jira/browse/CAMEL-21940
             Project: Camel
          Issue Type: Bug
          Components: camel-kafka
    Affects Versions: 4.11.0, 4.8.6
            Reporter: Pavel Borik


KafkaProducerCallback uses the following pattern with LongAdder to execute the continuation. This approach is not thread safe and thus it is possible the continuation is executed twice, once from the thread executing the onCompletion method and once from the thread executing the allSent method.
{code:java}
       count.decrement();
        if (count.intValue() == 0) {
            ...
            callback.done()
        } {code}
[https://camel.zulipchat.com/#narrow/channel/257298-camel/topic/KafkaProducerCallBack.20can.20execute.20the.20continuation.20twice|http://example.com]



--
This message was sent by Atlassian Jira
(v8.20.10#820010)