Commit 7431dea
authored
* [#37930][Runners] Reap child processes in ProcessManager to prevent zombie accumulation
ProcessManager.stopProcess() calls destroy()/destroyForcibly() to terminate
child processes, but never calls Process.waitFor() to collect the exit status.
On POSIX systems, this means the terminated child process entry remains in the
kernel process table as a zombie (state Z/defunct) until the parent process
itself exits.
In long-running environments like Flink TaskManagers using
--environment_type=PROCESS, the expansion service processes are repeatedly
spawned and stopped but never reaped. Over time this leads to significant
zombie accumulation (176+ observed on production hosts).
The fix adds process.waitFor() calls after process termination in:
- stopProcess(): after the destroy/destroyForcibly sequence
- killAllProcesses(): after destroyForcibly in the shutdown hook path
Fixes #37930
* Update CHANGES.md with ProcessManager zombie fix
1 parent 683eceb commit 7431dea
2 files changed
Lines changed: 19 additions & 2 deletions
File tree
- runners/java-fn-execution/src/main/java/org/apache/beam/runners/fnexecution/environment
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| |||
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
206 | 214 | | |
207 | 215 | | |
208 | 216 | | |
| |||
249 | 257 | | |
250 | 258 | | |
251 | 259 | | |
252 | | - | |
| 260 | + | |
253 | 261 | | |
254 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
255 | 271 | | |
256 | 272 | | |
0 commit comments