You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling aiopg.createPool() a 2nd time if first failed results in: RuntimeError: unable to perform operation on <UVPoll closed=True 0x105fd4270>; the handler is closed
#909
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.
If aiopg.create_pool() fails because the PostgreSQL server is down it gives a psycopg2.OperationalError "Error connecting to database: Connection refused"
If you subsequently want to retry and call aiopg.create_pool() a second time it results in a "RuntimeError: unable to perform operation on <UVPoll closed=True 0x1046082e0>; the handler is closed" error.
To Reproduce
make sure your database server is down, or just point DSN to an IP that has no database server for testing purposes
use code among the lines of:
db_pool=Falsedsn="dbname=mydb user=myuser password=mypassword host=127.0.0.1"asyncdefinit():
globaldb_poolwhileTrue:
try:
db_pool=awaitaiopg.create_pool(dsn, maxsize=4, timeout=10, pool_recycle=300)
breakexceptpsycopg2.OperationalErrorasex:
print("Error connecting to database: %s"%ex)
print("Trying again in 5 seconds...")
awaitasyncio.sleep(5)
Expected behavior
Expect it to retry connecting to the database server.
Logs/tracebacks
File "MYFILE.py", line 93, in init
db_pool =await aiopg.create_pool(dsn, maxsize=4, timeout=10, pool_recycle=300)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.12/site-packages/aiopg/pool.py", line 300, in from_pool_fillawaitself._fill_free_pool(False)
File "/opt/homebrew/lib/python3.12/site-packages/aiopg/pool.py", line 336, in _fill_free_pool
conn =await connect(
^^^^^^^^
File "/opt/homebrew/lib/python3.12/site-packages/aiopg/connection.py", line 65, in connect
connection = Connection(
^^^^^^^^^^^
File "/opt/homebrew/lib/python3.12/site-packages/aiopg/connection.py", line 772, in __init__self._loop.add_reader(
File "uvloop/loop.pyx", line 2441, in uvloop.loop.Loop.add_reader
File "uvloop/loop.pyx", line 780, in uvloop.loop.Loop._add_reader
File "uvloop/handles/poll.pyx", line 104, in uvloop.loop.UVPoll.start_reading
File "uvloop/handles/poll.pyx", line 39, in uvloop.loop.UVPoll._poll_start
File "uvloop/handles/handle.pyx", line 159, in uvloop.loop.UVHandle._ensure_aliveRuntimeError: unable to perform operation on <UVPoll closed=True 0x1046082e0>; the handler is closed
Python Version
Python 3.12.4
aiopg Version
Version: 1.4.0
OS
macOS
Additional context
No response
Code of Conduct
I agree to follow the aio-libs Code of Conduct
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
If aiopg.create_pool() fails because the PostgreSQL server is down it gives a psycopg2.OperationalError "Error connecting to database: Connection refused"
If you subsequently want to retry and call aiopg.create_pool() a second time it results in a "RuntimeError: unable to perform operation on <UVPoll closed=True 0x1046082e0>; the handler is closed" error.
To Reproduce
Expected behavior
Expect it to retry connecting to the database server.
Logs/tracebacks
Python Version
Python 3.12.4
aiopg Version
Version: 1.4.0
OS
macOS
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: