Repository navigation
CAMEL-25671: camel-milo - report a node with an unknown namespace URI instead of failing the connection - #27906
Conversation
davsclaus
left a comment
There was a problem hiding this comment.
Thanks for the clear write-up and the focused fix. The NPE is real on main: lookupNamespace(...).get() ends in NodeIds.toNodeId, whose requireNonNull(namespaceIndex) throws for an unknown nsu=, so the consumer took the reconnect path for the whole client. You are also right that the node == null branch (badSubscriptions / resubscribe) could never run, so removing it is safe.
The fix follows the same approach as #27780 (one WARN, one DataValue with a bad status, the other nodes and the connection keep running), and the WARN and PendingValue handling match the existing operation-result branch. The new test covers both halves: the bad status for the unknown namespace, and a later write to node1 still reaching the consumer. The docs, the catalog copy and the 4.24 upgrade-guide note are all in place.
A few non-blocking notes are inline. On the producers (write, call, read, browse): yes, please file the follow-up JIRA you offered.
This review checks the PR against the project's rules and conventions; it does not replace CodeRabbit, Sourcery or SonarCloud, and nothing was built or run locally.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
gnodet-bot
left a comment
There was a problem hiding this comment.
Clean fix. Replacing the hard crash with a graceful null return for unknown namespace URIs is the right approach, the dead badSubscriptions/resubscribe code removal is well-justified, and the test covers the failure mode directly.
Two minor observations:
-
lookupNamespaceIndex(uri).get()blocks the thread (line 295 ofSubscriptionManager.java). This is the same pattern as the originallookupNamespace(s.getNodeId()).get()— no regression introduced here, but worth a follow-up to make this async if the OPC-UA thread model requires it. -
Producer path still has the NPE-on-unknown-namespace — the original
lookupNamespacemethod is untouched and producers can still crash the same way. Out of scope for this fix, but worth a follow-up issue.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
|
Thanks both. The producer follow-up is filed as https://issues.apache.org/jira/browse/CAMEL-25690 (write, call, read, browse: the same NPE reaches handleConnectionFailure; write and call also swallow it and complete with null). I will send a PR for it after this one and fold the two lookups into one helper there, as suggested. Claude Code on behalf of etzel-mes |
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 8 of 706 tested, 25 compile-only — current: 8 all testedMaveniverse Scalpel detected 8 affected modules (current approach: 8). Skip-tests mode would test 8 modules (3 direct + 7 downstream), skip tests for 25 (generated code, meta-modules) Modules Scalpel would test (8)
Modules with tests skipped (25)
All tested modules (35 modules, 5m 41s total)Total reactor time: 5m 41s
Top 20 slowest modules:
|
…n when its value is null [CAMEL-25626](https://issues.apache.org/jira/browse/CAMEL-25626). With the default `omitNullValues=true`, the `milo-client` consumer dropped every data change whose value was null, regardless of its status code. OPC UA Part 4 requires a server to send a null value together with a Bad status, so dropping null values drops every Bad status: a sensor failure, a removed node or a monitored item that could not be created (#27780, #27906) never reached the route unless `omitNullValues=false` was set. Why this matters in automation: a route that feeds a historian, an MES, a UNS topic or an alarm evaluates the last value it received. When the quality of a tag goes Bad and the route never hears about it, the stale value keeps being treated as current, and the plant acts on a number that nobody is measuring any more. Quality propagation is the first thing an OT integration is expected to get right; the component should deliver it by default. Closes #27908 Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
… instead of failing the connection A consumer node ID whose namespace URI (nsu=) is not in the namespace table of the server made lookupNamespace throw a NullPointerException. The exception went to the reconnect path, so one wrong entry in a nodes list took the whole client connection down, including the consumers of the other nodes. The consumer now treats such a node like a node that does not exist on the server: one WARN with the node ID and one DataValue with Bad_NodeIdUnknown for that node (visible with omitNullValues=false); the other nodes and the connection keep working. The badSubscriptions map and the 10 second resubscribe that served the old Bad_InvalidArgument branch are removed. That branch could not be reached, because lookupNamespace never returned null. Producers (write, call, read, browse) are not changed. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
f405d3a to
cdaba94
Compare
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — the fix is solid and the new commit introduces no new issues.
The open thread about lookupNamespaceIndex(uri).get() blocking the thread remains: the author acknowledged it and filed CAMEL-25690 for the follow-up. That is a pre-existing pattern preserved by this PR, not introduced by it — acceptable here.
Previous findings are otherwise all addressed. LGTM.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
davsclaus
left a comment
There was a problem hiding this comment.
Thanks @etzel-mes, I re-checked the new revision. The Java change is the commit I approved, rebased onto main. The other differences follow #27908 (CAMEL-25626), which delivers a Bad status whatever omitNullValues says: the test URI drops omitNullValues=false, and the docs, their catalog copy and the 4.24 note no longer ask for it. On this head MiloClientConsumer.handleValueUpdate only omits a null value with a Good status, so the Bad_NodeIdUnknown value reaches the route with the default omitNullValues=true and the test still covers the fix.
The gnodet-bot note on the blocking lookupNamespaceIndex(uri).get() describes the pattern putSubscriptions already had (lookupNamespace(...).get() on main); the producer side and the shared lookup helper are CAMEL-25690.
Nit: the PR description still says the Bad_NodeIdUnknown value comes "with omitNullValues=false", which #27908 made unnecessary.
Merge state: this PR and #27910 conflict in SubscriptionManager: this PR removes handleSubscriptionError and resubscribe right below where #27910 adds recreate(). Keeping recreate() and lookupMonitoredNode and dropping the two removed methods resolves it; @etzel-mes already offered to rebase whichever goes second.
CI: the workflows on cdaba94 are waiting for approval, so nothing has run on this head yet; this approval assumes they go green.
Checked against the project conventions in CLAUDE.md. This is a rules-and-conventions review and does not replace CodeRabbit, Sourcery or SonarCloud.
Claude Code on behalf of @davsclaus.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
|
FYI @etzel-mes: the Claude Code on behalf of Claus Ibsen. This comment was generated by an AI agent and may contain inaccuracies. |
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — the merge commit brings in main with no changes to the PR's own code.
SubscriptionManager.java, MonitorNodesTest.java, the docs, and the upgrade guide are identical to the commit I reviewed yesterday. The merge only picks up upstream changes (including CAMEL-25645 / #27999, which touched ServerCertificateValidationTest in the same module but is unrelated to this fix). No new findings.
Previous findings are all addressed. LGTM.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
Description
CAMEL-25671, raised in the review of #27780.
A consumer node ID whose namespace URI (
nsu=) is not in the namespace table of the server madeSubscriptionManager.lookupNamespacethrow aNullPointerException. It went to the reconnect path, so one wrong entry in anodeslist took the whole client connection down, including the consumers of the other nodes.The consumer now treats such a node like a node that does not exist on the server (#27780): one WARN with the node ID, and one
DataValuewithBad_NodeIdUnknownfor that node (withomitNullValues=false). The other nodes and the connection keep working.The
badSubscriptionsmap and the 10 secondresubscribethat served the oldBad_InvalidArgumentbranch are removed: that branch was unreachable, becauselookupNamespacenever returned null.MonitorNodesTest#unknownNamespaceUriReceivesBadStatusAndTheOtherNodesKeepWorking(fails without the fix: none of the 3 expected messages arrive)nsu=. I can file a separate JIRA for them if wanted.JIRA user:
mardonius(I cannot assign the issue myself).@davsclaus @oscerd could you take a look?
Target
mainbranch)Tracking
Apache Camel coding standards and style
I checked that each commit in the pull request has a meaningful subject line and body.
I have run
mvn clean install -DskipTestslocally from root folder and I have committed all auto-generated changes.AI-assisted contributions
Co-authored-bytrailers) and the PR description identifies the AI tool used.Claude Code on behalf of etzel-mes
🤖 Generated with Claude Code