There are any number of things that might be the cause of that.
The node has a fault - you need to contact the node's author
You are running a proc that takes >1.5sec - again, ask the author of the node if the timeout can be altered
You have other things running against the database that is sometimes causing it to slow down
You have an intermittent network issue
There are probably others as well. If you have access to the sql server, monitor it to see if it is struggling. Also monitor the device running Node-RED to see if it is getting performance hits from time to time.
Since it works most of the time & your problem is intermittent, your issue is likely external & could be one of a few things...
It could be you are returning a lot of data and sometimes it take a little bit longer.
Question: How much data (count of rows) does this procedure return?
If could be contention / locks on the table(s).
Question: what is this stored procedure doing? Is it reading / writing to a table that maight be read / written by another application or process?
Have the table(s) got good indexes? Perhaps there is a JOIN or WHERE clause in the stored procedure that are slow to return results due to lack of good indexes?
Have you ran these queries that the stored procedure runs through query analyser / profiler?
Does the SQL server do other tasks? Perhaps the CPU is occasionally 100% causing slow queries?
Timeout can be editable. But I have 15000 ms (15 sec). Stored Procedure returning result in less than 2 or 3 seconds and It returns 1 row and 3 column.
3.I don't think so.. with other things running against the database because I am getting timeout error with same stored procedure.
Both database and node red installed in same system, so network may not be a issue.
Q1:
My stored procedure returning 1 row and 3 columns.
Q2:
It is simply getting row count of one table and returning as a result.
We are not using JOIN on any tables.
SQL query look like...
SELECT COUNT([ID]) FROM [sampleDB].[dbo].[sampleTable] WHERE [AssetID] = @AID AND [Status] = '1'
I've had this happen a few times. What is the max pool size in your MSSQL config? Ours ended up set to 1 at some point, and I'd get that error whenever two queries occur at the same time. I bumped it to 5 and the issue went away.
I am thinking that if
[sampleDB].[dbo].[sampleTable] having less than 20 rows.
and
Stored Procedure returning result in less than 2 or 3 seconds and It returns 1 row and 3 column.
There is something not quite right. We have a similar./lower spec SQL server (12 Core/6gb ram) on our network, and can easily run far more complicated queries that amount of time. Sounds like the server is being hammered, or has a config issue.
Other things to try:
Bump the timeout to 60s say, just to see if the query ever does return.
Change it to a query directly in the SQL node, rather than a stored procedure.
Run the query a bunch of times in MSSQL Management Studio, see if it ever happens there.
I think, we are getting this error calling that particular Stored Procedure in high frequency. Anyway we tried to increase the "Max Pool Size" to 10. Still we are getting the same timeout error.
The connection should never take more than a second I don't believe. I would reduce the connect timeout down to 1 second (1000). It is better to see connection errors sooner.