shashank created CAMEL-27330:
--------------------------------
Summary: camel-mllp - maxConcurrentConsumers no longer limits the
connections: extra connections are served instead of reset
Key: CAMEL-27330
URL: https://issues.apache.org/jira/browse/CAMEL-27330
Project: Camel
Issue Type: Bug
Components: camel-mllp
Reporter: shashank
Assignee: shashank
h3. What happens
{{maxConcurrentConsumers}} is documented as: if a new connection is received
and the maximum number are already established, the new connection will be
reset immediately.
Since 4.18 (CAMEL-22957, virtual threads support, and its follow-up commit
a47b4c7 that added the profile with {{maxQueueSize=0}}) the consumer executor
is created from a {{ThreadPoolProfile}} that sets no rejected policy, so it
gets the default profile's {{CallerRuns}}. When the pool is full, {{submit}}
does not throw: the consumer runnable runs on the validation thread (an
unbounded cached pool). The reset in {{MllpTcpServerConsumer.startConsumer}} is
never reached, and every connection is served. Before 4.18 the pool was a
{{ThreadPoolExecutor}} with the JDK default {{AbortPolicy}}.
{{MllpMaxConcurrentConsumersTest.testConcurrentConsumersMoreThanMaxConsumers}}
does not catch it: its second client connects to another port, where nothing
listens.
When a runnable is rejected (with an Abort policy), {{startConsumer}} also
leaves it in {{consumerRunnables}} (with its socket and the buffer holding the
first message), as only the runnable itself removes its entry.
h3. How to reproduce
{{mllp://localhost:port?maxConcurrentConsumers=1&autoAck=true}}: three clients
each send a message and each gets an AA acknowledgement; three consumer
runnables are active.
Found with a TLA+ model of the MLLP consumer.
h3. Fix
Set the Abort policy on the consumer profile, remove the rejected runnable from
{{consumerRunnables}}, and connect the test's second client to the consumer's
port. Upgrade guide entry for 4.24 (extra connections are reset again; raise
{{maxConcurrentConsumers}} to serve more).
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)