Skip to content

Commit 6f8613e

Browse files
committed
Fix ml test crash.
1 parent 1916301 commit 6f8613e

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

sdks/python/apache_beam/utils/multi_process_shared.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,12 +410,20 @@ def connect_manager():
410410
self._manager = manager
411411
except retryable_exceptions:
412412
# The server is no longer good, terminate it if we spawned it.
413+
if getattr(self, '_life_line', None):
414+
try:
415+
self._life_line.close()
416+
except Exception:
417+
pass
413418
if getattr(self, '_server_process', None) and self._server_process.is_alive():
414419
logging.info(
415420
"Terminating unresponsive server process %s",
416421
self._server_process.pid)
417-
self._server_process.terminate()
418-
self._server_process.join()
422+
try:
423+
self._server_process.kill()
424+
self._server_process.join(timeout=1.0)
425+
except Exception:
426+
pass
419427
if os.path.exists(address_file):
420428
os.unlink(address_file)
421429

0 commit comments

Comments
 (0)