[Bug] RPC server _serving() skips os.chdir(old_cwd) and sock.close() when worker exits non-zero, leaving server in deleted CWD
Les mainteneurs répondent en général sous 3 jours
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 35/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Python
- Étoiles
- 13.9k
- Forks
- 4.1k
- Merge moyen
- 4 j 22 h
- PR mergées (30 j)
- 22
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de apache/tvm
-
[Bug] [Relax] `relax.op.unique(return_inverse=True)` returns an input-shaped inverse for N-D input when `axis` is NonePeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 3 jours
-
[Bug][TOPI] `topi.scanop` (`cumsum` / `cumprod`) performs out-of-bounds write/read on empty tensorsOuverteneeds-triage type: bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 3 jours
-
[Bug] [Relax] take_backward does not normalize negative axis causing heap OOB write and wrong gradientsPeut-être pris @pierceluu10 l’a pris il y a 5 jours. Ouverteneeds-triage type: bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 3 jours
-
[Bug][Relax][ONNX] NonZero returns the wrong output shape for scalar inputsPeut-être pris @tandede l’a pris il y a 9 jours. Ouverteneeds-triage type: bug
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 3 jours
-
needs-triage type: bug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
apache/tvm#21043 · 1 commentaire ·
Les mainteneurs répondent en général sous 3 jours
Toutes les issues de apache/tvm
Issues similaires
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
Techiebutler/freeframe#687 ·
Les mainteneurs répondent en général sous 1 jour
-
bug verbose GC
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
IBM/javacore-analyser#677 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 79/100
Les mainteneurs répondent en général sous 2 jours
-
area/config comp/plugins P1 platform/qqbot tool/file type/bug
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
NousResearch/hermes-agent#163932 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
plugins/dsh: todayStr() computes UTC but is documented as local — journal entries written 00:00–08:00 local land in the previous day's filePeut-être pris @Beehtrix l’a pris aujourd’hui. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
zilliztech/memsearch#907 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour