Error [ERR_STREAM_DESTROYED]

I get the following error occasionally which I need to trap and issue something like “sudo systemctl restart nodered” to restart node-red automatically. Please share if you know how!!

Error connecting to dbus: Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed

Thanks

Dave

Hi.

Can i assume node-red is being crashed and the error in the log is ERR_STREAM_DESTROYED?

If so, you should identify the node causing this and report that as an issue on the nodes repository (in short, something is possibly not handing errors correctly & can probably be fixed to not crash node-red)

As for restarting node-red service - surely you just need to setup auto restart?

Steve

Yes, that is correct. I have identified the node where it is caused but getting no response from an earlier issue. As a VERY new user to this sort of thing (node-red is the limit of any "programming" I have done) the auto restart is the sort of thing I need but not sure how to add it to node-red.

cheers

Dave

What is the full name of this node?

If node-red is crashing, it cannot restart itself.
However if you mean you are trying to get node-red to setup auto restart, then you wouldn't do that either. It is systemctl itself that takes care of auto restarting a failed service.
Re-read that link I provided in my first response or search the internet for "systemctl auto restart failed service"

What OS are you running and how did you install node red?

the node is @victronenergy/node-red-contrib-victron.

i'm not sure if it is node red crashing or just stopping as the erroer i get is just displayed as "Error connecting to dbus: Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed". What i am trying to replicate is the manual action of typing node-red-stop and node-red-start in a terminal window when it happens, a big issue being I dont know it has happened until i look

thanks

dave

Colin, it is running rasbian on a Pi and i installed the node through manage palette option

Seems the developers are aware of this issue. Seems to me they are not so interested in fixing it as they dont see this problem on thier own OS! I would (if I were you) post a follow up reply in that issue stating you too are having the issue - just to let the developer know the issue still exists & is probably affecting more people than they realise (they may not be aware of how common this is as people tend not to bother reporting issues and generate workarounds - much like yourself)

In the mean time, there are several threads on this forum related to restarting node-red
this one MIGHT work for you (it restarts your flows via the API - import the last flow under "solution 2" in that link)