diff --git a/sdks/python/apache_beam/runners/portability/portable_runner.py b/sdks/python/apache_beam/runners/portability/portable_runner.py index 117477af93c68..b35b8d518d4e9 100644 --- a/sdks/python/apache_beam/runners/portability/portable_runner.py +++ b/sdks/python/apache_beam/runners/portability/portable_runner.py @@ -495,7 +495,10 @@ def NotifyRunnerAvailable(self, start_worker_request, context): self._worker_threads, start_worker_request.worker_id)] logging.warn("Starting worker with command %s" % (command)) - worker_process = subprocess.Popen(command, stdout=subprocess.PIPE) + worker_process = subprocess.Popen( + command, + stdout=subprocess.PIPE, + close_fds=True) # Register to kill the subprocess on exit. atexit.register(worker_process.kill)