Skip to content

Commit a4f20f0

Browse files
authored
[RPC] Raise error if server process terminated (#17101)
Prior to this PR, a local RPC server could crash without any indication in the main process. While typically this crash would cause an error in the main process due to the lack of a `RPCCode::kReturn` from the server, the delayed error can complicate debugging. This PR updates the local RPC server to raise an exception if the server process returns with a non-zero exit code.
1 parent 9a7b148 commit a4f20f0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

python/tvm/rpc/server.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ def _serving(sock, addr, opts, load_library):
164164
# package and maybe hard to be installed on some platforms.
165165
pass
166166
server_proc.terminate()
167+
elif server_proc.exitcode != 0:
168+
raise RuntimeError(
169+
f"Child process {server_proc.pid} exited unsuccessfully "
170+
f"with error code {server_proc.exitcode}"
171+
)
167172

168173
logger.info(f"finish serving {addr}")
169174
os.chdir(old_cwd)

0 commit comments

Comments
 (0)