On Wed, 14 Oct 2026 11:52:18 GMT, Lee Jiwon <[email protected]> wrote:
> JDK-8377907 added file actions to spawnChild() without cleanup. This patch > destroys them at both adddup2 error exits and immediately after posix_spawn(). > > The cleanup helper preserves errno so it does not change the IOException > diagnostics in forkAndExec(). > > ### Testing > > macOS 26.2/aarch64, release build. Before: JDK 27+35-2325. After: commit > 1077a0ab5ec. > > make exploded-test TEST="jtreg:test/jdk/java/lang/ProcessBuilder": 26 passed, > 0 failed, 13 not run. > > Manual checks used MallocStackLogging=1 and `leaks --fullStacks <PID>`. > Counts sum all ROOT LEAK groups labeled realloc in > _posix_spawn_file_actions_grow. The successful-launch Before result and > reproducer are attached to > [JDK-8394402](https://bugs.openjdk.org/browse/JDK-8394402). > > | Scenario | Before | After | > |---|---:|---:| > | 110 successful launches | 110 | 0 | > | 50 first-adddup2 failures | 50 | 0 | > | 50 fifth-adddup2 failures | 50 | 0 | > > The adddup2 failures used a DYLD_INSERT_LIBRARIES interposer returning EBADF > for newfd=0 or newfd=3. > > No automated regression test is included: NMT does not track these libc > allocations, and the manual checks use macOS tools. > [JDK-8311645](https://bugs.openjdk.org/browse/JDK-8311645) used noreg-hard > for a leak in the same function. > > GitHub Actions: Linux x64 builds and tier1 passed. > > Native leaks were not measured on Linux or AIX. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). Hi @dlwldnjs1009, Thanks for spotting this issue. The changes look good, but once we're on it, shouldn't we also check that the call to `posix_spawn_file_actions_init()` is successful? ------------- Changes requested by simonis (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/33360#pullrequestreview-5710437519
