MagicStack / MagicStack/asyncpg
Special character in password raise timeout exception
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 8.1k
- 派生
- 468
- PR 合并指标
- 30 天内没有已合并 PR
描述
* **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
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
```
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
Start with the asyncpg.connect entry point and the connection flow shown in asyncpg/connect_utils.py, including compat.py. Reproduce the password case with the provided PostgreSQL and Python versions, compare it with invalid credentials and an unavailable host, and verify that the special-character case reports the connection or authentication result instead of timing out unexpectedly.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- postgresql, python
- 领域
- databases
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100