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). This pull request has now been integrated. Changeset: 5c696f47 Author: Lee Jiwon <[email protected]> Committer: Daniel Jeliński <[email protected]> URL: https://git.openjdk.org/jdk/commit/5c696f47637d2f75f044cc525b1286ccc57fce1a Stats: 8 lines in 1 file changed: 7 ins; 0 del; 1 mod 8394402: (process) Native memory leak in ProcessBuilder POSIX_SPAWN after JDK-8377907 Reviewed-by: simonis, djelinski ------------- PR: https://git.openjdk.org/jdk/pull/33360
