Idle connections not being closed by the pool
See original GitHub issueBased on the docs quick example, I am trying to run a simple query as follows:
const sql = require('mssql')
(async () => {
try {
const pool = await sql.connect('mssql://username:password@localhost/database')
const result = await sql.query`select * from mytable where id = ${value}`
console.dir(result)
} catch (err) {
// ... error checks
}
})();
After logging the results, the process remains stucked until I press CTRL+C.
The problem is happening in the await sql.query
part - it is returning a promise that seems to resolve, so I cannot figure out what is happening and why the process do not finish and keeps waiting for something.
Node 7.9.0 node-mssql 4.0.2
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:36
Top Results From Across the Web
Why are my database pool connections not being released ...
This would indicate that idle pool connections should be released after ten minutes. Checks are made not less than ten minutes apart to...
Read more >jdbc - Idle connections are not closed - Stack Overflow
I deploy Keycloak server app (based on WildFly 10.0.0.Final) to Pivotal Cloud Foundry and use ClearDB service as relational database.
Read more >Idle connections are not closed - JBoss.org
Hi all,. I deploy Keycloak server app (based on WildFly 10.0.0.Final) to Cloud Foundry and use ClearDB service as relational database.
Read more >JMS Connection Settings/Information and how to debug ...
Resolution · the connection has been idle for too long (controlled by io.jmsConnectionCacheMaxIdleTime cluster property) 5 minutes · the ...
Read more >How to deal with closed connections in database pool
When a connection is detected as not being used for such time, the connection is automatically closed at the server side, causing mule...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have the same problem with the 4.10 version. I am using the connection pool when triggering a good amount of async queries. And after I return the results from the db, I explicitly close the connection pool but still the connections used remain active and the MSSQL server shows all the unclosed connection. For a heavy use, this makes the Db server to reach the max available connections and the Node.JS server can not connect anymore .
Is there any fix I can use?
Fixed in 4.0.4. Anyway, the fix doesn’t close the process when all connections are closed. You need to explicitly call
pool.close()
.