Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add pool_timeout parameter to prevent pool operation hangs (#431) #1273

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

Open
ermakov-oleg wants to merge 1 commit into MagicStack:master
base: master
Choose a base branch
Loading
from ermakov-oleg:pool-timeout

Conversation

Copy link
Contributor

@ermakov-oleg ermakov-oleg commented Sep 23, 2025

Summary

Adds pool_timeout parameter to Pool and create_pool() to prevent indefinite hangs in pool operations.

Problem

Pool operations could hang indefinitely, particularly during connection cleanup and cancellation (issue #431).

Solution

pool = await asyncpg.create_pool(dsn, pool_timeout=5.0)
# Now safe to call without explicit timeouts
result = await pool.fetch("SELECT 1")
conn = await pool.acquire() # Uses pool_timeout as fallback

Changes

  • Added pool_timeout parameter with validation (must be > 0 or None)
  • Fallback logic: explicit timeout → pool_timeout → infinite wait
  • Pool convenience methods (fetch, execute, etc.) now respect pool_timeout
  • Full backward compatibility maintained

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /