Skip to content

issue with connection pooling when using QueuePool (via sqlalchemy) #1123

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

Closed
akhilputhiry opened this issue Feb 29, 2024 · 2 comments
Closed

Comments

@akhilputhiry
Copy link

  • asyncpg version: 0.29.0
  • PostgreSQL version: 16.2
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    : Both with AWS RDS and Local Installation
  • Python version: 3.12.1
  • Platform: aarch64-apple-darwin23.2.0
  • Do you use pgbouncer?:
  • Did you install asyncpg with pip?: poetry
  • If you built asyncpg locally, which version of Cython did you use?: NA
  • Can the issue be reproduced under both asyncio and
    uvloop?
    : Didnt Try

We have a web app using sqlalchemy. If we use NullPool (disable connection pooling) everything works fine. The moment we enable QueuePool the app gets stuck

time=2024-02-29 14:48:01,669 level=INFO request-id=b1de3f74dac04a9799934a671cf9e0d6 user-id=2319885380 message=Permission datalake/roles/user granted for user 2319885380
time=2024-02-29 14:48:01,669 level=INFO request-id=b1de3f74dac04a9799934a671cf9e0d6 user-id=2319885380 message=creating database session
time=2024-02-29 14:48:01,669 level=INFO request-id=b1de3f74dac04a9799934a671cf9e0d6 user-id=2319885380 message=database session created successfully
time=2024-02-29 14:48:01,669 level=INFO request-id=b1de3f74dac04a9799934a671cf9e0d6 user-id=2319885380 message=Fetching datalake environment
2024-02-29 14:48:01,677 DEBUG sqlalchemy.pool.impl.QueuePool Created new connection <AdaptedConnection <asyncpg.connection.Connection object at 0x114136300>>
2024-02-29 14:48:01,680 DEBUG sqlalchemy.pool.impl.QueuePool Created new connection <AdaptedConnection <asyncpg.connection.Connection object at 0x1141365d0>>

[2024-02-29 14:52:27 +0530] [61517] [CRITICAL] WORKER TIMEOUT (pid:61518)
[2024-02-29 14:52:27 +0530] [61517] [ERROR] Worker (pid:61518) was sent SIGABRT!
[2024-02-29 14:52:27 +0530] [62957] [INFO] Booting worker with pid: 62957
[2024-02-29 14:52:42 +0530] [62957] [INFO] Started server process [62957]
[2024-02-29 14:52:42 +0530] [62957] [INFO] Waiting for application startup.
@elprans
Copy link
Member

elprans commented Feb 29, 2024

Should this be an SQLAlchemy bug instead?

@akhilputhiry
Copy link
Author

Looks we misconfigured the sqlalchemy to use QueuePool instead of AsyncAdaptedQueuePool which was causing the issue

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

2 participants