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

Can't create pool on MacOS #912

Open
1 task done
sxkxixx opened this issue Nov 8, 2024 · 0 comments
Open
1 task done

Can't create pool on MacOS #912

sxkxixx opened this issue Nov 8, 2024 · 0 comments
Labels

Comments

@sxkxixx
Copy link

sxkxixx commented Nov 8, 2024

Describe the bug

Using version aiopg="1.4.0", I can not execute example code from README.md.

import asyncio
import aiopg

dsn = 'dbname=... user=... password=... host=... port=...'


async def go():
    async with aiopg.create_pool(dsn) as pool:
        async with pool.acquire() as conn:
            async with conn.cursor() as cur:
                await cur.execute("SELECT 1")
                ret = []
                async for row in cur:
                    ret.append(row)
                assert ret == [(1,)]


loop = asyncio.get_event_loop()
loop.run_until_complete(go())

To Reproduce

  1. Copy example code from README.md
  2. Run postgresql in Docker container
  3. Run example code

Expected behavior

Pool successfully creates and sql query executes

Logs/tracebacks

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/tasks.py", line 490, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/.../PycharmProjects/sandbox/main.py", line 20, in <module>
    loop.run_until_complete(go())
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/.../PycharmProjects/sandbox/main.py", line 9, in go
    async with aiopg.create_pool(dsn) as pool:
  File "/Users/.../Library/Caches/pypoetry/virtualenvs/sandbox-N2CgpaeM-py3.11/lib/python3.11/site-packages/aiopg/utils.py", line 82, in __aenter__
    self._obj = await self._coro
                ^^^^^^^^^^^^^^^^
  File "/Users/.../Library/Caches/pypoetry/virtualenvs/sandbox-N2CgpaeM-py3.11/lib/python3.11/site-packages/aiopg/pool.py", line 300, in from_pool_fill
    await self._fill_free_pool(False)
  File "/Users/.../Library/Caches/pypoetry/virtualenvs/sandbox-N2CgpaeM-py3.11/lib/python3.11/site-packages/aiopg/pool.py", line 336, in _fill_free_pool
    conn = await connect(
           ^^^^^^^^^^^^^^
  File "/Users/.../Library/Caches/pypoetry/virtualenvs/sandbox-N2CgpaeM-py3.11/lib/python3.11/site-packages/aiopg/connection.py", line 1225, in _connect
    await self._poll(self._waiter, self._timeout)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/.../Library/Caches/pypoetry/virtualenvs/sandbox-N2CgpaeM-py3.11/lib/python3.11/site-packages/aiopg/connection.py", line 884, in _poll
    raise exc
  File "/Users/.../Library/Caches/pypoetry/virtualenvs/sandbox-N2CgpaeM-py3.11/lib/python3.11/site-packages/aiopg/connection.py", line 881, in _poll
    await asyncio.wait_for(self._waiter, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/tasks.py", line 492, in wait_for
    raise exceptions.TimeoutError() from exc
TimeoutError

Python Version

$ python --version
Python 3.11.4

aiopg Version

$ python -m pip show aiopg
1.4.0

OS

MacOS Apple M3 Pro Sonoma 14.6.1

Additional context

  • Docker version 27.3.1
  • Postgres docker image version - postgres:14

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@sxkxixx sxkxixx added the bug label Nov 8, 2024
@sxkxixx sxkxixx changed the title Cannot create pool on MacOS Can't create pool on MacOS Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant