Skip to content

Commit 6dd7674

Browse files
committed
Detect zombie processes and ignore them before calling cmdline API
1 parent f9d48ea commit 6dd7674

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/sagemaker_pytorch_serving_container/torchserve.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,12 @@ def _retrieve_ts_server_process():
184184
ts_server_processes = list()
185185

186186
for process in psutil.process_iter():
187-
try:
188-
if TS_NAMESPACE in process.cmdline():
189-
ts_server_processes.append(process)
190-
except psutil.NoSuchProcess:
187+
if process.status() == psutil.STATUS_ZOMBIE:
191188
continue
192189

190+
if TS_NAMESPACE in process.cmdline():
191+
ts_server_processes.append(process)
192+
193193
if not ts_server_processes:
194194
raise Exception("Torchserve model server was unsuccessfully started")
195195

0 commit comments

Comments
 (0)