]> git.ipfire.org Git - thirdparty/psycopg.git/commit
fix(pool): check that there is some connection in the pool before shrinking
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 21 Feb 2025 16:27:29 +0000 (17:27 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Fri, 21 Feb 2025 18:05:53 +0000 (19:05 +0100)
commitfcf843112c608d4ec398624ecd597daf7a69cf41
tree79407f881a881c0e7ee129bde286f85d4d930036
parenta97f73c56a17914211cb34911c1c01ac881ca52b
fix(pool): check that there is some connection in the pool before shrinking

There is a race condition between shrinking the pool and closing an
expired connection which might result in attempting to pop from the
empty _pool deque. Add a check to prevent that.

The bug is not serious as it doesn't compromise the pool working but it causes
noise in the logging.

Close #1001
docs/news_pool.rst
psycopg_pool/psycopg_pool/pool.py
psycopg_pool/psycopg_pool/pool_async.py