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

There is a bug in pool when connection cannot be established at pool start #478

Open
langpavel opened this issue Apr 20, 2024 · 3 comments

Comments

@langpavel
Copy link
Contributor

langpavel commented Apr 20, 2024

Describe the bug

There is a bug in pool when connection cannot be established at pool start.
This bug will bite when you wish close the connection

To Reproduce

Steps to reproduce the behavior:

  1. Start your deno server
  2. Start your pool
  3. Try to connect
  4. Exception happen (good)
  5. Start database
  6. Try to connect
  7. Do insert (OK, commited)
  8. Release pool client, then
    8.5. Exception happens.
  9. but query succeeds

Expected behavior

No exception

This bug is not observed when database connection is ready at start

@langpavel
Copy link
Contributor Author

I think this is somewhere in DeferredAccessStack, but I have no proof, except this:

deno-server-1           | Insert successful
deno-server-1           | ERROR ConnectionRefused: Connection refused (os error 111)
deno-server-1           |     at async Object.connect (ext:deno_net/01_net.js:587:55)
deno-server-1           |     at async Connection.#openConnection (https://deno.land/x/[email protected]/connection/connection.ts:266:18)
deno-server-1           |     at async Connection.#startup (https://deno.land/x/[email protected]/connection/connection.ts:342:7)
deno-server-1           |     at async Connection.startup (https://deno.land/x/[email protected]/connection/connection.ts:494:11)
deno-server-1           |     at async PoolClient.connect (https://deno.land/x/[email protected]/client.ts:233:7)
deno-server-1           |     at async DeferredAccessStack.pop (https://deno.land/x/[email protected]/utils/deferred.ts:115:7)
deno-server-1           |     at async _custom_ (file:///home/deno/fake-device/_custom_.ts:51:26)
deno-server-1           |     at async Promise.all (index 2)
deno-server-1           |     at async file:///home/deno/main.ts:17:3 {
deno-server-1           |   name: "ConnectionRefused",
deno-server-1           |   code: "ECONNREFUSED"
deno-server-1           | }

@langpavel
Copy link
Contributor Author

This will only happen when deno service is starterd before postgres.

@langpavel
Copy link
Contributor Author

Don't know if related, but I'm using lazy mode.

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