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.

exhausting the pool

See original GitHub issue

Hi Brian

To continue our brief communication, here is a code that demonstrates the problem.

The following will exhaust the pool and only two queries will ever be executed (instead of 4), is this normal? am I missing something here?

var pg = require('pg')

var connectionString = 'your connection string here'

pg.defaults.poolSize = 2

var executedCount = 0

function query() {
    pg.connect(connectionString, function (err, conn, done) {
        conn.query('select 1+1', function (err, results) {
            console.log(++executedCount)
            done(1) //destroy the connection
        })
    })
}

console.log('dont let the process exit after two queries')
setTimeout(function() {
    console.log('timed out')
}, 10000)

query()
query()
query()
query()

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
charmandercommented, Jan 3, 2018

Fixed in pg 7.

0reactions
FlamingTempuracommented, Apr 23, 2015

Also just had this problem - @kessler 's suggestion solved it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'Pool Fatigue' Has Nothing to Do with Overswimming
One of the biggest reasons people call Eagle Pools to arrange for ... And after a while, keeping up with all that work...
Read more >
6 Reasons Swimming Makes You Tired (& What To Do About It)
Some possible reasons for feeling tired after swimming include the physiological effect of the water temperature on your body, the strenuous nature of...
Read more >
How to Protect Connection Pool from Being Exhausted
How can one protect the JDBC connection pool from being exhausted? Solution. Sign In. To view full details, sign in with your My...
Read more >
Water Services Draining and Backwashing Your Pool
When you need to backwash your pool filter or drain the pool, reuse the water to irrigate landscaping. Do not drain water into...
Read more >
Thinking of Draining Your Swimming Pool? Read This First!
The most sensible and economical way of lowering the CyA is by draining the pool partially and pumping in fresh water.
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