shashank created CAMEL-27503:
--------------------------------
Summary: camel-milo - a value that a replaced connection still had
queued is delivered after the loss report of its replacement, so the node shows
Good while communication is lost
Key: CAMEL-27503
URL: https://issues.apache.org/jira/browse/CAMEL-27503
Project: Camel
Issue Type: Bug
Components: camel-milo
Reporter: shashank
Assignee: shashank
h3. What happens
Each connection of the milo-client {{SubscriptionManager}} has its own Milo
delivery queue. When a connection is torn down because a service call failed (a
CreateMonitoredItems of a consumer that starts, a recreate, a delete),
{{handleConnectionFailure}} queues its loss report behind the values it still
has queued, and that queue keeps running. When the old queue is slow (a route
that takes a while), the following order is possible:
# connection 1 still has a value V1 of the node queued;
# connection 1 is torn down; its loss report L1 is queued behind V1;
# connection 2 connects and delivers the current value of the node;
# connection 2 loses its session: its loss report L2 ({{Bad_NoCommunication}})
is delivered;
# the queue of connection 1 goes on: V1 is delivered (a Good value), and L1 is
dropped because connection 2 delivered a value.
The consumer ends with a Good value while communication is lost, and it stays
that way until the session or the server comes back. The generation check added
by CAMEL-25835 guards the loss reports, not the values. When the connection is
torn down by {{onTransferFailed}}, Milo discards the queued values, so that
path is not affected.
The component documentation says that a node delivers {{Bad_NoCommunication}}
when communication is lost, and allows only that an old value arrives after the
first value of the new connection; it does not allow for one after the loss
report of the new connection.
h3. How to reproduce
Two nodes on one milo-client connection; the route of node B blocks on a value,
and a change of node A is queued behind it. The link goes silent, the
CreateMonitoredItems of the next consumer times out and the connection is
rebuilt; the new connection delivers A's value, then its session is lost (A
gets {{Bad_NoCommunication}}). When B's route completes, A receives the queued
value of the old connection: Good, last.
Found with a TLA+ model of the delivery of values and loss reports across
connection generations.
h3. Fix
The node keeps the generation of the newest connection whose loss report it
delivered, and drops a value of an older connection: that value was queued on a
connection that has been replaced, and the loss report stays the status of the
node until the current connection delivers a value. An old value that arrives
after the first value of the new connection, but before any newer loss report,
is still delivered, as documented.
Not changed here: an {{Error}} (not an {{Exception}}) thrown during a reconnect
or a retry of refused nodes ends those attempts for good, and the discovery of
the endpoints ignores {{requestTimeout}} (its own 60 s timeouts apply). Both
are low and get their own tickets.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)