asyncio proactor server leaks the accepted socket and stops accepting when transport creation fails
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
On the proactor event loop (the default on Windows), BaseProactorEventLoop._start_serving()'s loop() callback runs protocol_factory() and transport creation in the same callback that re-arms accept(), guarded only by except OSError / except CancelledError. When protocol_factory() or _make_ssl_transport() / _make_socket_transport() raises for an accepted connection:
- a non-
OSError(e.g. a failingprotocol_factory) propagates out ofloop(): the accepted socket is never closed (it leaks until garbage collection) and accept is not re-armed, so the server stops accepting new connections; - an
OSErroris caught as'Accept failed on a socket', which closes the listening socket, and still leaks the accepted socket.
This is the proactor counterpart of gh-155934 (selector accept) and gh-153133 (create_connection): an accepted socket must be closed when the transport is never created, and a per-connection failure must not tear down the listening socket or the accept loop.
Verified with mock-based tests in test_proactor_events (the same approach used for the selector fix in gh-155934), which run on all platforms.
CPython versions tested on:
CPython main
Operating systems tested on:
Windows (ProactorEventLoop)
Linked PRs
- gh-156366
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
BaseProactorEventLoop._start_serving() と test_proactor_events の mock ベースのテストから始めてください。プロトコルまたはトランスポートの作成失敗を再現し、その後、受け付けたソケットが閉じられ、リスニング中のサーバーが接続の受け付けを継続することを確認してください。変更を加える前に、リンクされた PR gh-156366 の既存の作業と比較してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- networking, operating-systems
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 25/100