[
https://issues.apache.org/jira/browse/CAMEL-21940?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17941809#comment-17941809
]
Pavel Borik commented on CAMEL-21940:
-------------------------------------
Proposed PR: [https://github.com/apache/camel/pull/17693]
Please backport to 4.8.x if possible.
> camel-kafka - 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.8.6, 4.11.0
> Reporter: Pavel Borik
> Priority: Major
> Fix For: 4.12.0, 4.10.4, 4.8.7
>
>
> 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)