-
Notifications
You must be signed in to change notification settings - Fork 87
Opcua binding refactor #1451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Opcua binding refactor #1451
Conversation
- and refactor connection management
99133b4 to
f12f153
Compare
f12f153 to
1b26f48
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1451 +/- ##
==========================================
+ Coverage 77.58% 77.65% +0.07%
==========================================
Files 79 86 +7
Lines 15331 15903 +572
Branches 1445 1501 +56
==========================================
+ Hits 11894 12349 +455
- Misses 3414 3531 +117
Partials 23 23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
danielpeintner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Minor: copyright year could/should be updated
Co-authored-by: danielpeintner <[email protected]>
Co-authored-by: danielpeintner <[email protected]>
Co-authored-by: danielpeintner <[email protected]>
danielpeintner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the latest change!
code clean up
remove redundant
findBasicTypeCode( as already provided by node-opcua with better implementation)fix issue: Connection Sharing Bug in OPC UA Client
Root Cause
A recent change in how the href field is constructed introduced a bug in connection sharing. Previously, the href and opcua:nodeid were separate fields, like this:
{ "href": "opc.tcp://localhost:4840", "opcua:nodeid": "ns=1;s=Temperature" }Now, the href includes the node ID as a query parameter:
{ "href": "opc.tcp://localhost:4840/?id=ns=1;s=Temperature" }note: both syntaxes are still supported
Because the href is now unique for each node, the OPCAProtocolClient treats each request as requiring a new connection. This leads to session exhaustion on the server, as connections are not being reused.
Why this happens
The
hrefwas previously used as a key to identify and reuse existing connections. With the new scheme, everyhrefis unique, so the client creates a new connection for each operation.the fix
To restore connection sharing, the
hrefis first normalized by removing the query parameters before using it as a connection key. This ensures that connections to the same endpoint (e.g., opc.tcp://localhost:4840) are reused, regardless of the node ID in the query.In the meantime, a refactor and simplification of the connection sharing mecanism has been undertaken
Refactor codec:
A commit refactors the codec logic in the OPCUA binding into multiple files.
The main
codec.tsfile has been split into:opcua-binary-codec.tsopcua-data-schemas.ts