JDK-6536943 : Bogus -Xcheck:jni warning for SIG_INT action for SIGINT in JVM started from non-interactive shell
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: hs24,hs25,7,8,9
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: generic
  • Submitted: 2007-03-21
  • Updated: 2016-02-23
  • Resolved: 2014-03-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u60Fixed 9 b08Fixed
Related Reports
Relates :  
Description
On Linux, any java -Xcheck:jni command started from a non-interactive shell will print the warning "Warning: SIGINT handler expected:libjvm.so+0x3116e0  found:0x00000001".

sbohne/nova2.East.Sun.COM> sh -c "java -showversion -Xcheck:jni -jar /usr/sbohne/jdk7-b09/demo/jfc/Java2D/Java2Demo.jar &"
sbohne/nova2.East.Sun.COM> java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b09)
Java HotSpot(TM) Client VM (build 1.7.0-ea-b09, mixed mode, sharing)

Warning: SIGINT handler expected:libjvm.so+0x3116e0  found:0x00000001
Signal Handlers:
SIGSEGV: [libjvm.so+0x30f900], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGBUS: [libjvm.so+0x30f900], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGFPE: [libjvm.so+0x30f900], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGPIPE: [libjvm.so+0x30f900], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGXFSZ: [libjvm.so+0x30f900], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGILL: [libjvm.so+0x30f900], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
SIGUSR2: [libjvm.so+0x311940], sa_mask[0]=0x00000000, sa_flags=0x10000004
SIGHUP: [libjvm.so+0x3116e0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGINT: SIG_IGN, sa_mask[0]=0x00000000, sa_flags=0x00000000
SIGTERM: [libjvm.so+0x3116e0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
SIGQUIT: [libjvm.so+0x3116e0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004

sbohne/nova2.East.Sun.COM> uname -a
Linux nova2.East.Sun.COM 2.6.18-1.2798.fc6xen #1 SMP Mon Oct 16 15:11:19 EDT 2006 i686 athlon i386 GNU/Linux
sbohne/nova2.East.Sun.COM> cat /etc/*release*
Fedora Core release 6 (Zod)

Comments
Thanks, now the output: -bash-3.00$ cat text.out | $J8S/bin/java -Xcheck:jni -showversion Test java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode) Hello, Java Pipe Example -bash-3.00$ cat text.out | $J8/bin/java -Xcheck:jni -showversion Test java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b62-internal-201403120017.yqi.6536943-tar-gz, mixed mode) Hello, Java Pipe Example
12-03-2014

Yes, your example answered my question quite nicely except for the last example: $ cat text.out | $J8/bin/java -Xcheck:jni -showversion Test < text.out The above should have caused an 'ambiguous input' error because you're both piping 'cat text.out' along with redirecting stdin from '< text.out'.
12-03-2014

With following simple Test.java: import java.io.*; public class Test { public static void main throws Exception(String[] args) { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); String x; while( (x = f.readLine()) != null) System.out.println(x); } } file text.out with only online: Hello, Java Pipe Example 1) Outputs of 8-latest: -bash-3.00$ $J8S/bin/java -Xcheck:jni -showversion Test < text.out java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode) Hello, Java Pipe Example -bash-3.00$ sh -c "$J8S/bin/java -Xcheck:jni -showversion Test < text.out" java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode) Hello, Java Pipe Example -bash-3.00$ sh -c "$J8S/bin/java -Xcheck:jni -showversion Test < text.out &" -bash-3.00$ java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode) Warning: SIGINT handler expected:libjvm.so+0x10e73a0 found:0x0000000000000001 Signal Handlers: SIGSEGV: [libjvm.so+0x10edb84], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c SIGBUS: [libjvm.so+0x10edb84], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c SIGFPE: [libjvm.so+0x10edb84], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c SIGPIPE: [libjvm.so+0x10edb84], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c SIGXFSZ: [libjvm.so+0x10edb84], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c SIGILL: [libjvm.so+0x10edb84], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000 SIGUSR2: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000 SIGQUIT: [libjvm.so+0x10e73a0], sa_mask[0]=0xffbffeff, sa_flags=0x00000004 SIGHUP: [libjvm.so+0x10e73a0], sa_mask[0]=0xffbffeff, sa_flags=0x00000004 SIGINT: SIG_IGN, sa_mask[0]=0x00000000, sa_flags=0x00000000 SIGTERM: [libjvm.so+0x10e73a0], sa_mask[0]=0xffbffeff, sa_flags=0x00000004 SIG39: [libjvm.so+0x10edbcc], sa_mask[0]=0x00000000, sa_flags=0x00000008 SIG40: [libjvm.so+0x10edb84], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c Hello, Java Pipe Example 2) Outputs of binary with fix: -bash-3.00$ $J8/bin/java -Xcheck:jni -showversion Test < text.out java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b62-internal-201403120017.yqi.6536943-tar-gz, mixed mode) Hello, Java Pipe Example -bash-3.00$ sh -c "$J8/bin/java -Xcheck:jni -showversion Test < text.out" java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b62-internal-201403120017.yqi.6536943-tar-gz, mixed mode) Hello, Java Pipe Example -bash-3.00$ sh -c "$J8/bin/java -Xcheck:jni -showversion Test < text.out &" -bash-3.00$ java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b62-internal-201403120017.yqi.6536943-tar-gz, mixed mode) Hello, Java Pipe Example Hope this answered your question, also, using a pipe like -bash-3.00$ cat text.out | $J8/bin/java -Xcheck:jni -showversion Test < text.out java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b62-internal-201403120017.yqi.6536943-tar-gz, mixed mode) Hello, Java Pipe Example which got same results.
12-03-2014

What will the "isatty(fileno(stdin))" check do when the 'java' cmd is part of a pipeline or is reading an input file via stdin? I'm thinking: $ sed '<some_sed_logic>' | java MySpecialFilterClass $ java MySpecialCheckingClass < some_random_data_file
12-03-2014

It has same result for Solaris: bash-3.00$ sh -c "$JAVA_HOME/bin/java -showversion -Xcheck:jni -jar Java2Demo.jar &" bash-3.00$ java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b98) Java HotSpot(TM) Server VM (build 25.0-b40, mixed mode) Warning: SIGINT handler expected:libjvm.so+0xc1e9f8 found:0x00000001 Signal Handlers: SIGSEGV: [libjvm.so+0xc2644c], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c SIGBUS: [libjvm.so+0xc2644c], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c SIGFPE: [libjvm.so+0xc2644c], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c SIGPIPE: [libjvm.so+0xc2644c], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c SIGXFSZ: [libjvm.so+0xc2644c], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c SIGILL: [libjvm.so+0xc2644c], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000 SIGUSR2: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000 SIGQUIT: [libjvm.so+0xc1e9f8], sa_mask[0]=0xffbffeff, sa_flags=0x00000004 SIGHUP: [libjvm.so+0xc1e9f8], sa_mask[0]=0xffbffeff, sa_flags=0x00000004 SIGINT: SIG_IGN, sa_mask[0]=0x00000000, sa_flags=0x00000000 SIGTERM: [libjvm.so+0xc1e9f8], sa_mask[0]=0xffbffeff, sa_flags=0x00000004 SIG39: [libjvm.so+0xc26490], sa_mask[0]=0x00000000, sa_flags=0x00000008 SIG40: [libjvm.so+0xc2644c], sa_mask[0]=0xffbffeff, sa_flags=0x0000000c Exception in thread "AWT-EventQueue-0" java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it. It also happened same on MacOS X The solution maybe that we don't check signal handler is not terminal running. That means for all signals, we don't check their handlers if we run on a non-interative shell. --- a/src/os/linux/vm/os_linux.cpp Wed Mar 05 12:31:09 2014 -0500 +++ b/src/os/linux/vm/os_linux.cpp Tue Mar 11 22:42:01 2014 -0700 @@ -4461,7 +4461,7 @@ #define DO_SIGNAL_CHECK(sig) \ - if (!sigismember(&check_signal_done, sig)) \ + if (!sigismember(&check_signal_done, sig) && isatty(fileno(stdin))) \ os::Linux::check_signal_handler(sig) Same change to os_bsd.cpp, os_solaris.cpp and os_aix.cpp.
12-03-2014

You can't just test with -version you have to actually try to run a java application otherwise the JNI checking code will not be triggered. This still reproduces. > sh -c "../build/b05/linux-i586-ea/images/j2sdk-image/bin/java -showversion -Xcheck:jni -jar ../build/b05/linux-i586-ea/images/j2sdk-image/demo/jfc/Java2D/Java2Demo.jar &" bussund0416 /scratch/dh198349/ejdk8u-dev/hotspot > java version "1.8.0_06-ea" Java(TM) SE Embedded Runtime Environment (build 1.8.0_06-ea-b05) Java HotSpot(TM) Embedded Server VM (build 25.0-b69, mixed mode) Warning: SIGINT handler expected:libjvm.so+0x62d3f0 found:0x00000001 Signal Handlers: SIGSEGV: [libjvm.so+0x62d070], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGBUS: [libjvm.so+0x62d070], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGFPE: [libjvm.so+0x62d070], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGPIPE: [libjvm.so+0x62d070], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGXFSZ: [libjvm.so+0x62d070], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGILL: [libjvm.so+0x62d070], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000 SIGUSR2: [libjvm.so+0x62d280], sa_mask[0]=0x00000000, sa_flags=0x10000004 SIGHUP: [libjvm.so+0x62d3f0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGINT: SIG_IGN, sa_mask[0]=0x00000000, sa_flags=0x00000000 SIGTERM: [libjvm.so+0x62d3f0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 SIGQUIT: [libjvm.so+0x62d3f0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 Exception in thread "AWT-EventQueue-0" java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it.
05-03-2014

Tested for most recent 9, 8u20, and 7u7 the output: -bash-4.1$ sh -c "/java/re/jdk/7u7/promoted/latest/binaries/linux-i586/bin/java -Xcheck:jni -version &" java version "1.7.0_07" Java(TM) SE Runtime Environment (build 1.7.0_07-b10) Java HotSpot(TM) Server VM (build 23.3-b01, mixed mode) -bash-4.1$ sh -c "/java/re/jdk/8u20/promoted/latest/binaries/linux-i586/bin/java -Xcheck:jni -version &" java version "1.8.0_20-ea" Java(TM) SE Runtime Environment (build 1.8.0_20-ea-b03) Java HotSpot(TM) Server VM (build 25.20-b04, mixed mode) -bash-4.1$ sh -c "/java/re/jdk/9/promoted/latest/binaries/linux-i586/bin/java -Xcheck:jni -version &" java version "1.9.0-ea" Java(TM) SE Runtime Environment (build 1.9.0-ea-b03) Java HotSpot(TM) Server VM (build 25.0-b62, mixed mode) uname -a output: Linux intelsdv33 2.6.31-22-generic #61-Ubuntu SMP Wed Jul 28 02:02:56 UTC 2010 x86_64 GNU/Linux Tested on other Linux platforms too, did not reproduce.
05-03-2014