Skip to content

Commit

Permalink
[RPC] Raise error if server process terminated (#17101)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Lunderberg committed Jun 18, 2024
1 parent 9a7b148 commit a4f20f0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/tvm/rpc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ def _serving(sock, addr, opts, load_library):
# package and maybe hard to be installed on some platforms.
pass
server_proc.terminate()
elif server_proc.exitcode != 0:
raise RuntimeError(
f"Child process {server_proc.pid} exited unsuccessfully "
f"with error code {server_proc.exitcode}"
)

logger.info(f"finish serving {addr}")
os.chdir(old_cwd)
Expand Down

0 comments on commit a4f20f0

Please sign in to comment.