[
https://issues.apache.org/jira/browse/CAMEL-26978?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-26978 started by Federico Mariani.
------------------------------------------------
> camel-kafka: an async manual commit after an aggregator fails with
> ConcurrentModificationException
> --------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26978
> URL: https://issues.apache.org/jira/browse/CAMEL-26978
> Project: Camel
> Issue Type: Bug
> Components: camel-kafka
> Affects Versions: 4.22.2, 4.23.0
> Reporter: Federico Mariani
> Assignee: Federico Mariani
> Priority: Major
> Fix For: 4.22.3, 4.24.0
>
>
> Since 4.22.0, {{KafkaManualCommit.commit()}} with the
> {{DefaultKafkaManualAsyncCommitFactory}} calls {{commitAsync}} on the thread
> that calls it. After an aggregator (the documented use of the asynchronous
> commit) that is the aggregator thread, while the consumer thread is in
> {{poll()}}: every commit fails with {{ConcurrentModificationException:
> KafkaConsumer is not safe for multi-threaded access}}, and no offset is
> committed while the route runs.
> {code:java}
> from("kafka:topic?groupId=g&autoCommitEnable=false&allowManualCommit=true&kafkaManualCommitFactory=#asyncCommitFactory")
> .aggregate(constant(true),
> AggregationStrategies.useLatest()).completionTimeout(1000)
> .process(e -> e.getMessage().getHeader(KafkaConstants.MANUAL_COMMIT,
> KafkaManualCommit.class).commit());
> {code}
> Expected: as in 4.21 and as the component docs say, the commit is recorded
> and the consumer thread commits it asynchronously in its next loop, so
> {{commit()}} can be called from any thread.
> Regression from CAMEL-23997 (commit abdb48b29960), which made
> {{DefaultKafkaManualAsyncCommit.commit()}} commit at once on the calling
> thread.
> _Claude Code on behalf of Federico Mariani_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)