After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 576111 - Unit test failed on SUN Hotspot and IBM J9 with -Xcheck:jni
Unit test failed on SUN Hotspot and IBM J9 with -Xcheck:jni
Status: RESOLVED OBSOLETE
Product: java-gnome
Classification: Bindings
Component: Bindings Core
4.0.x
Other Linux
: Normal critical
: ---
Assigned To: java-gnome bindings maintainers
java-gnome bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2009-03-20 17:34 UTC by Byeong Lee
Modified: 2020-11-06 22:22 UTC
See Also:
GNOME target: ---
GNOME version: 2.23/2.24



Description Byeong Lee 2009-03-20 17:34:59 UTC
>> Environment <<
* Pentium D, Ubuntu 8.10, SUN Hotspot 1.6.0_10 and IBM J9 1.6.0
* java-gnome 4.0.10

 >> Failure Log with Sun Hotspot <<

$java -version
java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)
$java -Xcheck:jni -client -ea -Djava.awt.headless=true -classpath tmp/gtk-4.0.jar:tmp/generator/:tmp/tests/:/usr/share/java/junit.jar UnitTests
com.operationaldynamics.codegen.ValidateUtilityMethods
 - testEncodeJavaNamesToJni()                                                                                                                                          ok        
...
 - testButtonClicked()                                                                                                                                                     FATAL ERROR in native method: JNI received a class argument that is not a class
	at org.gnome.gtk.GtkButton.gtk_button_clicked(Native Method)
	at org.gnome.gtk.GtkButton.clicked(GtkButton.java:121)
	- locked <0xae1f83a0> (a org.gnome.gdk.Gdk$Lock)
	at org.gnome.gtk.Button.emitClicked(Button.java:362)
	at org.gnome.gtk.ValidateSignalEmission.testButtonClicked(ValidateSignalEmission.java:39)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at junit.framework.TestCase.runTest(TestCase.java:164)
	at junit.framework.TestCase.runBare(TestCase.java:130)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:120)
	at junit.framework.TestSuite.runTest(TestSuite.java:230)
	at junit.framework.TestSuite.run(TestSuite.java:225)
	at junit.framework.TestSuite.runTest(TestSuite.java:230)
	at junit.framework.TestSuite.run(TestSuite.java:225)
	at com.operationaldynamics.junit.VerboseTestRunner.doRun(VerboseTestRunner.java:57)
	at com.operationaldynamics.junit.VerboseTestRunner.run(VerboseTestRunner.java:134)
	at UnitTests.main(UnitTests.java:72)
Aborted

 >> Failure Log with IBM J9 <<
$java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build pxi3260-20071123_01)
IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260-20071121_15015 (JIT enabled)
J9VM - 20071121_015015_lHdSMR
JIT  - r9_20071121_1330
GC   - 20071031_AA)
JCL  - 20071118_01

$java -Xcheck:jni -client -ea -Djava.awt.headless=true -classpath tmp/gtk-4.0.jar:tmp/generator/:tmp/tests/:/usr/share/java/junit.jar UnitTests
JVMJNCK001I JNI check utility installed. Use -Xcheck:jni:help for usage
com.operationaldynamics.codegen.ValidateUtilityMethods
 - testEncodeJavaNamesToJni()          
...
 - testSwitchPage()                                                                                                                                                        Unhandled exception
Type=Segmentation error vmState=0x00040000
J9Generic_Signal_Number=00000004 Signal_Number=0000000b Error_Value=00000000 Signal_Code=00000001
Handler1=B7E9062B Handler2=B7E6F4FC InaccessibleAddress=00000001
EDI=08C1CC34 ESI=0888E300 EAX=00000001 EBX=B6F2FDEC
ECX=00000000 EDX=00000000
EIP=B6F19EE0 ES=0000007B DS=0000007B ESP=B7E21838
EFlags=00010202 CS=00000073 SS=0000007B EBP=B7E21850
Module=/home/bclee/t/j9-1.6/jre/lib/i386/libj9jnichk24.so
Module_base_address=B6F17000
Target=2_40_20071121_015015_lHdSMR (Linux 2.6.27-11-generic)
CPU=x86 (2 logical CPUs) (0x7dff7000 RAM)
----------- Stack Backtrace -----------
/home/bclee/t/j9-1.6/jre/lib/i386/libj9prt24.so [0xb7e6756d]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9vm24.so [0xb7e9125a]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9vm24.so [0xb7e9112e]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9prt24.so [0xb7e6eb3b]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9vm24.so [0xb7e906ef]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9prt24.so [0xb7e6f671]
[0xb80dd410]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9jnichk24.so [0xb6f18d1b]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9jnichk24.so [0xb6f19ad6]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9jnichk24.so [0xb6f24836]
/home/bclee/w/jni/java-gnome-4.0.10/tmp/libgtkjni-4.0.10.so [0x95fb644e]
/usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x1ab) [0x95720c4b]
/usr/lib/libgobject-2.0.so.0 [0x95737095]
/usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x7dc) [0x957387ac]
/usr/lib/libgobject-2.0.so.0(g_signal_emit+0x26) [0x95738c26]
/usr/lib/libgtk-x11-2.0.so.0 [0x95ca0004]
/home/bclee/w/jni/java-gnome-4.0.10/tmp/libgtkjni-4.0.10.so(Java_org_gnome_gtk_GtkNotebook_gtk_1notebook_1set_1current_1page+0x3c) [0x95fd2f78]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9vm24.so [0xb7ea0ef8]
/home/bclee/t/j9-1.6/jre/lib/i386/j9vm/libjvm.so(JVM_InvokeMethod+0x92) [0xb7f15491]
/home/bclee/t/j9-1.6/jre/lib/i386/libjava.so(Java_sun_reflect_NativeMethodAccessorImpl_invoke0+0x22) [0x96487a02]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9vm24.so [0xb7ea0f21]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9vm24.so [0xb7e9c5b9]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9vm24.so [0xb7e9e65f]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9prt24.so [0xb7e6eb3b]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9vm24.so [0xb7e9c7eb]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9vm24.so [0xb7e9cc17]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9vm24.so [0xb7e9ba8c]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9jnichk24.so [0xb6f24791]
/home/bclee/t/j9-1.6/jre/lib/i386/libj9jnichk24.so [0xb6f246cd]
java(JavaMain+0x2c4) [0x8049eac]
/lib/tls/i686/cmov/libpthread.so.0 [0xb809d50f]
/lib/tls/i686/cmov/libc.so.6(clone+0x5e) [0xb800ea0e]
---------------------------------------
JVMDUMP006I Processing Dump Event "gpf", detail "" - Please Wait.
JVMDUMP007I JVM Requesting System Dump using '/home/bclee/w/jni/java-gnome-4.0.10/core.20090320.122410.8808.0001.dmp'
JVMDUMP010I System Dump written to /home/bclee/w/jni/java-gnome-4.0.10/core.20090320.122410.8808.0001.dmp
JVMDUMP007I JVM Requesting Snap Dump using '/home/bclee/w/jni/java-gnome-4.0.10/Snap.20090320.122410.8808.0002.trc'
JVMDUMP010I Snap Dump written to /home/bclee/w/jni/java-gnome-4.0.10/Snap.20090320.122410.8808.0002.trc
JVMDUMP007I JVM Requesting Java Dump using '/home/bclee/w/jni/java-gnome-4.0.10/javacore.20090320.122410.8808.0003.txt'
JVMDUMP010I Java Dump written to /home/bclee/w/jni/java-gnome-4.0.10/javacore.20090320.122410.8808.0003.txt
JVMDUMP013I Processed Dump Event "gpf", detail "".

 >>> Problem <<<

The problem is using a dead local reference.

1. Here "receiver" is a local reference

src/jni/bindings_java_signal.c:
  524		bjc->receiver = receiver;

2. In the same file, the local reference (receiver) is dead, but used.
   248			(*env)->CallStaticVoidMethodA(env, bjc->receiver, bjc->method, jargs);
   255			_b = (*env)->CallStaticBooleanMethodA(env, bjc->receiver, bjc->method, jargs);		
   272			_e = (*env)->CallStaticIntMethodA(env, bjc->receiver, bjc->method, jargs);
		   286			_str = (*env)->CallStaticObjectMethodA(env, bjc->receiver, bjc->method, jargs);

  >>> Fix <<<

A quick fix is to make the "receiver" global reference.
src/jni/bindings_java_signal.c:
  524		bjc->receiver = (*env)->NewGlobalRef(env,receiver);

Then, you might want a null checking.
Comment 1 Andrew Cowie 2009-03-20 23:54:49 UTC
Great analysis work.

I appear to be able to duplicate the problem by trying your -Xcheck:jni option.

My immediate reaction is that indeed that needs to be a GlobalRef and not a LoaclRef.

I'm not a fan of quick fixes, generally. First we should understand why this is working normally for everyone else in production and what about your environment is different. Far more seriously, this "quick fix" is a memory leak without a corrposnding removal of the GlobalRef somewhere else. You'll have to do that in your branch.

This needs fixing, presumably, but as this doesn't happen without -Xcheck:jni, I'm not sure we can really rank this as a blocker.

AfC

P.S. Using a VM that is dated 23 Nov 2007? That's pretty old.
Comment 2 André Klapper 2020-11-06 22:22:22 UTC
bugzilla.gnome.org is being replaced. We are closing all old bug reports in Bugzilla which have not seen updates for many years.

If you can still reproduce this issue in a recent version of java-gnome, then please feel free to report it at https://github.com/istathar/java-gnome/issues

Thank you for reporting this issue and we are sorry it could not be fixed.