-
Bug
-
Resolution: Fixed
-
P3
-
None
-
b04
-
ppc
-
aix
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8313940 | 21.0.1 | Christoph Langer | P3 | Resolved | Fixed | b06 |
JDK-8313664 | 21 | Christoph Langer | P3 | Resolved | Fixed | b35 |
Stackoverflow exception has caused an exit value 1 when native thread is attaching as daemon.
On AIX the default stack size of POSIX thread is 192 KB [https://www.ibm.com/docs/en/aix/7.1?topic=p-pthread-attr-getstacksize-subroutine ]. But in VM's thread creation logic, we set the default thread stack size to 2 MB [ https://github.com/openjdk/jdk/blob/master/src/hotspot/os_cpu/aix_ppc/globals_aix_ppc.hpp#LL33C64-L33C64 ] . So, in the absence of an explicit -Xss value the Java threads have 2M as the default stack size.
This stack size is used by the function CallJavaMainInNewThread() to explicitly set the pthread attribute for stack size: https://github.com/openjdk/jdk/blob/master/src/java.base/unix/native/libjli/java_md.c#L671
But on this particular test we are not going through any particular JVM thread creation routines instead we are using a pthread_create() function which is defined in pthread library, hence we are getting 192 KB as default stack size which is default stack size of posix thread on AIX.
Log:
stdout: [Triggering a JNI warning
Native thread is running and attaching as daemon ...
];
stderr: [ Test ERROR. Can't attach current thread: -1 ]
exitValue = 1
java.lang.RuntimeException: Expected to get exit value of [0], exit value is: [1]`
On AIX the default stack size of POSIX thread is 192 KB [https://www.ibm.com/docs/en/aix/7.1?topic=p-pthread-attr-getstacksize-subroutine ]. But in VM's thread creation logic, we set the default thread stack size to 2 MB [ https://github.com/openjdk/jdk/blob/master/src/hotspot/os_cpu/aix_ppc/globals_aix_ppc.hpp#LL33C64-L33C64 ] . So, in the absence of an explicit -Xss value the Java threads have 2M as the default stack size.
This stack size is used by the function CallJavaMainInNewThread() to explicitly set the pthread attribute for stack size: https://github.com/openjdk/jdk/blob/master/src/java.base/unix/native/libjli/java_md.c#L671
But on this particular test we are not going through any particular JVM thread creation routines instead we are using a pthread_create() function which is defined in pthread library, hence we are getting 192 KB as default stack size which is default stack size of posix thread on AIX.
Log:
stdout: [Triggering a JNI warning
Native thread is running and attaching as daemon ...
];
stderr: [ Test ERROR. Can't attach current thread: -1 ]
exitValue = 1
java.lang.RuntimeException: Expected to get exit value of [0], exit value is: [1]`
- backported by
-
JDK-8313664 [AIX] TestNativeStack.java is failing with exit value 1
- Resolved
-
JDK-8313940 [AIX] TestNativeStack.java is failing with exit value 1
- Resolved
- relates to
-
JDK-8303624 The java.lang.Thread.FieldHolder can be null for JNI attaching threads
- Resolved
-
JDK-8219652 [aix] Tests failing with JNI attach problems.
- Resolved
- links to
-
Commit openjdk/jdk21/f87a70de
-
Commit openjdk/jdk/5ff42d14
-
Review openjdk/jdk21/155
-
Review openjdk/jdk/14209
(3 links to)