How to reset a MSSQL node from an error state

Hello,
I have a problem with MSSQL nodes.
When I can't connect to a database through an MSSQL node, after the timeout, the node goes into an "Failed to connect to ... in 15000 ms" error state.
At the next attempt, triggered by the inject node, the MSSQL node does not try to reconnect but remains in the error state. How can you reset the MSSQL node to be "clean" and try running the query the next instant programmed by the inject node?
Thanks for the replies.

I use node-red-contrib-mssql-plus & can say from experience (and also cos I am one of the maintainers of that node) that is not the behaviour I see.

Which mssql node are you using? Perhaps you could try using node-red-contrib-mssql-plus instead? (Assuming you're using something else)

Actually I am using node-red-contrib-mssql-plus.
After this first attempt to connect:
image

At the next attempt, triggered by the inject node, the MSSQL node does not try to reconnect (it does not appear "requesting") but remains in the error state (like in previous figure).

I hope the problem is clearer now.

If you restart node red but don't do anything else, does it connect?

If I deploy, it connects. But I don't want to deploy to "reset" node.

Why is it failing to connect? Are there any messages in the log? If you start node-red in a terminal you should see the log.

I created the error voluntarily. I want that when the internet connection (or the virtual network where the DB is located) resumes, he tries to connect again, and he is not mistaken.

I want:
Minute 0: Failed to connect because of connections problem
Minute 5: New attempt to connect (requesting)
...ecc.

But i have:
Minute 0: Failed to connect because of connections problem
Minute 5: State of previous fail (despite the connection problems are solved because if I deploy, all is OK)
...ecc.

Do you mean that if you interrupt the network connection then re-make it that it fails to reconnect?
If so then probably posting an issue on the node's github page might be the best plan.

I'll have to look at source code again but as far as I remember, I've never had this issue. Then again most errors I've tested or witnessed haven't been 1st attempt connection fail (usually I've made connection first then sent bad data followed by good)

It may be the connection is made on deploy/startup only. Hmmm.

Can you test....

  1. Good connection
  2. Query DB (should be ok)
  3. Pull plug to DB(block connection/drop internet)
  4. Query DB (will fail)
  5. Restore DB connection
  6. Query DB (what happens?)

Cheers

I have refreshed my memory on the src...

the connect() operation is performed on each query (though it uses a pool so doesnt always re-connect) so it should connect on your next query.

Not certain what the issue is TBH.

If you can give me precise instruction on how this situation can be repeated (reliably) I will debug it.

You may need to provide me connection details and a temporary non-admin account (be sure to PM not post on here) where I can try to re-create the issue.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.