mikakaraila / node-red-contrib-opcua

A Node-RED node to communicate OPC UA. Uses node-opcua library.
Other
208 stars 191 forks source link

Reconnect problematic of opcua client #677

Open TheeeEnding opened 3 months ago

TheeeEnding commented 3 months ago

Hey Mika, unfortunately I noticed a change from v0.2.320 to v0.2.321 that resulted in some opcua servers to not reconnect correctly after a downtime of the server (they show an active session on the UI but the node-red opcua client is getting no new messages from the server). I'm talking about this keepSessionAlive line that you commented out because of the issue #599 and reactived in v0.2.321.

image

Would it be possible to comment the line out again or do you know if there would be another workaround for me if this line is essential? It seems to mess with the keepAlive of the opcua client and I can't go back to the v0.2.320 as it does not include the correct configuration of transportSettings that another opcua server needs...

Thanks a lot in advance!

fanbel commented 2 months ago

Can confirm that we have the same issue again... would be glad if you could take a look, thank you!

PLCs7 commented 2 months ago

Same problem here, have someone find a solution?

mikakaraila commented 2 months ago

I will update to latest node-opcua in next release as it contains fixes.

TheeeEnding commented 2 months ago

Thanks a lot @mikakaraila ! Just fyi, I've done a few tests in the meantime and was able to nail down the problem to the code line that I mentioned above. With the current version a short downtime of the server is not a problem but when there is a longer downtime (e.g. 4h) the client cannot reconnect successfully. I did these tests also with a locally forked version where I commented the keepAlive line out and the reconnect was working even when there was a longer downtime. I hope the update will fix this issue! thank you!

mikakaraila commented 2 months ago

I just made & published new version. Not fully tested, so I will fix if there is something...

TheeeEnding commented 2 months ago

I tested the new version overnight in order to see the reconnect/keepAlive after a longer downtime and unfortunately the problem is not fixed! The client did not reconnect successfully after the opcua server was down for a few hours

mikakaraila commented 2 months ago

OK, what is server that client tries to reconnect? Can you see what happens when server comes back online?

I have to check node-opcua release notes and perhaps ask if Etienne has some experience...

mikakaraila commented 2 months ago

I will take a look that keepAlive can be disabled...

TheeeEnding commented 2 months ago

Thanks a lot!!

integratec commented 1 month ago

I'm experiencing the same issue. When the server goes down for long time the node continue to keepalive even if the server is unreachable and will never reconnect. The only workaround i found is by restarting the flow. immagine

regrog commented 1 month ago

I'm experiencing the same issue. When the server goes down for long time the node continue to keepalive even if the server is unreachable and will never reconnect. The only workaround i found is by restarting the flow. immagine

Hi, take a look at this solution https://github.com/mikakaraila/node-red-contrib-opcua/issues/638

TheeeEnding commented 1 month ago

@regrog Hi, how would that help? It seems that the solution from https://github.com/mikakaraila/node-red-contrib-opcua/issues/638 only works if the node throws an BadConnection Error. In this example the node does not show any errors but stays in the "keepalive" status

regrog commented 1 month ago

I'm currently on version 0.2.328 I'm having long downtime during the night but yes my node throws BadConnection Error. Did you try to upgrade to the last version?

TheeeEnding commented 1 month ago

I've tested with the 0.2.327 and it still doesnt throw an error. The change from v0.2.327 to 0.2.328 only affects the opcua server node - so I didnt test it

integratec commented 1 month ago

I'm on version 0.2.328, unfortunately no BadConnection errors raised. I already tried the solution at #638 but no luck, may be because the node still stuck in keepalive status like it's not aware the server isn't online anymore.

I think it should be considered normal/expected behaviour that a machine will no longer be accessible... this happens at least every day when a department ends its work. I whould say thanks to @mikakaraila for it's work but sorry... I believe this issue should be labeled as a bug instead of enhancement ;-).