[
https://issues.apache.org/jira/browse/CAMEL-27829?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-27829:
--------------------------------
Description:
Found while improving the option descriptions of camel-disruptor for
CAMEL-23832 (commit
https://github.com/apache/camel/commit/ed21c0d35408d9c8fd340e12eb3bac97d585474f,
pull request https://github.com/apache/camel/pull/31141).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. All consumers of a name get every exchange without multipleConsumers
multipleConsumers is checked per endpoint object in
{{DisruptorEndpoint.onStarted}}, but all endpoints with the same name share one
DisruptorReference, and DisruptorReference.createDisruptor adds the handlers of
every endpoint. So from("disruptor:foo") and
from("disruptor:foo?concurrentConsumers=2") both receive every exchange
(publish-subscribe) without multipleConsumers=true (confirmed with a test).
Proposed change: reject a consumer on another endpoint of the same name when
multipleConsumers is false.
h4. 2. concurrentConsumers=0 hangs
{{DisruptorComponent.createEndpoint}} rejects only values below 0, though its
message says "must be greater than 0". With 0, DisruptorConsumer creates no
handlers, and exchanges stay pending forever (confirmed with a test).
Proposed change: reject values below 1.
h4. 3. Backlog publishing with producerType=Single
With producerType=Single, the DisruptorBacklog thread
(DisruptorReference.publishRestOfBufferedExchanges) calls ringBuffer.next()
while the producer may publish at the same time; the SingleProducerSequencer of
LMAX is not thread-safe, so a sequence can be claimed twice. Found by reading
the code; it needs a reconfiguration with more buffered exchanges than ring
buffer slots.
Proposed change: serialize the backlog publishing with the producers, or use
MULTI while a backlog is published.
_Claude Code on behalf of davsclaus_
was:
Found while improving the option descriptions of camel-disruptor for
CAMEL-23832 (pull request https://github.com/apache/camel/pull/31141).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. All consumers of a name get every exchange without multipleConsumers
multipleConsumers is checked per endpoint object in
{{DisruptorEndpoint.onStarted}}, but all endpoints with the same name share one
DisruptorReference, and DisruptorReference.createDisruptor adds the handlers of
every endpoint. So from("disruptor:foo") and
from("disruptor:foo?concurrentConsumers=2") both receive every exchange
(publish-subscribe) without multipleConsumers=true (confirmed with a test).
Proposed change: reject a consumer on another endpoint of the same name when
multipleConsumers is false.
h4. 2. concurrentConsumers=0 hangs
{{DisruptorComponent.createEndpoint}} rejects only values below 0, though its
message says "must be greater than 0". With 0, DisruptorConsumer creates no
handlers, and exchanges stay pending forever (confirmed with a test).
Proposed change: reject values below 1.
h4. 3. Backlog publishing with producerType=Single
With producerType=Single, the DisruptorBacklog thread
(DisruptorReference.publishRestOfBufferedExchanges) calls ringBuffer.next()
while the producer may publish at the same time; the SingleProducerSequencer of
LMAX is not thread-safe, so a sequence can be claimed twice. Found by reading
the code; it needs a reconfiguration with more buffered exchanges than ring
buffer slots.
Proposed change: serialize the backlog publishing with the producers, or use
MULTI while a backlog is published.
_Claude Code on behalf of davsclaus_
> camel-disruptor: consumers of the same name all get every exchange,
> concurrentConsumers=0 hangs
> -----------------------------------------------------------------------------------------------
>
> Key: CAMEL-27829
> URL: https://issues.apache.org/jira/browse/CAMEL-27829
> Project: Camel
> Issue Type: Bug
> Components: camel-disruptor
> Reporter: Claus Ibsen
> Priority: Minor
> Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-disruptor for
> CAMEL-23832 (commit
> https://github.com/apache/camel/commit/ed21c0d35408d9c8fd340e12eb3bac97d585474f,
> pull request https://github.com/apache/camel/pull/31141).
> These are separate problems of the component; the descriptions change only
> documents the current behavior.
> h4. 1. All consumers of a name get every exchange without multipleConsumers
> multipleConsumers is checked per endpoint object in
> {{DisruptorEndpoint.onStarted}}, but all endpoints with the same name share
> one DisruptorReference, and DisruptorReference.createDisruptor adds the
> handlers of every endpoint. So from("disruptor:foo") and
> from("disruptor:foo?concurrentConsumers=2") both receive every exchange
> (publish-subscribe) without multipleConsumers=true (confirmed with a test).
> Proposed change: reject a consumer on another endpoint of the same name when
> multipleConsumers is false.
> h4. 2. concurrentConsumers=0 hangs
> {{DisruptorComponent.createEndpoint}} rejects only values below 0, though its
> message says "must be greater than 0". With 0, DisruptorConsumer creates no
> handlers, and exchanges stay pending forever (confirmed with a test).
> Proposed change: reject values below 1.
> h4. 3. Backlog publishing with producerType=Single
> With producerType=Single, the DisruptorBacklog thread
> (DisruptorReference.publishRestOfBufferedExchanges) calls ringBuffer.next()
> while the producer may publish at the same time; the SingleProducerSequencer
> of LMAX is not thread-safe, so a sequence can be claimed twice. Found by
> reading the code; it needs a reconfiguration with more buffered exchanges
> than ring buffer slots.
> Proposed change: serialize the backlog publishing with the producers, or use
> MULTI while a backlog is published.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)