EXCEPTION_FLT_STACK_CHECK

I have developed an application to manage a note acceptor. The manufacturer provided me a dll to communicate the device but my application is written in Java, so I developed the corresponding JNI to send the commands and obtain the answers.

On the other hand, the dll sends some events to indicate the status of the device, so I developed the corresponding inverse JNI to allow the Java application to do the corresponding operations when an event occurs.

If I use j2sdk1.4.2_05 I have no problem, but with jre1.6.0_01 application crashes and I obtain a file with the information bellow, even when events from C arrive to Java. Any idea?

#

# An unexpected error has been detected by Java Runtime Environment:

#

# EXCEPTION_FLT_STACK_CHECK (0xc0000092) at pc=0x0097ce69, pid=2964, tid=3168

#

# Java VM: Java HotSpot(TM) Client VM (1.6.0-b105 mixed mode)

# Problematic frame:

# v ~RuntimeStub::resolve_opt_virtual_call

#

# If you would like to submit a bug report, please visit:

#http://java.sun.com/webapps/bugreport/crash.jsp

#

T H R E A D

Current thread (0x0b4e4800): JavaThread "QueueControl(mode=1,suspended=false,jobs=0,regControls=[],claimOwner[])@1b59919" [_thread_in_Java, id=3168]

siginfo: ExceptionCode=0xc0000092, ExceptionInformation=0x00000000 0x1bf6ec24

Registers:

EAX=0x06b33dc0, EBX=0x06b33dc0, ECX=0x02a39810, EDX=0x02ed16d0

ESP=0x1bf6ebb8, EBP=0x1bf6ecc8, ESI=0x06ab0848, EDI=0x00b0d6a0

EIP=0x0097ce69, EFLAGS=0x00010216

Top of Stack: (sp=0x1bf6ebb8)

0x1bf6ebb8:ffff1372 ffff0000 ffffffff 0095b55f

0x1bf6ebc8:00c7001b 1bf6f6c4 ffff0023 6d937fbe

0x1bf6ebd8:00000000 085e0000 085e0000 1bc00000

0x1bf6ebe8:0b419400 0000085e 6788943c 0001003f

0x1bf6ebf8:9b000000 0b3fa308 1ba1eecc eed8eed0

0x1bf6ec08:00001ba1 0732003f 00000000 c0000000

0x1bf6ec18:00004000 00000000 3ffec000 0b486f6c

0x1bf6ec28:00000005 02a394c8 02a395e0 6d7d7e75

Instructions: (pc=0x0097ce69)

0x0097ce59:00 00 83 ec 6c dd 34 24 9b dd 24 24 dd 5c 24 6c

0x0097ce69:dd 5c 24 74 dd 5c 24 7c dd 9c 24 84 00 00 00 dd

Stack: [0x1bf20000,0x1bf70000), sp=0x1bf6ebb8, free space=314k

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)

v ~RuntimeStub::resolve_opt_virtual_call

J java.net.URL.<init>(Ljava/net/URL;Ljava/lang/String;)V

j sun.misc.URLClassPath$FileLoader.getResource(Ljava/lang/String;Z)Lsun/misc/Resource;+10

J sun.misc.URLClassPath.getResource(Ljava/lang/String;Z)Lsun/misc/Resource;

j java.net.URLClassLoader$1.run()Ljava/lang/Object;+26

v ~StubRoutines::call_stub

P R O C E S S

Java Threads: ( => current thread )

0x0ab07800 JavaThread "Thread-6" [_thread_in_native, id=3288]

0x0af02400 JavaThread "StatusEventQueue" [_thread_blocked, id=2676]

0x0ab04c00 JavaThread "OpEventQueue" [_thread_blocked, id=340]

0x0b4d3400 JavaThread "TimerQueue" daemon [_thread_blocked, id=2728]

0x0b497800 JavaThread "Support:EventQueue(listeners=Vector@1,events=Vector@1,eventBufferSize=1000)@169dd64" [_thread_blocked, id=1064]

0x0b4c6400 JavaThread "QueueControl(mode=1,suspended=false,jobs=0,regControls=[],claimOwner[])@ee20fe" [_thread_blocked, id=4052]

0x0b4acc00 JavaThread "com.jxfs.general.JxfsDeviceManager$DeviceKeyValueChangeDispatcher@75c78d" [_thread_blocked, id=3452]

0x0b486000 JavaThread "Support:EventQueue(listeners=Vector@1,events=Vector@1,eventBufferSize=1000)@650646" [_thread_blocked, id=3196]

=>0x0b4e4800 JavaThread "QueueControl(mode=1,suspended=false,jobs=0,regControls=[],claimOwner[])@1b59919" [_thread_in_Java, id=3168]

0x0b48f400 JavaThread "com.jxfs.general.JxfsDeviceManager$DeviceKeyValueChangeDispatcher@126ba64" [_thread_blocked, id=1576]

0x0b4a3400 JavaThread "Support:EventQueue(listeners=Vector@1,events=Vector@1,eventBufferSize=1000)@407166" [_thread_blocked, id=1648]

0x0b4ad400 JavaThread "QueueControl(mode=1,suspended=false,jobs=0,regControls=[],claimOwner[])@1e4905a" [_thread_blocked, id=3392]

0x0b498800 JavaThread "com.jxfs.general.JxfsDeviceManager$DeviceKeyValueChangeDispatcher@d402dd" [_thread_blocked, id=4056]

0x0b4c7400 JavaThread "Support:EventQueue(listeners=Vector@1,events=Vector@1,eventBufferSize=1000)@1e3a0ec" [_thread_blocked, id=1772]

0x0b48d400 JavaThread "QueueControl(mode=1,suspended=false,jobs=0,regControls=[],claimOwner[])@1e9d9b1" [_thread_blocked, id=2700]

0x0b491400 JavaThread "com.jxfs.general.JxfsDeviceManager$DeviceKeyValueChangeDispatcher@509df8" [_thread_blocked, id=2576]

0x0b4b1400 JavaThread "Support:EventQueue(listeners=Vector@1,events=Vector@1,eventBufferSize=1000)@10e1513" [_thread_blocked, id=1448]

0x0b4b0800 JavaThread "QueueControl(mode=1,suspended=false,jobs=0,regControls=[],claimOwner[])@93c4f1" [_thread_blocked, id=2548]

0x0b4ae400 JavaThread "com.jxfs.general.JxfsDeviceManager$DeviceKeyValueChangeDispatcher@1dbb27d" [_thread_blocked, id=2212]

0x0b4b7800 JavaThread "Support:EventQueue(listeners=Vector@1,events=Vector@1,eventBufferSize=1000)@705d28" [_thread_blocked, id=2236]

0x0b4b3c00 JavaThread "QueueControl(mode=1,suspended=false,jobs=0,regControls=[],claimOwner[])@72d873" [_thread_blocked, id=2876]

0x0b46c400 JavaThread "com.jxfs.general.JxfsDeviceManager$DeviceKeyValueChangeDispatcher@18782a7" [_thread_blocked, id=1904]

0x0b447c00 JavaThread "Thread-4" [_thread_blocked, id=3364]

0x0b437400 JavaThread "Repository Writer of FileDictionary" [_thread_blocked, id=2672]

0x0b43b400 JavaThread "com.jxfs.forum.repository.KeyChangeDispatcher@1b11b79" [_thread_blocked, id=2264]

0x003f7800 JavaThread "DestroyJavaVM" [_thread_blocked, id=2956]

0x0b442800 JavaThread "com.jxfs.general.JxfsDeviceManager$StatusDispatcher@1682a53" [_thread_blocked, id=164]

0x0b42bc00 JavaThread "com.jxfs.general.JxfsDeviceManager$KeyValueChangeDispatcher@dac21" [_thread_blocked, id=2248]

0x0b40f800 JavaThread "com.jxfs.general.JxfsLogger$DeliverMsgs@9b688e" [_thread_blocked, id=1268]

0x0ae7a800 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=2156]

0x0ae85400 JavaThread "AWT-Windows" daemon [_thread_in_native, id=208]

0x0ae84800 JavaThread "AWT-Shutdown" [_thread_blocked, id=2712]

0x0ab23000 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=2796]

0x0aafe800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3968]

0x0aaf9c00 JavaThread "CompilerThread0" daemon [_thread_blocked, id=2820]

0x0aaf8800 JavaThread "Attach Listener" daemon [_thread_blocked, id=2244]

0x0aaf7c00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2808]

0x0aae8000 JavaThread "Finalizer" daemon [_thread_blocked, id=2800]

0x0aae3c00 JavaThread "Reference Handler" daemon [_thread_blocked, id=2944]

Other Threads:

0x0aae0800 VMThread [id=2908]

0x0ab19400 WatcherThread [id=2812]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap

def new generationtotal 960K, used 467K [0x029d0000, 0x02ad0000, 0x02eb0000)

eden

[error occurred during error reporting, step 190, id 0xc0000092]

Dynamic libraries:

0x00400000 - 0x00423000 C:\JVM\jdk1.6.0\bin\javaw.exe

0x7c910000 - 0x7c9c6000 C:\WINDOWS\system32\ntdll.dll

0x7c800000 - 0x7c901000 C:\WINDOWS\system32\kernel32.dll

0x77da0000 - 0x77e4c000 C:\WINDOWS\system32\ADVAPI32.dll

0x77e50000 - 0x77ee1000 C:\WINDOWS\system32\RPCRT4.dll

0x7e390000 - 0x7e420000 C:\WINDOWS\system32\USER32.dll

0x77ef0000 - 0x77f37000 C:\WINDOWS\system32\GDI32.dll

0x76340000 - 0x7635d000 C:\WINDOWS\system32\IMM32.DLL

0x62e30000 - 0x62e39000 C:\WINDOWS\system32\LPK.DLL

0x74d20000 - 0x74d8b000 C:\WINDOWS\system32\USP10.dll

0x77be0000 - 0x77c38000 C:\WINDOWS\system32\msvcrt.dll

0x7c340000 - 0x7c396000 C:\JVM\jdk1.6.0\jre\bin\msvcr71.dll

0x6d7c0000 - 0x6da07000 C:\JVM\jdk1.6.0\jre\bin\client\jvm.dll

0x76b00000 - 0x76b2e000 C:\WINDOWS\system32\WINMM.dll

0x6d310000 - 0x6d318000 C:\JVM\jdk1.6.0\jre\bin\hpi.dll

0x76bb0000 - 0x76bbb000 C:\WINDOWS\system32\PSAPI.DLL

0x6d770000 - 0x6d77c000 C:\JVM\jdk1.6.0\jre\bin\verify.dll

0x6d3b0000 - 0x6d3cf000 C:\JVM\jdk1.6.0\jre\bin\java.dll

0x6d7b0000 - 0x6d7bf000 C:\JVM\jdk1.6.0\jre\bin\zip.dll

0x6d000000 - 0x6d1c3000 C:\JVM\jdk1.6.0\jre\bin\awt.dll

0x72f80000 - 0x72fa6000 C:\WINDOWS\system32\WINSPOOL.DRV

0x774b0000 - 0x775ed000 C:\WINDOWS\system32\ole32.dll

0x5b150000 - 0x5b188000 C:\WINDOWS\system32\uxtheme.dll

0x736e0000 - 0x73729000 C:\WINDOWS\system32\ddraw.dll

0x73b40000 - 0x73b46000 C:\WINDOWS\system32\DCIMAN32.dll

0x746b0000 - 0x746fb000 C:\WINDOWS\system32\MSCTF.dll

0x75160000 - 0x7518e000 C:\WINDOWS\system32\msctfime.ime

0x7c9d0000 - 0x7d1ef000 C:\WINDOWS\system32\shell32.dll

0x77f40000 - 0x77fb6000 C:\WINDOWS\system32\SHLWAPI.dll

0x773a0000 - 0x774a3000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll

0x58c30000 - 0x58cca000 C:\WINDOWS\system32\comctl32.dll

0x6d2b0000 - 0x6d303000 C:\JVM\jdk1.6.0\jre\bin\fontmanager.dll

0x6d570000 - 0x6d583000 C:\JVM\jdk1.6.0\jre\bin\net.dll

0x71a30000 - 0x71a47000 C:\WINDOWS\system32\WS2_32.dll

0x71a20000 - 0x71a28000 C:\WINDOWS\system32\WS2HELP.dll

0x6d590000 - 0x6d599000 C:\JVM\jdk1.6.0\jre\bin\nio.dll

0x6d450000 - 0x6d474000 C:\JVM\jdk1.6.0\jre\bin\jpeg.dll

0x0b780000 - 0x0b7a3000 C:\Archivos de programa\Babylon\Babylon-Pro\CAPTLIB.DLL

0x770f0000 - 0x7717c000 C:\WINDOWS\system32\OLEAUT32.dll

0x74c10000 - 0x74c3c000 C:\WINDOWS\system32\OLEACC.dll

0x76030000 - 0x76095000 C:\WINDOWS\system32\MSVCP60.dll

0x1b9d0000 - 0x1ba0f000 C:\WINDOWS\system32\BNA5.dll

0x1c4b0000 - 0x1c54d000 C:\WINDOWS\system32\BNA5Ctl.dll

0x5f1f0000 - 0x5f207000 C:\WINDOWS\system32\olepro32.dll

VM Arguments:

jvm_args: -DGlobalHelp=DtgHelp.hs

java_command: com.dtg.jxfs.tools.test.JxfsTest C:\Views\nperales_JXFS21P\JXFS_System\JXFS\src\jxfs\..\..\..\..\GLOBALDS\ C:\Views\nperales_JXFS21P\JXFS_System\JXFS\src\jxfs\..\..\..\..\GLOBALDS\Tester\Test.properties

Launcher Type: SUN_STANDARD

Environment Variables:

CLASSPATH=C:\Archivos de programa\Java\jre1.5.0_05\lib\ext\QTJava.zip;C:\Archivos de programa\Rational\ClearQuest\cqjni.jar

PATH=C:\Archivos de programa\Archivos comunes\Unisys\ImageSecurity\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Archivos de programa\UltraEdit;C:\Archivos de programa\QuickTime\QTSystem\;C:\Archivos de programa\Rational\ClearCase\bin;C:\Archivos de programa\Rational\common

USERNAME=nperales

OS=Windows_NT

PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 1, GenuineIntel

S Y S T E M

OS: Windows XP Build 2600 Service Pack 2

CPU:total 1 family 15, cmov, cx8, fxsr, mmx, sse, sse2, ht

Memory: 4k page, physical 1562696k(619700k free), swap 2970100k(2239440k free)

vm_info: Java HotSpot(TM) Client VM (1.6.0-b105) for windows-x86, built on Nov 29 2006 00:48:48 by "java_re" with unknown MS VC++:1310

[11544 byte] By [napsproga] at [2007-11-27 6:26:52]
# 1

Hi,

Maybe the 3rd party DLL is compiled with a Borland compiler which mess with the floating point register of the processor. This is not supported under Java.

To solve your problem you may add that option to the command line : -Xcheck:jni

I have done a piece of code to restore the register but it does not always work.

/* 80(x)87 Control Word Mask and bit definitions. */

private final static int _MCW_EM = 0x003f; /* Interrupt Exception Masks */

//private final static int _EM_INVALID= 0x0001; /*invalid */

//private final static int _EM_DENORMAL= 0x0002; /*denormal */

//private final static int _EM_ZERODIVIDE = 0x0004; /*zero divide */

//private final static int _EM_OVERFLOW= 0x0008; /*overflow */

//private final static int _EM_UNDERFLOW= 0x0010; /*underflow */

//private final static int _EM_INEXACT= 0x0020; /*inexact result - precision */

private final static int _MCW_PC = 0x0300; /* Precision Control */

//private final static int _PC_24 = 0x0000; /*24 bits */

private final static int _PC_53 = 0x0200; /*53 bits */

//private final static int _PC_64 = 0x0300; /*64 bits */

private final static int _MCW_RC=0x0c00; /* Rounding Control */

private final static int _RC_NEAR=0x0000; /*near */

//private final static int _RC_DOWN=0x0400; /*down */

//private final static int _RC_UP=0x0800; /*up */

//private final static int _RC_CHOP=0x0c00; /*chop */

try {

//_control87(_MCW_EM | _RC_NEAR | _PC_53, _MCW_EM | _MCW_RC | _MCW_PC);

JNative _control87 = new JNative("crtdll.dll", "_control87");

_control87.setRetVal(Type.INT);

_control87.setParameter(0, _MCW_EM | _RC_NEAR | _PC_53);

_control87.setParameter(1, _MCW_EM | _MCW_RC | _MCW_PC);

_control87.invoke();

System.err.println("_control87() returned "+_control87.getRetValAsInt());

} catch (Throwable e) {

e.printStackTrace();

}

--Marc (http://jnative.sf.net)

mdentya at 2007-7-12 17:48:20 > top of Java-index,Java HotSpot Virtual Machine,Specifications...