This is an automated email from the ASF dual-hosted git repository.

lunderberg pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new a4f20f0bbb [RPC] Raise error if server process terminated (#17101)
a4f20f0bbb is described below

commit a4f20f0bbb9f09282a4c3738cae6548d1c18ab1f
Author: Eric Lunderberg <[email protected]>
AuthorDate: Tue Jun 18 13:28:15 2024 -0500

    [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.
---
 python/tvm/rpc/server.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/python/tvm/rpc/server.py b/python/tvm/rpc/server.py
index 4c1014ff2a..7c1a198562 100644
--- a/python/tvm/rpc/server.py
+++ b/python/tvm/rpc/server.py
@@ -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)

Reply via email to