MagicStack / MagicStack/asyncpg
TimeoutError when connecting to server
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.20.1, 0.19.0, 0.18.3, 0.17.0, 0.16.0
- PostgreSQL version: 10.6
- Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?: No SaaS - Python version: 3.7.3
- Platform: MacOs 10.15.4 / Alpine Linux
- Do you use pgbouncer?: No
- Did you install asyncpg with pip?: Tried both: pip and build from source
- If you built asyncpg locally, which version of Cython did you use?: 0.29.14 for 0.20.1
- Can the issue be reproduced under both asyncio and
uvloop?: Yes, both with and without uvloop
Hi! I ran into a very strange behaviour of asyncpg. I can connect to a server with Postgresql 10.6 via psql, psycopg2, aoipg, but not asyncpg. The code is very simple:
async def main():
print('start')
c = await connect('postgresql://someuser:somepwd@somehost:5433/somedb')
print('finish')
import asyncio
asyncio.run(main())
and get exception:
File ".../tst_asyncpg.py", line 12, in <module>
asyncio.run(main())
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "uvloop/loop.pyx", line 1456, in uvloop.loop.Loop.run_until_complete
File ".../ceres/tst_asyncpg.py", line 7, in main
c = await connect('<some dsn>')
File ".../venv/lib/python3.7/site-packages/asyncpg/connection.py", line 1677, in connect
max_cacheable_statement_size=max_cacheable_statement_size)
File ".../venv/lib/python3.7/site-packages/asyncpg/connect_utils.py", line 663, in _connect
raise last_error
File ".../venv/lib/python3.7/site-packages/asyncpg/connect_utils.py", line 655, in _connect
connection_class=connection_class)
File ".../venv/lib/python3.7/site-packages/asyncpg/connect_utils.py", line 631, in _connect_addr
await asyncio.wait_for(connected, timeout=timeout)
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/tasks.py", line 423, in wait_for
raise futures.TimeoutError()
concurrent.futures._base.TimeoutError
This exception is raised after 60 seconds. I tired different versions of asyncpg, and the behaviour does not change. Right now i'm building library from source in hope to get some additional debug info. I'm nearly sure, that it is not a network issue (other libraries / utilities go well).
I checked logs on postgresql, and have a 'canceling authentication due to timeout' for every connection attempt. By the way, i have another instance of postgresql on a server (different port), and it works well.
I will appreciate any advice, how to debug this problem. Thanks.
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
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với điểm vào kết nối trong connection.py và luồng timeout trong connect_utils.py, đặc biệt là _connect và _connect_addr. So sánh lần thử kết nối asyncpg bị lỗi với mục log PostgreSQL cho thấy việc hủy xác thực, đồng thời xem xét hành vi được báo cáo trên các phiên bản và môi trường asyncpg được liệt kê. Được xem là hoàn tất khi xác định được nguyên nhân có thể tái hiện hoặc chẩn đoán rõ ràng, có thể hành động.
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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 20/100