Closed JoeZeng133 closed 3 years ago
I just downloaded and tested this case with Ansi C OPC UA Server and with subscription/single read/read multiple node-red client re-connects and everything works as it should.
Can you provide your flow and steps how to reproduce this? As I tested it seems to work.
Test case with read multiple:
Only readmultiple action did not show actual error in case of diagnostics was undefined.
I modified node_error to show actual error to user as in your debug tab it was empty, here is error it should report:
BUT as I tested all read case will re-connect and client works after server start.
My test with UaAnsiCServer is, once connection is established and the node is reading multiple sample values provided by the server, I close UAAnsiCServer's Console, in order to test a complete disconnection. Then that {} empty error is logged. It seems that it reconnects immediately (without RECONNECTING log) and doesn't make the whole Node Red Server restart or freeze as before. Am I testing it wrong? Is that behaviour correct? How have you been simulating disconnection?
This are tests in my local environment. I'm currently not able to test this in the production environment I've been mentioning with the Matrikon Server. Once I have access to that Server I'll inform results and testing this last 0.2.91 version.
I am able again to test in the Productive server I've mentioned (sooner than expected) and get the following error message:
Quote to an earlier comment from @mikakaraila:
I expect Prosys UA Simulation server decides this. I request it to be 300s == 5min but server limits session timeout to 60s. Rename .txt to .js and test again.
Is this error related? Is there something on the Server side to configure?
You can check sessions from the Prosys Server:
Client-node name is used in the sessionName:
I studied more wrapper log and found some interesting errors:
[2020-12-11 15:15:23.113] [StackTrace , 092] EXCEPTION BadCommunicationError 'Could not create COM server 'f8582cf2-88fb-11d0-b850-00c0f0104305' on host 'localhost'. Reason: Class not registered.' Could not create COM server 'f8582cf2-88fb-11d0-b850-00c0f0104305' on host 'localhost'. Reason: Class not registered. [2020-12-11 15:15:23.113] [Error , 092] : Could not connect to server (opc.com://localhost/Matrikon.OPC.Simulation/f8582cf2-88fb-11d0-b850-00c0f0104305). BadCommunicationError 'Could not create COM server 'f8582cf2-88fb-11d0-b850-00c0f0104305' on host 'localhost'. Reason: Class not registered.'
======================================== Id: BadCommunicationError Description: Could not create COM server 'f8582cf2-88fb-11d0-b850-00c0f0104305' on host 'localhost'. Reason: Class not registered.
Could not create COM server 'f8582cf2-88fb-11d0-b850-00c0f0104305' on host 'localhost'. Reason: Class not registered. --- at Opc.Ua.Com.ComUtils.CreateInstance1(Guid clsid, String hostName, UserIdentity identity) --- at Opc.Ua.Com.ServerFactory.CreateServer(Uri uri, UserIdentity identity) --- at Opc.Ua.Com.Client.ComClient.CreateInstance()
[2020-12-11 15:15:23.113] [Information , 092] Calling OPC Classic API IOPCHDA_Server.GetStatus. [2020-12-11 15:15:23.113] [Information , 079] Communication with COM server failed. Disposing server and reconnecting. [2020-12-11 15:15:23.113] [Error , 092] : IOPCHDA_Server.GetStatus ObjectDisposedException 'Cannot access a disposed object. Object name: 'The COM server has been disposed.'.'
======================================== Id: Bad Description: Cannot access a disposed object. Object name: 'The COM server has been disposed.'.
Cannot access a disposed object. Object name: 'The COM server has been disposed.'. --- at Opc.Ua.Com.Client.ComObject.BeginComCall[T](String methodName, Boolean throwOnError) --- at Opc.Ua.Com.Client.ComHdaClient.GetStatus()
[2020-12-11 15:15:23.113] [StackTrace , 079] EXCEPTION BadCommunicationError 'Could not create COM server 'f8582cf2-88fb-11d0-b850-00c0f0104305' on host 'localhost'. Reason: Class not registered.' Could not create COM server 'f8582cf2-88fb-11d0-b850-00c0f0104305' on host 'localhost'. Reason: Class not registered. [2020-12-11 15:15:23.113] [StackTrace , 050] EXCEPTION BadCommunicationError 'Could not create COM server 'f8582cf2-88fb-11d0-b850-00c0f0104305' on host 'localhost'. Reason: Class not registered.' Could not create COM server 'f8582cf2-88fb-11d0-b850-00c0f0104305' on host 'localhost'. Reason: Class not registered. [2020-12-11 15:15:23.113] [Error , 079] : Could not connect to server (opc.com://localhost/Matrikon.OPC.Simulation/f8582cf2-88fb-11d0-b850-00c0f0104305). BadCommunicationError 'Could not create COM server 'f8582cf2-88fb-11d0-b850-00c0f0104305' on host 'localhost'. Reason: Class not registered.'
======================================== Id: BadCommunicationError Description: Could not create COM server 'f8582cf2-88fb-11d0-b850-00c0f0104305' on host 'localhost'. Reason: Class not registered.
Could not create COM server 'f8582cf2-88fb-11d0-b850-00c0f0104305' on host 'localhost'. Reason: Class not registered. --- at Opc.Ua.Com.ComUtils.CreateInstance1(Guid clsid, String hostName, UserIdentity identity) --- at Opc.Ua.Com.ServerFactory.CreateServer(Uri uri, UserIdentity identity) --- at Opc.Ua.Com.Client.ComClient.CreateInstance()
[2020-12-11 15:15:23.113] [Information , 079] Calling OPC Classic API IOPCEventServer.GetStatus. [2020-12-11 15:15:23.113] [Error , 079] : IOPCEventServer.GetStatus ObjectDisposedException 'Cannot access a disposed object. Object name: 'The COM server has been disposed.'.'
======================================== Id: Bad Description: Cannot access a disposed object. Object name: 'The COM server has been disposed.'.
Cannot access a disposed object. Object name: 'The COM server has been disposed.'. --- at Opc.Ua.Com.Client.ComObject.BeginComCall[T](String methodName, Boolean throwOnError) --- at Opc.Ua.Com.Client.ComAeClient.GetStatus()
[2020-12-11 15:15:23.113] [Information , 079] OPC Classic API IOPCEventServer.GetStatus call completed. [2020-12-11 15:15:23.113] [Information , 092] OPC Classic API IOPCHDA_Server.GetStatus call completed. [2020-12-11 15:15:23.113] [Error , 050] : Could not connect to server (opc.com://localhost/Matrikon.OPC.Simulation/f8582cf2-88fb-11d0-b850-00c0f0104305). BadCommunicationError 'Could not create COM server 'f8582cf2-88fb-11d0-b850-00c0f0104305' on host 'localhost'. Reason: Class not registered.'
======================================== Id: BadCommunicationError Description: Could not create COM server 'f8582cf2-88fb-11d0-b850-00c0f0104305' on host 'localhost'. Reason: Class not registered.
Could not create COM server 'f8582cf2-88fb-11d0-b850-00c0f0104305' on host 'localhost'. Reason: Class not registered. --- at Opc.Ua.Com.ComUtils.CreateInstance1(Guid clsid, String hostName, UserIdentity identity) --- at Opc.Ua.Com.ServerFactory.CreateServer(Uri uri, UserIdentity identity) --- at Opc.Ua.Com.Client.ComClient.CreateInstance()
[2020-12-11 15:15:23.113] [Information , 050] Calling OPC Classic API IOPCServer.GetStatus. [2020-12-11 15:15:23.128] [Error , 050] : IOPCServer.GetStatus ObjectDisposedException 'Cannot access a disposed object. Object name: 'The COM server has been disposed.'.'
======================================== Id: Bad Description: Cannot access a disposed object. Object name: 'The COM server has been disposed.'.
Cannot access a disposed object. Object name: 'The COM server has been disposed.'. --- at Opc.Ua.Com.Client.ComObject.BeginComCall[T](String methodName, Boolean throwOnError) --- at Opc.Ua.Com.Client.ComDaClient.GetStatus()
One reason can be that wrapper is not fast enough when connection break occurs and it runs original Classic OPC and tries to return server status and restore all Items from the server back to OPC UA. Can you test with just 5-10 items so server will response faster and re-connect will not timeout?
In case of Free OPCUA server does not provide needed re-connect service (Unsupported error).
I let the Productive Server with ~15 items for 30 minutes and no error message showed up. Then I added items in a total of ~60 items for 30 minutes and no error messages showed up. Then I added items in a total of ~150 items for 120 minutes and no error messages showed up. Then I added items in a total of ~250 items for 20 minutes and THEN same error messages showed up.
Attached the log for you. (Edit: Having some trouble to attach the file)
Hmm, server does not accept longer session timeout and re-connect takes too long time with 250 items.
I expect there is nothing that I can do, but can you run parallel 150 items / client node? Try & test what happens then with server...
All additions of items I are for different clients. All of them with "Read Multiple" action. Sorry if I haven't make it clear.
It would be like this:
I let the Productive Server's Client 1 with ~15 items for 30 minutes and no error message showed up. Then I added the Client 2 with 45 items (making a total of items in a total of ~60 items) for 30 minutes and no error messages showed up. Then I added the Client 3 with 90 items (making a total of items in a total of ~150 items) for 120 minutes and no error messages showed up. Then I added the Client 4 with 100 items (making a total of items in a total of ~250 items) for 20 minutes and THEN same error messages showed up.
So, as described, no more than 150 items/client node running in parallel.
One strange message:
xxxxx <<<<<< _on_message_received for unknown or timeout request 6067 ServiceFault BadInvalidTimestamp (0x80230000) 5532609
Server cancels connection:
Client node error on: error: "Cannot read endpoints: Error: No SecureChannel , connection may have been canceled abruptly by server" 6 Jan 15:12:18 - [error] [OpcUa-Client:86eb5a39.9c2508] Client node error on: error: "Cannot read endpoints: Error: No SecureChannel , connection may have been canceled abruptly by server" Client node error on: error: " OPC UA connection error: " 6 Jan 15:12:18 - [error] [OpcUa-Client:86eb5a39.9c2508] Client node error on: error: " OPC UA connection error: " Client node error on: error: "Client not yet created & connected, cannot getEndpoints!"
Client node error on: error: " OPC UA connection error: " 6 Jan 15:13:12 - [error] [OpcUa-Client:39ed5a66.e57f4e] Client node error on: error: " OPC UA connection error: " Client node error on: error: "Cannot read endpoints: Error: No SecureChannel , connection may have been canceled abruptly by server" 6 Jan 15:13:12 - [error] [OpcUa-Client:39ed5a66.e57f4e] Client node error on: error: "Cannot read endpoints: Error: No SecureChannel , connection may have been canceled abruptly by server"
Finally:
6 Jan 15:13:12 - [error] [OpcUa-Client:f5b707d4.9b7e1] Client node error on: error: {}
ERROR !!! callback has thrown en error Error
at Object.assert (/home/ldc/.node-red/node_modules/node-opcua-assert/dist/index.js:13:21)
at /home/ldc/.node-red/node_modules/node-opcua-client/dist/private/client_base_impl.js:414:45
at ClientSecureChannelLayer.
dispose when pendingTransactions is not empty dispose when pendingTransactions is not empty 6 Jan 15:14:12 - [error] [OpcUa-Client:f5b707d4.9b7e1] Client node error on: error: " OPC UA connection error: serviceResult = BadSessionClosed (0x80260000)" 6 Jan 15:14:12 - [error] [OpcUa-Client:f5b707d4.9b7e1] Client node error on: error: " OPC UA connection error: serviceResult = BadSessionClosed (0x80260000)" dispose when pendingTransactions is not empty dispose when pendingTransactions is not empty
Test with 4 client node each with 80-90 items. What happens? I mean total amount more than limit but spread with multiple. Client should have less than 100 items each, if limit is around 100/client.
Or 6 clients each with 50 items.
New configuration with each client with around 50 items: Client 1 --> 59 Items Client 2 --> 45 Items Client 3 --> 51 Items Client 4 --> 52 Items Client 5 --> 39 Items Client 6 --> 44 Items Client 7 --> 65 Items Client 8 --> 32 Items
Error appeared after 15 minutes:
Do you have multiple injects with different intervals? This caauses most probably problems like this:
Pending transactions: ReadRequest ReadRequest ReadRequest ReadRequest ReadRequest ReadRequest ReadRequest ReadRequest ReadRequest ReadRequest ReadRequest Warning : your opcua client is sending multiple requests simultaneously to the server ReadRequest Warning : please fix your application code
Your flow should have one inject with interval to first client, then from client output small delay to next client so each readmultiple is running separately. I expect wrapper -> server will keep these in some queue and as queue grows then also response will come later and later until it exceeds timeout.
ReadMultiple is always slower and more resource demanding for server than subscribe. Your flow most probably exceeds server performance... as error will occur only after some 10-20 minutes.
You should perhaps monitor Wrapper&Server memory and handle usage if there is resource leak.
I made a cascade of "Read Multiple" actions with an inject that executes every 10 seconds. After the effective read of the first value, it sends the read action to the next client, with an delay of 1 second. So on to every client with the same items distribution as before (around 50 items each client).
But following error showed up:
Now the first error comes from the server itself:
Client node error on: error: {"response":{"responseHeader":{"timestamp":"2021-01-08T14:22:06.254Z","requestHandle":38,"serviceResult":{"value":2149777408},"serviceDiagnostics":{"symbolicId":-1,"locale":-1,"localizedText":-1,"innerStatusCode":{"value":0}},"stringTable":[""]}},"request":{"requestHeader":{"authenticationToken":"ns=0;b=b85ddbc3e6ec42855b4d5d85c8ac310ac8fa722c8c61120411b3f28b7dec892b","timestamp":"2021-01-08T14:11:34.685Z","requestHandle":38,"returnDiagnostics":0,"auditEntryId":"","timeoutHint":60000},"maxAge":0,"timestampsToReturn":"Neither","nodesToRead":[{"nodeId":"ns=6;s=0:ArchestrA.Targets_Prepa.CRSH_PLANT_CAP","attributeId":13,"indexRange":"NumericRange:
Decimal -> hex and then: https://documentation.unified-automation.com/uasdkhp/1.0.0/html/group__ua__statuscodes.html
8 Jan 11:26:42 - [info] [mindconnect:16cc072c.a0e449] Posted last bulk message at Fri Jan 08 2021 11:26:36 GMT-0300 (Argentina Standard Time) 8 Jan 11:26:42 - [info] [mindconnect:16cc072c.a0e449] Parallel requests status: 1 finished with 0 errors at Fri Jan 08 2021 11:26:36 GMT-0300 (Argentina Standard Time)
"timestamp":"2021-01-08T14:22:06.254Z"
Question: client & server time difference could be too much, please check. This could cause state that client cannot connect anymore to server.
Server will not accept re-connect after this: 8 Jan 11:26:52 - [error] [OpcUa-Client:86eb5a39.9c2508] Client node error on: error: {} Client node error on: error: {} 8 Jan 11:26:52 - [error] [OpcUa-Client:86eb5a39.9c2508] Client node error on: error: {} xxxxx <<<<<< _on_message_received for unknown or timeout request 41 ServiceFault BadSessionIdInvalid (0x80250000) 6389110 Client node error on: error: "Cannot read endpoints: Error: ClientSecureChannelLayer => Socket is closed !" 8 Jan 11:26:52 - [error] [OpcUa-Client:86eb5a39.9c2508] Client node error on: error: "Cannot read endpoints: Error: ClientSecureChannelLayer => Socket is closed !" Client node error on: error: " OPC UA connection error: Server end point are not known yet" 8 Jan 11:26:52 - [error] [OpcUa-Client:86eb5a39.9c2508] Client node error on: error: " OPC UA connection error: Server end point are not known yet" Client node error on: error: "Cannot read endpoints: Error: No SecureChannel , connection may have been canceled abruptly by server" 8 Jan 11:26:52 - [error] [OpcUa-Client:86eb5a39.9c2508] Client node error on: error: "Cannot read endpoints: Error: No SecureChannel , connection may have been canceled abruptly by server" Client node error on: error: " OPC UA connection error: " 8 Jan 11:26:52 - [error] [OpcUa-Client:86eb5a39.9c2508] Client node error on: error: " OPC UA connection error: " Client node error on: error: "Cannot read endpoints: Error: No SecureChannel , connection may have been canceled abruptly by server" 8 Jan 11:26:52 - [error] [OpcUa-Client:86eb5a39.9c2508] Client node error on: error: "Cannot read endpoints: Error: No SecureChannel , connection may have been canceled abruptly by server" Client node error on: error: " OPC UA connection error: " 8 Jan 11:26:52 - [error] [OpcUa-Client:86eb5a39.9c2508] Client node error on: error: " OPC UA connection error: " Client node error on: error: "Client not yet created & connected, cannot getEndpoints!"
The time wasn't synced at server and client for a few minutes. The server syncs against an SCADA Server routine in order to keep in time, the client running node red doesn't. So now the time in the Node Red was configured (manually) to match minutes and seconds (not milliseconds and no exact sync).
Letting the flows running and logging, the following error appeared:
Client node error on: error: " error at active reading: Session has been closed and should not be used to perform a transaction anymore" 12 Jan 19:38:52 - [error] [OpcUa-Client:f837011b.6e2b1] Client node error on: error: " error at active reading: Session has been closed and should not be used to perform a transaction anymore"
Logfile: logOPCUA.txt
Is this still time sync related? Should is it needed to sync the node red client with a rountine to be exactly the same?
Other question: Is this multiple read cascade the only way to make it work? or was it just for test purpose? Because we may need to read more frequent some variables and other less frequent (and it may be to stressful for the server that we ask for every variable at the fastest time, just because all variables are in cascade read)
First error does not tell actually nothing. No reason why session is closed and client is not starting to re-connect. So connection is for the client "valid". Strange...
12 Jan 19:07:15 - [debug] Flushing localfilesystem context scope 51bd13a.6a9e2ec Client node error on: error: {} 12 Jan 19:07:15 - [error] [OpcUa-Client:6139e2f8.2d3c3c] Client node error on: error: {} Client node error on: error: {} 12 Jan 19:07:15 - [error] [OpcUa-Client:cf4ea7f1.6de148] Client node error on: error: {} Client node error on: error: " error at active reading: Invalid Channel " 12 Jan 19:07:17 - [error] [OpcUa-Client:f837011b.6e2b1] Client node error on: error: " error at active reading: Invalid Channel "
Can you see anything on server / wrapper log at the same time?
I made v0.2.93 that will report a bit more if there is something on the error object.
I left Node Red Flows (with your mentioned v0.2.93) and Matrikon Tunneler Server logging for ~3 days and no (relevant) errors showed up either in Node Red or Server.
Just one error appeared when I restarted the Matrikon Tunneler Server to enable it's logging functionality, but the node reconnected immediately, so it seems to be working ok:
Client node error on: error: " error at active reading: Connection Break" 15 Jan 09:49:40 - [error] [OpcUa-Client:cf4ea7f1.6de148] Client node error on: error: " error at active reading: Connection Break" Client node error on: error: " error at active reading: Connection Break" 15 Jan 09:49:40 - [error] [OpcUa-Client:3e7ac4c.835fabc] Client node error on: error: " error at active reading: Connection Break" Client node error on: error: " error at active reading: Invalid Channel " 15 Jan 09:49:44 - [error] [OpcUa-Client:f837011b.6e2b1] Client node error on: error: " error at active reading: Invalid Channel "
The question now is: Is it possible to get to the earlier configuration, where groups of variables are read in a certain interval group? (some variables are read every 5 seconds and others in a 1 to 20 minutes interval) What could be the strategy? Can I reconfigure parallel Multiple-Reads as before? Or maybe configuring 1 Inject Node to have an interval of 5 seconds and having a counter at the output of the 5-seconds-client that gets the multiplier of that and send "read" action to the 30-seconds-client for every 6 outputs? The disadvantage of this is that if the first client's read-action takes more or less time (having an output of the client every 5 to 7 seconds), the frequency of the longer variable groups will be affected (instead of 6x5 seconds = 30 seconds, it will be, for example, 3x5+2x6+1x7=34 seconds ) Read time determinism is relevant.
What strategy do you suggest to avoid communication problems/errors?
I don´t know how server creates response with Matricon wrapper. Will it keep those items on cache or not. But I expect server can be overloaded with too many reads containing too many items.
Only way to study this more is to test different options, but you should avoid a case that multiple reads are active at the same time to server. There should be perhaps 1-2 second delay before next read request is done to server.
Hi,
I let the node logging and yesterday appeared following error, which led to restart Node Red:
20 Jan 10:40:16 - [error] [OpcUa-Client:6139e2f8.2d3c3c] Client node error on: error: " error at active reading: Session has been closed and should not be used to perform a transaction anymore"
ERROR !!! callback has thrown en error Error
at Object.assert (/home/ldc/.node-red/node_modules/node-opcua-assert/dist/index.js:13:21)
at /home/ldc/.node-red/node_modules/node-opcua-client/dist/private/client_base_impl.js:414:45
at ClientSecureChannelLayer.
Node Red Log at that time: nodeRedlog.txt
You didn´t run with -v (verbose option)? Which version you are using? One thing that can cause this as endpoints are not listed then there is no endpoint available for some reason. I will add one check into the code, new version will be 0.2.96
HI, Our flows are currently running on 0.2.104 and following error appeared: "Client node error on: error: [" error at active reading: serviceResult = BadNothingToDo (0x800f0000)"]"
What could it be? It is still reading in cascade (what means, no ReadRequest overlapping, as suggested by, i guess, new log warning)
Hmm, then there's read request without any nodeid.
Hello, I have the same problem. How do I resolve the problem? I'am new at node red and github.
Your flow is missing msg.topic content most probably. Read my comment above...
Or add your flow here that causes problem.
trying to read a tag that does not exist on the OPC UA server. It logs the error to the debug console, but the catch node does not catch it. Below is the simple flow to generate this issue.