damccorm opened a new pull request, #41123: URL: https://github.com/apache/beam/pull/41123
### Summary In `PreCommit Python Coverage` (https://github.com/apache/beam/actions/runs/42464314353), `DeadLettersTest_1.test_side_inputs` (`use_subprocess=True`) failed with a missing valid element `(10, 0)` in `CheckDefault`. Root cause: In `_SubprocessDoFn._call_remote` (`sdks/python/apache_beam/transforms/core.py`), when `self._pool is None` (either on initial startup or after `_terminate_pool()` tore down the pool following a prior element crash), `ProcessPoolExecutor(1)` creation and `self._pool.submit(self._remote_init, self._serialized_fn).result()` ran outside the `try / except BrokenProcessPool` block. If the newly forked worker process encountered a transient `BrokenProcessPool` during startup (`_remote_init`), `self._terminate_pool()` was not called and the exception propagated to `_ExceptionHandlingWrapperDoFn`, routing the valid element (`10`) to the dead-letter output before `_remote_process` was even invoked. Retrying `ProcessPoolExecutor(1)` + `_remote_init` up to 3 times on `BrokenProcessPool` (cleaning up via `self._terminate_pool()` on failure) prevents transient subprocess fork/startup failures from corrupting pool state or dropping valid elements. ### Verification - Triggered `PreCommit Python Coverage` on branch `fix/subprocess-dofn-pool-init-retry`: https://github.com/apache/beam/actions/runs/42659132315 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
