[Bug] RPC server _serving() skips os.chdir(old_cwd) and sock.close() when worker exits non-zero, leaving server in deleted CWD
メンテナーはふだん 3 日以内に返信
評価
調査の方向性
Read python/tvm/rpc/server.py around _serving() lines 138–178, then inspect the RPC server tests that exercise worker failures and timeouts. Reproduce a worker exit with a nonzero code and check whether the process restores its working directory and closes the socket; done means cleanup also runs on failure and the next session can be served.
索引モデルが issue の本文から書いたものです。
説明
Summary
In python/tvm/rpc/server.py:138-178, _serving() creates a temporary directory work_path, changes into it via old_cwd = os.getcwd(); os.chdir(work_path.path), and does not wrap the body in try ... finally:
old_cwd = os.getcwd()
os.chdir(work_path.path)
...
elif server_proc.exitcode != 0:
raise RuntimeError(...)
logger.info(f"finish serving {addr}")
os.chdir(old_cwd)
work_path.remove()
sock.close()
When the child worker process exits non-zero (e.g., segfault/abort), raise RuntimeError(...) skips os.chdir(old_cwd), work_path.remove(), and sock.close(). When work_path (TempDirectory) is garbage-collected, TempDirectory.__del__ deletes work_path.path — the parent server's current working directory — causing os.getcwd() on the next _serving() call to fail permanently with FileNotFoundError while leaking the client socket FD.
Affected Location
- Repository:
apache/tvm(main,python/tvm/rpc/server.py:138-178)
Minimal Standalone Reproduction
Calling _serving() when the worker exits with code 139, triggering gc.collect(), and accepting a second session:
- First session raises
RuntimeError: Child process ... exited unsuccessfully with error code 139and leavess1.fileno() >= 0(leaked FD). os.getcwd()and the next_serving()call immediately fail withFileNotFoundError: [Errno 2] No such file or directory.
Suggested Fix
Wrap lines 142-177 in try: ... finally: os.chdir(old_cwd); work_path.remove(); sock.close(), and join() server_proc after terminate() on timeout.
- 主要言語
- Python
- スター
- 13.9k
- フォーク
- 4.1k
- 平均マージ
- 4日 22時間
- マージ済み PR(30日)
- 22
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/tvm のほかの issue
-
[Bug] [Relax] `relax.op.unique(return_inverse=True)` returns an input-shaped inverse for N-D input when `axis` is None対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
[Bug][TOPI] `topi.scanop` (`cumsum` / `cumprod`) performs out-of-bounds write/read on empty tensorsオープンneeds-triage type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 3 日以内に返信
-
[Bug] [Relax] take_backward does not normalize negative axis causing heap OOB write and wrong gradients対応中かも @pierceluu10 が 4 日前に担当しました。 オープンneeds-triage type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
[Bug][Relax][ONNX] NonZero returns the wrong output shape for scalar inputs対応中かも @tandede が 9 日前に担当しました。 オープンneeds-triage type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 3 日以内に返信
-
needs-triage type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 3 日以内に返信
似ている issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
web-push-libs/pywebpush#216 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AgriciDaniel/claude-seo#572 ·
メンテナーはふだん 5 日以内に返信
-
area:print-dispatch
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信
-
area: docs domain: technical-writing good first issue type: documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
Deepak3699/Ai_Mentor#919 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信