Hi there,

for quite a few weeks I have been trying to trace down one particular
nasty problem with the new BSF4Rexx 4.0, which occurred only under Linux
so far (32- and 64-bit), but was able today to get it under Windows as
well.

It seems that this problem occurs under the following scenario:

    * there are RexxProxy Java objects that get finalized,
          o in the Java finalization method BSF4Rexx is informed about
            the Rexx object in form of a unique string value that can
            now be freed from BSF4Rexx as well
          o BSF4Rexx keeps a counter on proxied Rexx objects and
            maintains it; only if it drops to 0 will the proxied Rexx
            object be removed from a pinned down directory object, hence
            freeing a reference to it (and if it is the last reference
            it would be made elidgible for potential uninit processing)
                + it seems that at times, right in the middle of
                  processing this logic within BSF4Rexx, rexx.dll and
                  sometimes even kernel.dll causes an exception; if this
                  happens it happens on the Java finalizer daemon
                  thread; in theory it may be possible that the Java
                  finalizer thread is still running, although Rexx may
                  be terminated right in the middle of BSF4Rexx
                  processing a request, expecting Rexx to be available
                + the code in which this happens (the very first
                  statement that accesses a globally referred to/pinned
                  ooRexx directory object that is used to keep a
                  reference counter):

                          obj=rtc->SendMessage1(OREXX_REGISTRY_REFCOUNTER, 
"AT", obj_id);
                          

                  "rtc" got successfully used immediately before this,
                  checking with another globally referred to ooRexx
                  directory [rtc->SendMessage1(OREXX_REGISTRY,
                  "HASENTRY", obj_id)==rtc->True()]. Access to the
                  BSF4Rexx Rexx registry directories are serialized
                  using a mutex lock.
                  .

Here's the Java error log, giving some clues and pointing to the
finalizer thread (the debug output of BSF4Rexx contains too much detail,
but helped me to corner the problem, it also gives the TID which matches
the Java's error log thread id for the finalizer daemon), running the
release version of ooRexx 4.0.0:

    #
    # An unexpected error has been detected by HotSpot Virtual Machine:
    #
    #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00309c76, pid=5800, 
tid=4696
    #
    # Java VM: Java HotSpot(TM) Client VM (1.5.0_10-b03 mixed mode)
    # Problematic frame:
    # C  [rexx.dll+0x39c76]
    #

    ---------------  T H R E A D  ---------------

    Current thread (0x00f79db8):  JavaThread "Finalizer" daemon 
[_thread_in_native, id=4696]

    siginfo: ExceptionCode=0xc0000005, reading address 0xce964b10

    Registers:
    EAX=0x00000001, EBX=0x7d807228, ECX=0xd4457633, EDX=0x46c1d211
    ESP=0x0113f2e4, EBP=0x0113f444, ESI=0x46c1d211, EDI=0x7f5bfae8
    EIP=0x00309c76, EFLAGS=0x00010246

    Top of Stack: (sp=0x0113f2e4)
    0x0113f2e4:   7f5bfae8 7f244e88 0113f444 0113f3f0
    0x0113f2f4:   002e3605 00000009 05d65586 7f244e88
    0x0113f304:   7f5bfae8 0113f444 7f5bfae8 0113f400
    0x0113f314:   7c839ad8 7c809680 ffffffff 0031c368
    0x0113f324:   0113f3a4 0035d5a0 ffffffff 002e3791
    0x0113f334:   7f5bfae8 00000001 002e3740 0030f3d7
    0x0113f344:   7f5bfae8 003698ac 7f244e88 7f6c89d8
    0x0113f354:   00000000 00000014 00000001 00000000 

    Instructions: (pc=0x00309c76)
    0x00309c66:   8b 42 38 8b cf ff d0 33 d2 f7 f6 8b f2 8d 0c 76
    0x00309c76:   83 7c 8b 1c 00 74 2a 8d 49 00 8d 14 76 8b 4c 93 


    Stack: [0x010c0000,0x01140000),  sp=0x0113f2e4,  free space=508k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native 
code)
    C  [rexx.dll+0x39c76]
    C  [BSF4Rexx.dll+0x6742]
    C  [BSF4Rexx.dll+0x86ad]
    C  [BSF4Rexx.dll+0x84d0]
    C  [BSF4Rexx.dll+0x4744]
    j  
org.rexxla.bsf.engines.rexx.RexxAndJava.jniUnregisterRexxObject(Ljava/lang/String;)I+0
    j  org.rexxla.bsf.engines.rexx.RexxProxy.finalize()V+47
    v  ~StubRoutines::call_stub
    V  [jvm.dll+0x8757c]
    V  [jvm.dll+0xde804]
    V  [jvm.dll+0x8744d]
    V  [jvm.dll+0x8c82a]
    C  [java.dll+0x2006]
    j  java.lang.ref.Finalizer.runFinalizer()V+45
    j  java.lang.ref.Finalizer.access$100(Ljava/lang/ref/Finalizer;)V+1
    j  java.lang.ref.Finalizer$FinalizerThread.run()V+11
    v  ~StubRoutines::call_stub
    V  [jvm.dll+0x8757c]
    V  [jvm.dll+0xde804]
    V  [jvm.dll+0x8744d]
    V  [jvm.dll+0x871aa]
    V  [jvm.dll+0xa1de8]
    V  [jvm.dll+0x10fad4]
    V  [jvm.dll+0x10faa2]
    C  [msvcrt.dll+0x2a3b0]
    C  [kernel32.dll+0xb729]

    Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
    j  
org.rexxla.bsf.engines.rexx.RexxAndJava.jniUnregisterRexxObject(Ljava/lang/String;)I+0
    j  org.rexxla.bsf.engines.rexx.RexxProxy.finalize()V+47
    v  ~StubRoutines::call_stub
    j  java.lang.ref.Finalizer.invokeFinalizeMethod(Ljava/lang/Object;)V+0
    j  java.lang.ref.Finalizer.runFinalizer()V+45
    j  java.lang.ref.Finalizer.access$100(Ljava/lang/ref/Finalizer;)V+1
    j  java.lang.ref.Finalizer$FinalizerThread.run()V+11
    v  ~StubRoutines::call_stub

    ---------------  P R O C E S S  ---------------

    Java Threads: ( => current thread )
      0x00f858d0 JavaThread "Low Memory Detector" daemon [_thread_blocked, 
id=416]
      0x00f846a0 JavaThread "CompilerThread0" daemon [_thread_blocked, id=4324]
      0x00f83a20 JavaThread "Signal Dispatcher" daemon [_thread_blocked, 
id=4392]
    =>0x00f79db8 JavaThread "Finalizer" daemon [_thread_in_native, id=4696]
      0x00f79298 JavaThread "Reference Handler" daemon [_thread_blocked, id=444]
      0x003e7128 JavaThread "main" [_thread_in_native, id=5936]

    Other Threads:
      0x00f767e8 VMThread [id=5988]
      0x00f83978 WatcherThread [id=1268]

    VM state:not at safepoint (normal execution)

    VM Mutex/Monitor currently owned by a thread: None

    Heap
     def new generation   total 1152K, used 148K [0x03180000, 0x032c0000, 
0x03660000)
      eden space 1024K,   2% used [0x03180000, 0x03185288, 0x03280000)
      from space 128K,  99% used [0x03280000, 0x0329fff8, 0x032a0000)
      to   space 128K,   0% used [0x032a0000, 0x032a0000, 0x032c0000)
     tenured generation   total 14924K, used 3360K [0x03660000, 0x044f3000, 
0x07180000)
       the space 14924K,  22% used [0x03660000, 0x039a8008, 0x039a8200, 
0x044f3000)
     compacting perm gen  total 8192K, used 3767K [0x07180000, 0x07980000, 
0x0b180000)
       the space 8192K,  45% used [0x07180000, 0x0752dd58, 0x0752de00, 
0x07980000)
    No shared spaces configured.

    Dynamic libraries:
    0x00400000 - 0x00411000     D:\Programme\ooRexx\rexx.exe
    0x7c910000 - 0x7c9c9000     D:\WINDOWS\system32\ntdll.dll
    0x7c800000 - 0x7c908000     D:\WINDOWS\system32\kernel32.dll
    0x10000000 - 0x10025000     D:\Programme\ooRexx\REXXAPI.dll
    0x7e360000 - 0x7e3f1000     D:\WINDOWS\system32\USER32.dll
    0x77ef0000 - 0x77f39000     D:\WINDOWS\system32\GDI32.dll
    0x77da0000 - 0x77e4a000     D:\WINDOWS\system32\ADVAPI32.dll
    0x77e50000 - 0x77ee2000     D:\WINDOWS\system32\RPCRT4.dll
    0x77fc0000 - 0x77fd1000     D:\WINDOWS\system32\Secur32.dll
    0x71a30000 - 0x71a3a000     D:\WINDOWS\system32\WSOCK32.dll
    0x71a10000 - 0x71a27000     D:\WINDOWS\system32\WS2_32.dll
    0x77be0000 - 0x77c38000     D:\WINDOWS\system32\msvcrt.dll
    0x71a00000 - 0x71a08000     D:\WINDOWS\system32\WS2HELP.dll
    0x002d0000 - 0x003a7000     D:\Programme\ooRexx\rexx.dll
    0x7e670000 - 0x7ee91000     D:\WINDOWS\system32\SHELL32.dll
    0x77f40000 - 0x77fb6000     D:\WINDOWS\system32\SHLWAPI.dll
    0x76330000 - 0x7634d000     D:\WINDOWS\system32\IMM32.DLL
    0x62e10000 - 0x62e19000     D:\WINDOWS\system32\LPK.DLL
    0x75790000 - 0x757fb000     D:\WINDOWS\system32\USP10.dll
    0x773a0000 - 0x774a3000     
D:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\comctl32.dll
    0x636e0000 - 0x63709000     D:\Programme\Spyware Doctor\smumhook.dll
    0x770f0000 - 0x7717b000     D:\WINDOWS\system32\oleaut32.dll
    0x774b0000 - 0x775ed000     D:\WINDOWS\system32\ole32.dll
    0x76300000 - 0x76310000     D:\WINDOWS\system32\WINSTA.dll
    0x597d0000 - 0x59825000     D:\WINDOWS\system32\NETAPI32.dll
    0x6b1f0000 - 0x6b214000     D:\Programme\ooRexx\OREXXOLE.dll
    0x6b120000 - 0x6b155000     D:\Programme\ooRexx\rexxutil.dll
    0x72f70000 - 0x72f96000     D:\WINDOWS\system32\WINSPOOL.DRV
    0x719b0000 - 0x719f0000     D:\WINDOWS\system32\mswsock.dll
    0x66710000 - 0x66769000     D:\WINDOWS\system32\hnetcfg.dll
    0x719f0000 - 0x719f8000     D:\WINDOWS\System32\wshtcpip.dll
    0x76ee0000 - 0x76f07000     D:\WINDOWS\system32\DNSAPI.dll
    0x76f70000 - 0x76f78000     D:\WINDOWS\System32\winrnr.dll
    0x76f20000 - 0x76f4d000     D:\WINDOWS\system32\WLDAP32.dll
    0x750f0000 - 0x7510e000     D:\WINDOWS\system32\wshbth.dll
    0x778f0000 - 0x779e4000     D:\WINDOWS\system32\SETUPAPI.dll
    0x16080000 - 0x160a5000     D:\Programme\Bonjour\mdnsNSP.dll
    0x76d20000 - 0x76d39000     D:\WINDOWS\system32\Iphlpapi.dll
    0x76f80000 - 0x76f86000     D:\WINDOWS\system32\rasadhlp.dll
    0x77b10000 - 0x77b32000     D:\WINDOWS\system32\Apphelp.dll
    0x77bd0000 - 0x77bd8000     D:\WINDOWS\system32\VERSION.dll
    0x00b90000 - 0x00ba3000     D:\Programme\ooRexx\rxregexp.dll
    0x00c40000 - 0x00cc4000     E:\rony\dev\bsf\src\source_cc_40\BSF4Rexx.dll
    0x6d730000 - 0x6d8cc000     e:\jdk1.5.0_10\jre\bin\client\jvm.dll
    0x76af0000 - 0x76b1e000     D:\WINDOWS\system32\WINMM.dll
    0x5de80000 - 0x5de88000     D:\WINDOWS\system32\rdpsnd.dll
    0x76bb0000 - 0x76bbb000     D:\WINDOWS\system32\PSAPI.DLL
    0x6d2f0000 - 0x6d2f8000     e:\jdk1.5.0_10\jre\bin\hpi.dll
    0x6d700000 - 0x6d70c000     e:\jdk1.5.0_10\jre\bin\verify.dll
    0x6d370000 - 0x6d38d000     e:\jdk1.5.0_10\jre\bin\java.dll
    0x6d720000 - 0x6d72f000     e:\jdk1.5.0_10\jre\bin\zip.dll
    0x6d070000 - 0x6d1d9000     E:\jdk1.5.0_10\jre\bin\awt.dll
    0x746a0000 - 0x746ec000     D:\WINDOWS\system32\MSCTF.dll

    VM Arguments:
    java_command: <unknown>
    Launcher Type: generic

    Environment Variables:
    JAVA_HOME=E:\jdk1.5.0_10
    
CLASSPATH=e:\rony\dev\bsf\src;.;F:\download\java\asm\asm-3.2\lib\asm-3.2.jar;F:\download\java\asm\asm-3.2\lib\asm-util-3.2.jar;F:\download\java\asm\asm-3.2\lib\asm-analysis-3.2.jar;F:\download\java\asm\asm-3.2\lib\asm-commons-3.2.jar;F:\download\java\asm\asm-3.2\lib\asm-tree-3.2.jar;F:\download\java\asm\asm-3.2\lib\asm-xml-3.2.jar;e:\rony\dev\bsf\src;.;D:\Programme\Java\jre6\lib\ext\QTJava.zip;F:\work\svn\oorexx\test\releases\4.0.0\bsf4rexx\rgf\interfaceClasses;F:\work\svn\oorexx\test\releases\4.0.0\bsf4rexx\rgf\abstractClasses;F:\work\svn\oorexx\test\releases\4.0.0\bsf4rexx\rgf\extendNormalClasses
    
PATH=F:\work\svn\oorexx\test\releases\4.0.0\bin\WINDOWS;e:\jdk1.5.0_10\bin;.;E:\rony\dev\bsf\src\source_cc_40;E:\rony\dev\bsf\src\source_cc_40\rexx;E:\Programme\Microsoft
 Visual Studio 9.0\Common7\IDE;E:\Programme\Microsoft Visual Studio 
9.0\VC\BIN;E:\Programme\Microsoft Visual Studio 
9.0\Common7\Tools;D:\WINDOWS\Microsoft.NET\Framework\v3.5;D:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;E:\Programme\Microsoft
 Visual Studio 9.0\VC\VCPackages;D:\Programme\\Microsoft 
SDKs\Windows\v6.0A\bin;D:\WINDOWS\system32;D:\WINDOWS;D:\WINDOWS\System32\Wbem;e:\cygwin\bin;e:\rony\tools;E:\vslick\win;E:\Programme\GNU\GnuPG\pub;D:\Programme\Gemeinsame
 
Dateien\GTK\2.0\bin;D:\WINDOWS\system32;D:\WINDOWS;D:\WINDOWS\System32\Wbem;D:\Programme\TortoiseSVN\bin;D:\Programme\QuickTime\QTSystem\;D:\Programme\ooRexx;D:\Programme\SSH
 Communications Security\SSH Secure 
Shell;;F:\work\svn\oorexx\test\releases\4.0.0;F:\work\svn\oorexx\test\releases\4.0.0\framework;e:\jdk1.5.0_10\jre\bin\client;e:\rony\dev\bsf\src\bin
    USERNAME=Administrator
    OS=Windows_NT
    PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 6, GenuineIntel



    ---------------  S Y S T E M  ---------------

    OS: Windows XP Build 2600 Service Pack 3

    CPU:total 2 (cores per cpu 2, threads per core 1) family 6 model 15 
stepping 6, cmov, cx8, fxsr, mmx, sse, sse2

    Memory: 4k page, physical 2095176k(638064k free), swap 4034928k(2456664k 
free)

    vm_info: Java HotSpot(TM) Client VM (1.5.0_10-b03) for windows-x86, built 
on Nov  9 2006 13:13:34 by "java_re" with MS VC++ 6.0
      


Any ideas how to best deal with such a situation, how to best intercept
such an exception?

---rony

P.S.: It may be interesting to know that the above exception on Windows
XP SP 3 only occurs on a certain Java version: Java HotSpot(TM) Client
VM (build 1.5.0_10-b03, mixed mode). Of course, this may be just a
coincidence, Java 1.4 and 1.6 work flawlessly, even through stress tests.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to