BiancoRoyal / node-red-contrib-iiot-opcua

deprecated - very new developed by PLUS for Node-RED - https://plus4nodered.com
https://www.npmjs.com/package/node-red-contrib-iiot-opcua
BSD 3-Clause "New" or "Revised" License
34 stars 8 forks source link

reconnection after timeout #50

Closed reijosirila closed 5 years ago

reijosirila commented 6 years ago

Problem

Start both flows, different nod-red engines; After subscription, stop opc server node-red engine; Wait a while and then start it again; it will fail to subscribe back all the nodes: [error] [OPCUA-IIoT-Listener:OPC Monitor] TypeError: Cannot read property 'deleteMonitoredItems' of null Most of the cashes whole node-red crashes: ./node-red/node-red-contrib-iiot-opcua/node_modules/node-opcua-client/src/client_monitored_item_base.js:169 assert(subscription.session); ^ AssertionError [ERR_ASSERTION]: subscription.session

Your Environment

Just latest node-red-contrib-iiot-opcua@2.6.1, node-red@v0.18.4, nodejs@v9.5.0

biancode commented 6 years ago

https://github.com/node-opcua/node-opcua/issues/474

biancode commented 6 years ago

please try v2.6.2 it is back on v0.2.2 of node-opcua and works well on my side

reijosirila commented 6 years ago

Well, it's not working; For some reason it terminates one monitor:

  opcuaIIoT:connector Session Created On opc.tcp://localhost:55380/UA/NodeREDFlexIIoTServer For on connect +276ms
  opcuaIIoT:listener:subscribe Monitored Item Unsubscribe ns=4;s=.byStatus +1m
  opcuaIIoT:listener Terminated For 1 +1m
  opcuaIIoT:listener Terminate Monitored Item ns=4;s=.byStatus +0ms
  opcuaIIoT:listener listening (1) +1ms

And with second break crashes:

Server State =  Running
  opcuaIIoT:connector !!!!!!!!!!!!!!!!!!!!!!!!  CLIENT STARTING RECONNECTION !!!!!!!!!!!!!!!!!!! +56s
  opcuaIIoT:connector CONNECTION STARTING RECONNECTION: opc.tcp://localhost:55380/UA/NodeREDFlexIIoTServer +0ms

/Users/reijo/dev/kookon/node-red/node_modules/node-opcua-client/src/client_base.js:290
    assert(!self.isReconnecting);
    ^
AssertionError [ERR_ASSERTION]: !self.isReconnecting

But as I can see, on a master branch of node-opcua there is commit: https://github.com/node-opcua/node-opcua/commit/d5d9e51bc219de1ab242640714fbc40dc946d72b Those yesterdays commits are related with my really old reconnection issue: https://github.com/node-opcua/node-opcua/issues/237 :) 👍

Nafling commented 6 years ago

Hiya reij, did you ever solve this? I am getting a "Server State = Running" timeout, without a reconnect.

I am using a test OPC server from Prosys, but it should not be the issue.

I cannot seem to find any other thread that is talking about this issue.

biancode commented 5 years ago

new in v3.0.0 - improved node-opcua since v0.4.6 - FSM to reconnect via states - very new reconnecting automatically via node-opcua

biancode commented 5 years ago

open a new issue if it does not work from v3.0.0 (not released for now)