MagicStack / MagicStack/asyncpg

Special character in password raise timeout exception

オープン
#894 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
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

```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. 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

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。