question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pool execute won't release connection

See original GitHub issue

I have setup a pool like this:

pool = mysql.createPool({
  //host, port,etc...
  waitForConnections: false,
  queueLimit: 1,
  debug: false,
  namedPlaceholders: true,
  supportBigNumbers: true
});

I then try to run queries with pool.execute, which I assume should close connections automatically as query does according to docs:

pool.query(function(err, conn) {
   conn.query(/* ... */);
   // Connection is automatically released when query resolves
})

However, it seems that the connections are left in sleep state (visible from information_schema.processlist) and once the connection limit (default 10) is reached, my code stops and waits until the database hits it’s timeout (100 seconds) and kills the dangling connections, then again the next 10 queries run and so on…

Am I missing something? The database is MariaDB 10.2.16

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
sidorarescommented, Aug 23, 2018

looks like code in readme is incorrect, I’ll fix that

2reactions
PolymathWhizcommented, Aug 23, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Connection.release() does not ... - Stack Overflow
Connection.release doesnt release the connection back to the pool, which is causing the memory leak and the program gets crashed. let connection ...
Read more >
Pooled Connections Not Releasing - JBoss.org
I am using JNDI lookups to get my database connections from MySQL in the following manner: InitialContext initialContext = new ...
Read more >
Common Reasons Why Connections Stay Open for a Long ...
When you are monitoring connection pool performance, you may occasionally notice that connections are staying open for long periods of time.
Read more >
What is connection pooling, and why should you care
Pooling connections can help, so here's what connection pooling is and ... for an available connection to open up before they can execute....
Read more >
A.15 MySQL 8.0 FAQ: MySQL Enterprise Thread Pool
By contrast, the Thread Pool operates on the MySQL server side and is designed to manage the execution of inbound concurrent connections and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found