On Mon, 15 Sep 2025 11:13:56 GMT, Joachim Kern <jk...@openjdk.org> wrote:
> The new tests > java/lang/ProcessBuilder/FDLeakTest/FDLeakTest.java#fork > java/lang/ProcessBuilder/FDLeakTest/FDLeakTest.java#posix_spawn > fail on AIX. > The tests were added with > [JDK-8210549](https://bugs.openjdk.org/browse/JDK-8210549) . > > Error output is > java/lang/ProcessBuilder/FDLeakTest/FDLeakTest.java#fork > > Opened and leaked ./testfile_FDLeaker.txt (4) > ----------System.err:(13/647)---------- > *** Parent leaked file descriptor 9 *** > *** Parent leaked file descriptor 10 *** > java.lang.RuntimeException: Failed > at FDLeakTest.main(FDLeakTest.java:69) > at > java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) > at java.base/java.lang.reflect.Method.invoke(Method.java:565) > at > com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138) > at java.base/java.lang.Thread.run(Thread.java:1474) > > > java/lang/ProcessBuilder/FDLeakTest/FDLeakTest.java#posix_spawn > > > ----------System.out:(1/46)---------- > Opened and leaked ./testfile_FDLeaker.txt (4) > ----------System.err:(13/647)---------- > *** Parent leaked file descriptor 9 *** > *** Parent leaked file descriptor 10 *** > java.lang.RuntimeException: Failed > at FDLeakTest.main(FDLeakTest.java:69) > at > java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) > at java.base/java.lang.reflect.Method.invoke(Method.java:565) > at > com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138) > at java.base/java.lang.Thread.run(Thread.java:1474) src/java.base/unix/native/libjava/childproc.c line 73: > 71: /* The /proc file System in AIX does not contain open system files > 72: * like /dev/random. Therefore we use a different approach and do > 73: * not need isAsciiDigit() or FD_DIR */ Leave isAsciiDigit in; optionally replace it with https://pubs.opengroup.org/onlinepubs/009696699/functions/isdigit.html . Reduction of ifdefs is more important than avoiding an unnecessary function. src/java.base/unix/native/libjava/childproc.c line 101: > 99: (markCloseOnExec(STDERR_FILENO + 1) == -1 && errno != EBADF)) { > 100: return -1; > 101: } Most of this explanation pertains to how markDescriptorsCloseOnExec works in general and can either be left out (preferred, since the inner workings are obvious from the context, and if someone does not understand that they should not modify this code) or should at least be moved to a platform-generic place. But what is missing is what is actually different on AIX. AFAICS, this code only closes a single file descriptor. How is this going to work? If 10 file descriptors happen to be open, one of which is STDERR_FILENO + 2, the function closes just that one, then returns 0, and all other filedescriptors stay open? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27291#discussion_r2368113794 PR Review Comment: https://git.openjdk.org/jdk/pull/27291#discussion_r2368153058