Skip to content

Special character in password raise timeout exception #894

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
demaet opened this issue Mar 2, 2022 · 1 comment
Open

Special character in password raise timeout exception #894

demaet opened this issue Mar 2, 2022 · 1 comment

Comments

@demaet
Copy link

demaet commented Mar 2, 2022

  • asyncpg version: 0.25.0
  • PostgreSQL version: 10.6
  • Do you use a PostgreSQL SaaS?: no
  • Python version: 3.6.12
  • Platform: UNIX
  • Do you use pgbouncer?: no
  • Did you install asyncpg with pip?: yes

It seems that introduction of some special characters (here the ²) in password breaks the code: it hangs until connection timeout is reached. Even if the password/user/db are wrong. A wrong hostname (eg unavailable or without a responding 5432 port) raise an exception.

test:
conn = await asyncpg.connect(f'postgres://a@{host}/b', password='abc²def', timeout=10)

Traceback (most recent call last):
  File "./....py", line 152, in <module>
    loop.run_until_complete(a())
  File "/usr/lib64/python3.6/asyncio/base_events.py", line 488, in run_until_complete
    return future.result()
  File "./...py", line 134, in a
    conn = await asyncpg.connect(f'postgres://a@{host}/b', password='abc²def', timeout=10)
  File "~/.local/lib/python3.6/site-packages/asyncpg/connection.py", line 2102, in connect
    max_cacheable_statement_size=max_cacheable_statement_size,
  File "~/.local/lib/python3.6/site-packages/asyncpg/connect_utils.py", line 895, in _connect
    raise last_error
  File "~/.local/lib/python3.6/site-packages/asyncpg/connect_utils.py", line 888, in _connect
    record_class=record_class,
  File "~/.local/lib/python3.6/site-packages/asyncpg/connect_utils.py", line 781, in _connect_addr
    return await __connect_addr(params, timeout, True, *args)
  File "~/.local/lib/python3.6/site-packages/asyncpg/connect_utils.py", line 831, in __connect_addr
    await compat.wait_for(connected, timeout=timeout)
  File "~/.local/lib/python3.6/site-packages/asyncpg/compat.py", line 66, in wait_for
    return await asyncio.wait_for(fut, timeout)
  File "/usr/lib64/python3.6/asyncio/tasks.py", line 362, in wait_for
    raise futures.TimeoutError()
concurrent.futures._base.TimeoutError

@elprans
Copy link
Member

elprans commented Mar 25, 2022

This should be fixed by #862.

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