Closed youngkzy closed 3 years ago
If it is just lost connection, then server "keeps" subscription and nodeIds in it´s memory. But as server boots then everything is lost, client will try to create session, subscription etc. I cannot remember how long it will retry & how many times, depends on client parameters. Plus some servers can behave different way after reboot. You should test different cases: network break, server start, server boot.
@mikakaraila, Thanks for your quick reply. OK I can test this, but I'm also looking to "fix" by means of some flow logic and nodes to address it if it's not a "node" problem. It probably isn't your node. Kepware server reboots every night. I was using the system on my work PC to monitor some tags in a system for troubleshooting. It failed as the server rebooted... What recommendation do you have for this kind of problem using what is already there. The examples do not go into this kind of thing. Can I monitor NODE STATUS? (Node-RED Status Node) Or can I monitor a clock on the OPC Server system tags? Or can I monitor something from OPCUA node which tells me that the connection is broke in order to force a new connection? Now, I need to understand...
This kind of thing. No need to do the work for me. Good explanation should suffice as long as I can get the hows related to the nodes.
Thanks
You can use Catch node to monitor node status, this way:
It can be that computer is running, but OPC UA Server (KepServer) will crash. Then ping will not report it. If computer will crash then ping will detect it.
Or use READ Current time from the server, if current time is not updated.
@mikakaraila , Thanks for that advice. OK, So subscribing to an already set subscription is going to get me multiple values of the same tags when I add the same list to the subscription. How would I connect if I can sense that the subscription is still valid? And perhaps understand that it is still valid? Can I ask the system how many items are in the subscription? or get that from some reporting value in the node?
You can see this so client will try to re-connect to server:
Client contains re-connect code that is implemented inside node-opcua.
@mikakaraila , I do not know if I asked the question in the right way. Or maybe I'm a bit dense... If it is obvious, I'm overlooking it. Let's say...
Is it that if the loss of connection and a PING is available, then just DELETE the subscriptions and re-SUBSCRIBE? If the SUBSCRIBE fails, wait BROWSE and then SUBSCRIBE on Success of BROWSE? How would you do it such to correct a lost connection of type A, B, C, ... etc? Thanks in advance.
1) I suppose client will try to connect again, create session and if server doesn´t return old subscription then library will create a new one. No need to do anything. 2) Same story client should first re-connect on network level and then do as in case 1)
Node-opcua makes life easy, don´t try to do it too complicated on the application level as library already handles it.
@mikakaraila , Again Thanks for your help. My problem is one that does not behave for some reason and it appears that it is stubborn. I came to work today to find my tags I am monitoring for debugging and writing to a log file are disconnected. And the status is RED under the SUBSCRIBE nodes. Thus the basis for these questions and my persistence. Sorry! The server may have been re-booted again. I was told that this should only happen on weekends. So I'm unsure of what transpired and working to find out. However, my logging did not work for the time which it found this fault. I applied my manual Inject nodes to initiate the SUBSCRIBE to get it back to working, as it was just sitting there. Kind Regards, @youngkzy
It depends also on server how it behaves.
But as primary root cause is server boot, it would be better to solve it. Memory/driver problem or power supply...
@mikakaraila , The remote server in this case is supposed to re-boot on some weekly basis. That is for Windows updates etc... So, it's not THE problem, but it is a thing I need to deal with. I guess we are not quite on the same page. I am OK with it behaving this way on Kepware if that isn't an issue for anyone else. I require no extra attention except to get a clean way to get back to monitoring. I can use the method I described earlier IF that is the best way to approach it.
One question before I leave you... or assumption I want to verify. If the system for some reason has a subscription, but it disconnects, Is the only way to re-connect, to dump/delete the current subscription and Subscribe with a new one? assumption: there is no way to connect manually to a subscription. The only way I know to know how many items is from the subscription report in the messages.
Kind Regards,
As server does not have any subscriptions after reboot, I suppose you can just create it again after ping works. Some delay most probably needed before KepServer is really running and accepting connections.
QUESTION: Subscribed to arrays on Kepware OPC Server 6 and monitoring tags. During the weekend the OPC Server on a Windows Server was restarted and the connection was lost. This morning, I entered a new subscription to the data. What is the reccommended method to handle OPC Server disconnections and re-connections? The active subscription makes the connection, Is there a means to re-connect to an existing subscription? Otherwise I get duplicates as There is a subscription to the same tags multiple times.
Please see log entry below. Pending transactions: CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest
Warning : your opcua client is sending multiple requests simultaneously to the server CreateMonitoredItemsRequest Warning : please fix your application code
An Example of a means would be great if it already exists, I cannot locate it in the documentation. Thanks,
7 Mar 03:03:47 - [info] [OpcUa-Client:47dd96a3.f1d24] Local 'own' certificate is NOT used. 7 Mar 03:03:47 - [info] [OpcUa-Client:13644426.3baa04] Local 'own' certificate is NOT used. 7 Mar 03:03:47 - [info] [OpcUa-Client:b87d7f1f.99c9f8] Local 'own' certificate is NOT used. 7 Mar 03:03:47 - [info] [OpcUa-Client:8ccafbf8.94798] Local 'own' certificate is NOT used. 7 Mar 03:03:47 - [info] [OpcUa-Client:38becfeb.98bcf8] Local 'own' certificate is NOT used. 7 Mar 03:03:47 - [info] [OpcUa-Client:d553c505.0194e8] Local 'own' certificate is NOT used. 7 Mar 03:03:47 - [info] [OpcUa-Client:e8cd7ae1.5e03b8] Local 'own' certificate is NOT used. 7 Mar 03:03:47 - [info] [OpcUa-Client:f1b8fc45.3cbfc] Local 'own' certificate is NOT used. 7 Mar 03:03:47 - [info] [OpcUa-Client:3fc80617.5f26aa] Local 'own' certificate is NOT used. 7 Mar 03:03:47 - [info] [OpcUa-Client:513a9e47.2aa0d8] Local 'own' certificate is NOT used. 7 Mar 03:03:47 - [info] [OpcUa-Client:a873f9c4.c72ad8] Local 'own' certificate is NOT used. 7 Mar 03:03:47 - [info] [OpcUa-Client:6ac902f2.a5c424] Local 'own' certificate is NOT used. 7 Mar 03:03:47 - [info] Started flows 7 Mar 03:03:47 - [info] [tcp in:78cdb0e7.d8d6a8] listening on port 1026 7 Mar 03:03:47 - Connection successful for database with user undefined 7 Mar 03:03:47 - [info] [mqtt-broker:cec7206.b4cf76] Connected to broker: mqtt://localhost:1883 7 Mar 03:03:49 - [info] [OpcUa-Browser:5ccb2e21.230368] start browse client on opc.tcp://someplace:49320 7 Mar 03:03:49 - [info] [OpcUa-Browser:5ccb2e21.230368] start browse session on opc.tcp://someplace:49320 7 Mar 03:03:49 - [warn] [OpcUa-Browser:5ccb2e21.230368] browseTopic:ns=0;i=85 7 Mar 03:03:49 - [info] [OpcUa-Browser:88937ecb.49e6d8] start browse client on opc.tcp://someplace:49320 7 Mar 03:03:49 - [info] [OpcUa-Browser:c6451f87.abbce] start browse client on opc.tcp://127.0.0.1:49320 7 Mar 03:03:49 - [warn] [OpcUa-Browser:5ccb2e21.230368] sending items 9 7 Mar 03:03:49 - [warn] [OpcUa-Browser:5ccb2e21.230368] close browse session 7 Mar 03:03:49 - [info] [OpcUa-Browser:c6451f87.abbce] start browse session on opc.tcp://127.0.0.1:49320 7 Mar 03:03:49 - [warn] [OpcUa-Browser:c6451f87.abbce] browseTopic:ns=0;i=85 7 Mar 03:03:49 - [info] [OpcUa-Browser:88937ecb.49e6d8] start browse session on opc.tcp://someplace:49320 7 Mar 03:03:49 - [warn] [OpcUa-Browser:88937ecb.49e6d8] browseTopic:ns=0;i=85 Pending transactions: CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest CreateMonitoredItemsRequest Warning : your opcua client is sending multiple requests simultaneously to the server CreateMonitoredItemsRequest Warning : please fix your application code 7 Mar 03:03:49 - [warn] [OpcUa-Browser:88937ecb.49e6d8] sending items 9 7 Mar 03:03:49 - [warn] [OpcUa-Browser:88937ecb.49e6d8] close browse session 7 Mar 03:03:49 - [warn] [OpcUa-Browser:c6451f87.abbce] sending items 11 7 Mar 03:03:49 - [warn] [OpcUa-Browser:c6451f87.abbce] close browse session 8 Mar 08:19:39 - [warn] [OpcUa-Browser:88937ecb.49e6d8] input browser 8 Mar 08:19:39 - [info] [OpcUa-Browser:88937ecb.49e6d8] start browse client on opc.tcp://someplace:49320 8 Mar 08:19:39 - [info] [OpcUa-Browser:88937ecb.49e6d8] start browse session on opc.tcp://someplace:49320 8 Mar 08:19:39 - [warn] [OpcUa-Browser:88937ecb.49e6d8] browseTopic:ns=2;s=InstantInkSort1.InstantSort_CLX.Global.Gaylord_Data 8 Mar 08:19:39 - [warn] [OpcUa-Browser:88937ecb.49e6d8] sending items 22 8 Mar 08:19:39 - [warn] [OpcUa-Browser:88937ecb.49e6d8] close browse session 8 Mar 08:19:46 - [warn] [OpcUa-Browser:5ccb2e21.230368] input browser 8 Mar 08:19:47 - [info] [OpcUa-Browser:5ccb2e21.230368] start browse client on opc.tcp://someplace:49320 8 Mar 08:19:47 - [info] [OpcUa-Browser:5ccb2e21.230368] start browse session on opc.tcp://someplace:49320 8 Mar 08:19:47 - [warn] [OpcUa-Browser:5ccb2e21.230368] browseTopic:ns=2;s=InstantInkSort1.InstantSort_CLX.Global.Gaylord_MovePackage_x 8 Mar 08:19:47 - [warn] [OpcUa-Browser:5ccb2e21.230368] sending items 99 8 Mar 08:19:47 - [warn] [OpcUa-Browser:5ccb2e21.230368] close browse session