mikakaraila / node-red-contrib-opcua

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

Node-Red server Crash (too many connections) #441

Open AdemHamza opened 2 years ago

AdemHamza commented 2 years ago

Hello @mikakaraila ,

Here I am once again. I have an issue with the node-red server that crashes. I tried to debug but I can't seem to understand the cause. attached is the cmd Log. OPC-UA server issue.txt

Thank you for the support and have a great day :)

mikakaraila commented 2 years ago

Just too many client nodes or other clients opening too many sessions to server. Default value is 10 and maximum is 50 (I just added parameter that can be used to change it).

OPCUAServerEndPoint#_on_client_connection The maximum number of connection has been reached - Connection is refused

AdemHamza commented 2 years ago

I just changed the the maximum connexions to 50 even though I have only two clients. I'm gonna test the stability of the server and give you the feedback.

Thank you again :) you're a life saver

AdemHamza commented 2 years ago

Hello @mikakaraila , I'm still having a Node-red server Crash even though I didn't have any "too many connections" in the cmd log. I got this error without a previous warning

9 Jun 10:24:28 - [warn] [function:Check Connection] lost connection 9 Jun 10:24:29 - [warn] [function:Check Connection] lost connection 9 Jun 13:30:00 - [red] Uncaught Exception: 9 Jun 13:30:00 - [error] Error: subscription must be active and not terminated at assert (C:\Users\SESI009727.node-red\node_modules\node-opcua-assert\source\index.ts:12:21) at ClientSubscriptionImpl._add_monitored_item (C:\Users\SESI009727.node-red\node_modules\node-opcua-client\source\private\client_subscription_impl.ts:697:15) at ClientMonitoredItemImpl._before_create (C:\Users\SESI009727.node-red\node_modules\node-opcua-client\source\private\client_monitored_item_impl.ts:334:22) at Function._toolbox_monitor (C:\Users\SESI009727.node-red\node_modules\node-opcua-client\source\client_monitored_item_toolbox.ts:61:27) at C:\Users\SESI009727.node-red\node_modules\node-opcua-client\source\private\client_subscription_impl.ts:1041:40 at Immediate.waitForSubscriptionAndMonitor (C:\Users\SESI009727.node-red\node_modules\node-opcua-client\source\private\client_subscription_impl.ts:730:17) at processImmediate (internal/timers.js:464:21)

C:\Users\SESI009727> C:\Users\SESI009727> C:\Users\SESI009727> C:\Users\SESI009727> C:\Users\SESI009727> C:\Users\SESI009727> C:\Users\SESI009727> C:\Users\SESI009727> C:\Users\SESI009727> C:\Users\SESI009727>

mikakaraila commented 2 years ago

You have some other problems before, try to solve first root cause:

Connection] lost connection

Because all messages are actually coming from node-opcua library, not from the node-red-contrib-opua

AdemHamza commented 2 years ago

nothing is using the Library OPCUA. the lost connection is a modbus node. I guess I'm going to try to réinstall the OPC-UA node. Thanks

mikakaraila commented 2 years ago

What about these on the console?

9 Jun 13:30:00 - [error] Error: subscription must be active and not terminated at assert (C:\Users\SESI009727.node-red\node_modules\ node-opcua-assert \source\index.ts:12:21) at ClientSubscriptionImpl._add_monitored_item (C:\Users\SESI009727.node-red\node_modules\ node-opcua-client \source\private\client_subscription_impl.ts:697:15) at ClientMonitoredItemImpl._before_create (C:\Users\SESI009727.node-red\node_modules\node-opcua-client\source\private\client_monitored_item_impl.ts:334:22) at Function._toolbox_monitor (C:\Users\SESI009727.node-red\node_modules\node-opcua-client\source\client_monitored_item_toolbox.ts:61:27) at C:\Users\SESI009727.node-red\node_modules\node-opcua-client\source\private\client_subscription_impl.ts:1041:40 at Immediate.waitForSubscriptionAndMonitor (C:\Users\SESI009727.node-red\node_modules\node-opcua-client\source\private\client_subscription_impl.ts:730:17)

AdemHamza commented 2 years ago

That's the error that I can't undrestand. this is the only flow using OPC-UA nodes.

OPC-UA Flow.txt I started the Node-red on Verbose mode to see if I can see more. in the 3 last days it happened to me at least one time a day

mikakaraila commented 2 years ago

Use logLevel (settings.js) and trace will tell everything, perhaps even too much. debug level should be enough.

Do you have network monitoring? If not, use "ping IP-address -t" for the server IP-address to see if there is network break.

And use UaExpert to follow same variables if it will report some break.

I hope you will find actual cause for the connection lost...

AdemHamza commented 2 years ago

Hello @mikakaraila, I finally found the source of the error but still it doesn't make much sense to me. the error accure when I try to delete the subscription in the OPC-UA client and relunch subscriptions in a function node (you can see the the picture attached). I run this function at the beginning of each shift and that's the reason why the server crashes. I added a delay function of one second and still got the Node-red server to crash. weirdly when I use the "action: deletesubscription" in a function alone it works fine !!! hopefully it can help : OPCUA-Subscribe function )

mikakaraila commented 2 years ago

Try to terminate subscription first.

On Sat, Jun 11, 2022, 01:43 NooB-worior @.***> wrote:

Hello @mikakaraila https://github.com/mikakaraila, I finally found the source of the error but still it doesn't make much sense to me. the error accure when I try to delete the subscription in the OPC-UA client and relunch subscriptions in a function node (you can see the the picture attached). I run this function at the beginning of each shift and that's the reason why the server crashes. I added a delay function of one second and still got the Node-red server to crash. weirdly when I use the "action: deletesubscription" in a function alone it works fine !!! hopefully it can help : [image: OPCUA-Subscribe function] https://user-images.githubusercontent.com/79022731/173159585-480ceddb-516f-46d2-ae32-f3aab5e0ea72.JPG )

— Reply to this email directly, view it on GitHub https://github.com/mikakaraila/node-red-contrib-opcua/issues/441#issuecomment-1152784027, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHRYDHKCYKO3YREKOAVLZDVOPAIVANCNFSM5YDULKPQ . You are receiving this because you were mentioned.Message ID: @.***>