st-one-io / node-red-contrib-opc-da

A Node-RED node to interact with OPC-DA servers.
Apache License 2.0
11 stars 8 forks source link

Unable to recover from lost connection #10

Open tiagoafseixas opened 4 years ago

tiagoafseixas commented 4 years ago

Hi,

I have been running my OPC-Da connecter successfully for a few months, but everytime a connection is lost we need to restart the server.

At first we get the following message:

"Disconnected from the server - Unknown error!"

Followed by:

Error: Received unexpected PDU from server.
    at ConnectionOrientedEndpoint.call ((...)\.node-red\node_modules\node-dcom\dcom\rpc\connectionorientedendpoint.js:108:13)
    at async ComServer.call ((...)\.node-red\node_modules\node-dcom\dcom\rpc\stub.js:98:12)
    at async ComServer.call ((...)\.node-red\node_modules\node-dcom\dcom\core\comserver.js:510:5)
    at async ComObjectImpl.call ((...)\.node-red\node_modules\node-dcom\dcom\core\comobjcimpl.js:202:14)
    at async OPCSyncIO.read ((...)\.node-red\node_modules\node-opc-da\src\opcSyncIO.js:90:21)
    at async Timeout.doCycle [as _onTimeout] ((...)\.node-red\node_modules\node-red-contrib-opc-da\red\opc-da.js:442:17)

After these errors occur the connector keeps trying to connect and all we see is:

Error: connection timeout
    at Timeout.<anonymous> (....\.node-red\node_modules\node-dcom\dcom\transport\comtransport.js:171:16)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7)
steuck13 commented 4 years ago

Greetings

By "we need to restart the server" you mean your OPC server?I'm trying to reproduce your issue and even though the same error messages appear the node eventually reconnects to the server.

There is a known issue related to previous connections and error messages. Sometimes when trying to reconnect (create a new server object) our server object, the old one is not fully erased and keeps trying to reconnect, which could explain those error messages.

Despite those messages, are you still capable of reading items from your OPC server?

Ty for your report

tiagoafseixas commented 4 years ago

My choice of words was poor :)

What I meant is that we need to redeploy the flow in order to recover the connection. Once those errors appear we stop reading receiving information in our MQTT server so I am assuming that in fact the connector is not able to reestablish the connection to the OPC server.

smilingdwarf commented 3 years ago

Hello @tiagoafseixas, do you by chance have any news on this error / how you were able to solve this? It'd be great to hear back from you as we keep running into the same issue. Thanks

tiagoafseixas commented 3 years ago

@smilingdwarf No, we had to implement log monitoring to restart the Node-Red flow when this error occurred, albeit lately it has not happened

eyeblack42 commented 3 years ago

@tiagoafseixas We are running into the same issue whenever our opc server drops out from a plc reset. Any chance you could share more about what you mean by log monitoring to restart? Thanks!

tiagoafseixas commented 3 years ago

@tiagoafseixas We are running into the same issue whenever our opc server drops out from a plc reset. Any chance you could share more about what you mean by log monitoring to restart? Thanks!

@eyeblack42 We have an ELK stack monitoring logs and searching for the error message. Once it happens we are warned and we restart the server, but the problem still occurs.