Claus Ibsen created CAMEL-26179:
-----------------------------------
Summary: camel-milo - one milo-client write of a body that cannot
be encoded drops the shared connection, so every subscriber gets
Bad_NoCommunication
Key: CAMEL-26179
URL: https://issues.apache.org/jira/browse/CAMEL-26179
Project: Camel
Issue Type: Bug
Components: camel-milo
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while adding the catalog body types of milo-browse, milo-client and
milo-server (CAMEL-24961, PR #28411).
h4. 1. A write with a body that cannot be encoded drops the shared connection
{{MiloClientProducer.process}} (main 2a465aa4814c, line 86) writes the body as
is. For a body that is not an OPC UA built-in value (a stream, a file, a Map, a
bean) the write future completes exceptionally with an encoding error, and
{{SubscriptionManager.write}} (line 1734) treats that like a lost link:
{{handleConnectionFailure}} disposes the connection that all endpoints of the
same server share and reconnects. Every subscriber on it gets a
{{Bad_NoCommunication}} DataValue before it resubscribes: 4 bad writes gave 4
{{Bad_NoCommunication}} messages on an unrelated node. Checked on
4.24.0-SNAPSHOT with an embedded Milo OPC UA server.
Proposed: call {{handleConnectionFailure}} only for errors of the connection
(session or channel status codes), and fail only the exchange for an encoding
error, or check the value before writing.
h4. 2. A write of a null body with await answers a bad StatusCode body and no
exception
With {{CamelMiloAwait=true}} or {{defaultAwaitWrites=true}}, a null body is
sent to the server and the exchange completes with the {{Bad_TypeMismatch}}
StatusCode as its body ({{MiloClientProducer.process}}, line 98), without an
exception. Checked on 4.24.0-SNAPSHOT with an embedded Milo OPC UA server.
(CAMEL-25694 keeps a per-node bad StatusCode of a real write as the result;
this is only about a null body.)
Proposed: fail the exchange with an {{InvalidPayloadException}} for a null body
before writing.
h4. 3. milo-server stores a body that is not a built-in type without error
{{MiloServerProducer.process}} (main 2a465aa4814c, line 52) hands any body to
{{CamelServerItem.update}} (line 160), which wraps it in a {{Variant}}. For a
body that is not an OPC UA built-in type the producer succeeds, but subscribed
clients get no data change and a client read fails with an encoding error.
Checked on 4.24.0-SNAPSHOT with an embedded Milo OPC UA server.
Proposed: check that the value can be encoded (a built-in type, a Variant or a
DataValue) and fail the exchange otherwise.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)