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

Bad connection not being released from pool #6041

Open
akg1 opened this issue Mar 22, 2024 · 0 comments
Open

Bad connection not being released from pool #6041

akg1 opened this issue Mar 22, 2024 · 0 comments

Comments

@akg1
Copy link
Contributor

akg1 commented Mar 22, 2024

Environment

Knex version: ^3.1.0
Database + version: AWS RDS PostgreSQL 16.2
OS: 20.11-alpine container

Select applicable template from below.
If issue is about oracledb support, tag @ atiertant. For MSSql tag @ smorey2.
Rest of dialects don't need tags.
If issue is about TypeScript definitions, tag @ lorefnon.

Bug

  1. Explain what kind of behaviour you are getting and how you think it should do

This is a bit complicated to debug, but as far as I can tell, we're see an issue where we get a server conn crashed from PgBouncer, and subsequently, queries on our containers start failing with: Client has encountered a connection error and is not queryable. My best guess is that the connection is remaining in the pool. I don't know how to debug this further though.

  1. Error message

Initial error:

error: /* query text here */ - server conn crashed?
    at Object.queryBuilder (/app/node_modules/knex/lib/knex-builder/make-knex.js:112:26)
    at Function.value (/app/node_modules/knex/lib/knex-builder/make-knex.js:92:29)
    at Function.withSchema (/app/node_modules/knex/lib/knex-builder/make-knex.js:270:28)
    at DbEntityGateway.shardQueryBuilderHelper (/app/packages/api/src/data/DbEntityGateway.ts:1067:26)
    at ctx (/app/packages/api/src/data/DbEntityGateway.ts:1363:12)
    at /app/packages/api/src/data/implementations/GroupsImpl.ts:1907:21
    at /app/node_modules/p-limit/index.js:23:31
    at run (/app/node_modules/p-limit/index.js:23:43)
    at /app/node_modules/p-limit/index.js:45:2"

Subsequent errors:

Client has encountered a connection error and is not queryable (no real stack)

  1. Reduced test code, for example in https://npm.runkit.com/knex or if it needs real
    database connection to MySQL or PostgreSQL, then single file example which initializes
    needed data and demonstrates the problem.
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