[tcljava-user] TclBlend crash : JNI Panic
Brought to you by:
mdejong
From: Jean-Francois M. <jea...@st...> - 2004-05-18 13:33:07
|
Hi, I have a big trouble with TclBlend in my software. The code crash with this stack trace : JNI panic: native code passed a null object to a non-static method at tcl.lang.CObject.decrRefCount(Native Method) at tcl.lang.CObject.dispose(CObject.java:100) at tcl.lang.TclObject.setInternalRep(TclObject.java:107) at tcl.lang.FuncSig.get(FuncSig.java:249) at tcl.lang.JavaInvoke.callMethod(JavaInvoke.java:110) at tcl.lang.ReflectObject.cmdProc(ReflectObject.java:916) at tcl.lang.Interp.callCommand(Interp.java:953) And sometimes the crash happens with this message : JNI panic: native code passed a null object to a non-static method at tcl.lang.Interp.setResult(Native Method) at tcl.lang.Interp.setResult(Interp.java:736) at tcl.lang.TclException.<init>(TclException.java:89) at tcl.lang.TclException.<init>(TclException.java:155) at tcl.lang.ReflectObject.setReflectObjectFromAny(ReflectObject.j= ava:691) at tcl.lang.ReflectObject.get(ReflectObject.java:783) at tcl.lang.JavaInvoke.convertTclObject(JavaInvoke.java:819) at tcl.lang.JavaInvoke.call(JavaInvoke.java:225) at tcl.lang.JavaInvoke.callMethod(JavaInvoke.java:109) at tcl.lang.ReflectObject.cmdProc(ReflectObject.java:888) at tcl.lang.Interp.callCommand(Interp.java:1071) After some investigations, I found out a small script that behave almost = like my application : #!/home/crx005/mj42/debugTclBlend/local/bin/tclsh8.4 # Max size of the JVM heap : set tclblend_init "-Xmx200m" # Init the JVM : package require java java::import -package java.util ArrayList # JNI Panic : set valuesList [java::new ArrayList] set list2 {} for { set i 0 } { $i < 50000 } { incr i } { set list1 [ list \ nbx [$valuesList size] \ nbx [$valuesList size] \ nbx [$valuesList size] \ nbx [$valuesList size] \ nbx [$valuesList size] \ nbx [$valuesList size] \ nbx [$valuesList size] \ nbx [$valuesList size] \ nbx [$valuesList size] \ nbx [$valuesList size] ] puts "$i" lappend list2 $list1 } And the message after the crash is : JNI panic: native code passed a null object to a non-static method at tcl.lang.Interp.setResult(Native Method) at tcl.lang.ReflectObject.cmdProc(ReflectObject.java:888) at tcl.lang.Interp.callCommand(Interp.java:1071) Whatever method you called on the object (valuesList), the crash always h= appens within the same iteration. Other method calls, together (size and isEmpty for example) or not, or us= ing another object (for example Integer and intValue method) doesn't change the behavior. Moreover, the more the Java method is called, the faster the crash happen= s. For the first crash, when I look at the code tclBlend/src/native/javaObj.= c, function FreeTclObject, it seems impossible to call (*env)->CallVoidMethod(env, object, java.release); with a null object, be= cause this function is only called if object is not null. So, I tought, may be it was a problem with multi-thread and I decided to = try TclBlend 1.3.1. But the problem remains the same with TclBend 1.3.1 and 1.2.6 on Solaris = 2.6 and 2.8. Any idea ? Thanks. Environment : OS : Solaris 2.6 (SunOS crx120 5.6 Generic_105181-29 sun4u sparc SUNW,Ult= ra-4) and 2.8 (SunOS crx246 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-5_10) Tcl/Tk 8.3 and TclBlend 1.2.6 (+ my own patch to correct another bug : "t= cl.lang.TclRuntimeError: (find) table entry "analysis.dataset.Parameter.10023470" mapped to an invalid entry...") com= piled on Solaris 2.6 Tcl/Tk 8.4.6 + thread 2.5.2 extension and TclBlend 1.3.1 compiled on Sola= ris 2.6 Java 1.2.2 (Solaris VM (build Solaris_JDK_1.2.2_10, native threads, sunwj= it)) Compiler : gcc 3.2.1 (Configured with: ./configure --prefix=3D/soft/tools= --with-gnu-ld --with-gnu-as Thread model: posix) -- Jean-Fran=E7ois. |