Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConnectionTimeoutMillis is not respected and pool.connect hangs indefinitely #3197

Open
mikewang333 opened this issue Apr 17, 2024 · 0 comments

Comments

@mikewang333
Copy link

mikewang333 commented Apr 17, 2024

Hi, I work on a product that allows users to connect to their own postgres instance and write queries.

I noticed for hostnames related to incorta, if the configuration isn't set up properly the connectionTimeoutMillis isn't respected and the event loop is blocked at pool.connect.

Example repro with a sample incorta postgres instance (I'm using a free trial instance so it might expire soon. It's pretty easy to spin up another one though on their site).

const { Pool } = require('pg');

const executeQuery = async () => {
  const pool = new Pool({ host: 'incorta-5668.sqli.cloud13.incorta.com', port: 3482, connectionTimeoutMillis: 1000});
  pool.on('error', (err) => {
    console.error('Unexpected error on idle client', err);
    process.exit(-1);
  });

  // STUCK AT THIS LINE
  const client = await pool.connect();

  client.release();
  await pool.end();
};

executeQuery();

Would be great if this could timeout after the configured connectionTimeoutMillis like it would with other misconfigured postgres instances.

We're using pg version 8.11.3 currently. Thank you! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant