uvloop closes underlying sockets that were established outside upon end of asyncio.run()
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 45/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- python
- 領域
- backend, networking
研究方向
首先執行提供的 Unix-socket reproducer,並將 uvloop 與一般的 asyncio 迴圈進行比較。追蹤 asyncio.open_unix_connection() 和 asyncio.run() 周圍的 socket 所有權及關閉生命週期;當外部建立的 socket 在 asyncio.run() 之後仍可使用,且該回歸由測試涵蓋時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
This seem to be version/OS unrelated. Sample:
import asyncio
import socket
import uvloop
b = bytes('{"msg": "test"}', 'utf-8')
async def main_async(sock: socket.socket):
_, writer = await asyncio.open_unix_connection(sock=sock)
writer.write(b)
await writer.drain()
if __name__ == '__main__':
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect('data/sockets/echo_server.sock')
sock.sendall(b)
uvloop.install()
asyncio.run(main_async(sock)) # sock gets wrongly closed on asyncio.run() termination
sock.sendall(b) # Exception here OSError: [Errno 9] Bad file descriptor
Last line result in exception "OSError: [Errno 9] Bad file descriptor" because sock gets closed right after asyncio.run() terminates. It is wrong behavior, because sock was created outside of asyncio loop and has to be left untouched. The issue doesn't occur using regular asyncio loop.
- 主要語言
- Cython
- 星號
- 11.9k
- 分支
- 615
- PR 合併指標
- 30 天內沒有已合併 PR
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
MagicStack/uvloop 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 68/100
MagicStack/uvloop#759 ·
-
難度 2/5 1-3 小時 新手友好度 68/100
MagicStack/uvloop#741 · 2 個 reaction ·
-
難度 2/5 1-3 小時 新手友好度 68/100
MagicStack/uvloop#702 · 8 則留言 · 9 個 reaction ·
-
難度 4/5 3-5 天 新手友好度 25/100
MagicStack/uvloop#766 ·
-
難度 4/5 3-5 天 新手友好度 52/100
MagicStack/uvloop#765 ·
查看 MagicStack/uvloop 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 75/100
mksglu/context-mode#1200 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
-
難度 2/5 1-3 小時 新手友好度 70/100
-
clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr impact:auth-provider issue-rating: 🌊 off-meta tidepool P2
難度 1/5 1 小時以內 新手友好度 80/100
-
難度 2/5 1-3 小時 新手友好度 75/100