[
https://issues.apache.org/jira/browse/CAMEL-27332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-27332 started by shashank.
----------------------------------------
> camel-mllp - a connection accepted just before the consumer stops is served
> after the stop, and answers every message with a NACK
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27332
> URL: https://issues.apache.org/jira/browse/CAMEL-27332
> Project: Camel
> Issue Type: Bug
> Components: camel-mllp
> Reporter: shashank
> Assignee: shashank
> Priority: Major
>
> h3. What happens
> {{MllpTcpServerConsumer.doStop}} calls {{stop()}} on the consumer runnables
> that are in {{consumerRunnables}} at that moment, and closes the accept
> thread's server socket. A connection that was already accepted is then still
> in its validation read (up to 500 ms). When that read ends, {{startConsumer}}
> submits a new {{TcpSocketConsumerRunnable}} to the consumer executor, which
> doStop does not shut down, without checking the state of the consumer. The
> runnable serves the connection until the client goes away: the stopped route
> answers every message with {{MSA|AE|...|RouteStoppingException}}, and the
> thread and socket stay.
> The same state is reached when {{stop()}} runs between {{submit}} and the
> first line of {{run()}}: {{run()}} sets {{running = true}} again.
> ({{running}} is not volatile either.)
> After a restart, the leftover runnable is served next to the connections of
> the new start, so {{maxConcurrentConsumers}} is exceeded. Each start also
> creates new executors and the old ones are never shut down (their idle
> threads end after the keep-alive time, but the executors stay registered with
> the ExecutorServiceManager until the CamelContext stops).
> h3. How to reproduce
> {{mllp://localhost:port?receiveTimeout=2000&autoAck=true}}: open a connection
> without sending, stop the route while the validation runnable reads; 7 s
> later a consumer runnable is still alive and a message gets {{MSA|AE}}.
> Found with a TLA+ model of the MLLP consumer.
> h3. Fix
> {{startConsumer}} resets the connection instead of serving it when the
> consumer is stopping or stopped (checked after the runnable is in
> {{consumerRunnables}}, so either the stop's sweep or the check catches it);
> {{running}} is volatile and true from construction ({{run()}} no longer sets
> it); doStop shuts down the executors of that start (without waiting).
> _Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)