I’m using an n8n workflow that includes an MSSQL node to insert data, and the workflow runs every 10 seconds. However, my MSSQL server is experiencing issues with too many open sessions. I couldn’t find any connection pooling settings in the Credentials section. Could you help me figure out how to resolve this issue?
What is the error message (if any)?
There are no error messages in n8n, but it is impacting my warehouse database. Other programs are unable to access the warehouse because all available connections are being used by n8n.
You might want to try a more recent version of n8n.
If I remember correctly they fixed this issue with Postgres. Now the connections shouldn’t accumulate.
But I don’t know about MSSQL. Might have been fixed too.
I could find the information about Postgres, though:
We are having a similar issue with MySQL, we just upgraded to n8n latest version, and the issue is still there. Monitoring the DB connection, we get over 190 open connections, that don’t get returned to the pool, so new connection face connect ETIMEDOUT.
Do you know if the MySQL driver usage has been fixed too, if if we need any additional steps to ensure the connections are freed?
DECLARE @spid INT
DECLARE orphaned CURSOR FOR
SELECT session_id
FROM sys.dm_exec_sessions
WHERE
is_user_process = 1 AND
status = 'sleeping'
AND program_name = 'node-mssql'
AND DATEDIFF(SECOND, last_request_end_time, GETDATE()) > 30;
OPEN orphaned
FETCH NEXT FROM orphaned INTO @spid
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC('KILL ' + @spid);
FETCH NEXT FROM orphaned INTO @spid
END
CLOSE orphaned
DEALLOCATE orphaned;
as a work around … schedule the above as a SPROC to run every n number of min/hours. Ensure your setting on the servers properties in SSMS are like this