MagicStack / MagicStack/asyncpg

Special character in password raise timeout exception

Đang mở
#894 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
8.1k
Fork
468
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

* **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

```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
postgresql, python
Lĩnh vực
databases
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.