Opened 13 years ago

Closed 12 years ago

#1841 closed defect (fixed)

JVM crash always in line edu.umn.gis.mapscript.mapscriptJNI.delete_classObj

Reported by: info@… Owned by: unicoletti
Priority: high Milestone:
Component: MapScript-Java Version: 4.8
Severity: normal Keywords:
Cc:

Description

In my code i am creating classObj , styleObj etc.
some times i get the following exception (always in 
edu.umn.gis.mapscript.mapscriptJNI.delete_classObj(J)V+0 this line) i think it 
is when the garbage collector is call:

#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x1000cde6, pid=2428, tid=1224
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_04-b05 mixed mode)
# Problematic frame:
# C  [mapscript.dll+0xcde6]
#

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

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

siginfo: ExceptionCode=0xc0000005, reading address 0x0ccda080

Registers:
EAX=0x0ccd9f58, EBX=0x072e9478, ECX=0x0ccd9f58, EDX=0x072fdf78
ESP=0x0ab7ee50, EBP=0x0ab7ee50, ESI=0x072e9478, EDI=0x00961190
EIP=0x1000cde6, EFLAGS=0x00010216

Top of Stack: (sp=0x0ab7ee50)
0x0ab7ee50:   0ab7f6b0 1000cc7f 0ccd9f58 00000000
0x0ab7ee60:   00000000 00000000 00000000 00000000
0x0ab7ee70:   00000000 00000000 00000000 00000000
0x0ab7ee80:   00000000 00000000 00000000 00000000
0x0ab7ee90:   00000000 00000000 00000000 00000000
0x0ab7eea0:   00000000 00000000 00000000 00000000
0x0ab7eeb0:   00000000 00000000 00000000 00000000
0x0ab7eec0:   00000000 00000000 00000000 00000000 

Instructions: (pc=0x1000cde6)
0x1000cdd6:   cc cc cc cc cc cc cc cc cc cc 55 8b ec 8b 45 08
0x1000cde6:   83 b8 28 01 00 00 00 75 19 8b 4d 08 51 e8 ba 26 


Stack: [0x0ab40000,0x0ab80000),  sp=0x0ab7ee50,  free space=251k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [mapscript.dll+0xcde6]
C  [mapscript.dll+0xcc7f]
j  edu.umn.gis.mapscript.mapscriptJNI.delete_classObj(J)V+0
j  edu.umn.gis.mapscript.classObj.delete()V+25
j  edu.umn.gis.mapscript.classObj.finalize()V+1
v  ~StubRoutines::call_stub
V  [jvm.dll+0x82696]
V  [jvm.dll+0xd6fd9]
V  [jvm.dll+0x82567]
V  [jvm.dll+0x87919]
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+0x82696]
V  [jvm.dll+0xd6fd9]
V  [jvm.dll+0x82567]
V  [jvm.dll+0x822c4]
V  [jvm.dll+0x9d216]
V  [jvm.dll+0x101489]
V  [jvm.dll+0x101457]
C  [MSVCRT.dll+0x2a3b0]
C  [kernel32.dll+0xb50b]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  edu.umn.gis.mapscript.mapscriptJNI.delete_classObj(J)V+0
j  edu.umn.gis.mapscript.classObj.delete()V+25
j  edu.umn.gis.mapscript.classObj.finalize()V+1
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 )
  0x0afcf670 JavaThread "TP-Monitor" daemon [_thread_blocked, id=3752]
  0x0b02fe88 JavaThread "TP-Processor4" daemon [_thread_in_native, id=3724]
  0x0ae778f0 JavaThread "TP-Processor3" daemon [_thread_blocked, id=1952]
  0x0af0eb08 JavaThread "TP-Processor2" daemon [_thread_blocked, id=3720]
  0x0afe7760 JavaThread "TP-Processor1" daemon [_thread_blocked, id=3880]
  0x0af36f08 JavaThread "http-8081-Monitor" [_thread_blocked, id=2152]
  0x0af36478 JavaThread "http-8081-Processor25" daemon [_thread_in_vm, id=4020]
  0x0b0bce78 JavaThread "http-8081-Processor24" daemon [_thread_in_native, 
id=2760]
  0x0b0bc328 JavaThread "http-8081-Processor23" daemon [_thread_blocked, 
id=428]
  0x0b0bb808 JavaThread "http-8081-Processor22" daemon [_thread_blocked, 
id=3432]
  0x0b076568 JavaThread "http-8081-Processor21" daemon [_thread_blocked, 
id=3920]
  0x0b075a30 JavaThread "http-8081-Processor20" daemon [_thread_blocked, 
id=1972]
  0x0b074fa0 JavaThread "http-8081-Processor19" daemon [_thread_blocked, 
id=512]
  0x0b07a280 JavaThread "http-8081-Processor18" daemon [_thread_blocked, 
id=708]
  0x0b079758 JavaThread "http-8081-Processor17" daemon [_thread_blocked, 
id=2776]
  0x0b078c30 JavaThread "http-8081-Processor16" daemon [_thread_blocked, 
id=2560]
  0x0b078168 JavaThread "http-8081-Processor15" daemon [_thread_blocked, 
id=2248]
  0x0b02e3e0 JavaThread "http-8081-Processor14" daemon [_thread_blocked, 
id=844]
  0x0b02e178 JavaThread "http-8081-Processor13" daemon [_thread_blocked, 
id=1036]
  0x0b02ba60 JavaThread "http-8081-Processor12" daemon [_thread_blocked, 
id=2932]
  0x0b02b008 JavaThread "http-8081-Processor11" daemon [_thread_blocked, 
id=2800]
  0x0b151410 JavaThread "http-8081-Processor10" daemon [_thread_blocked, 
id=2740]
  0x0b150940 JavaThread "http-8081-Processor9" daemon [_thread_blocked, 
id=3104]
  0x0b14fe88 JavaThread "http-8081-Processor8" daemon [_thread_blocked, id=336]
  0x0b14f418 JavaThread "http-8081-Processor7" daemon [_thread_blocked, 
id=1076]
  0x0b0866a0 JavaThread "http-8081-Processor6" daemon [_thread_blocked, id=408]
  0x0b03a2b0 JavaThread "http-8081-Processor5" daemon [_thread_blocked, id=192]
  0x0b03a130 JavaThread "http-8081-Processor4" daemon [_thread_blocked, 
id=3016]
  0x0b030028 JavaThread "http-8081-Processor3" daemon [_thread_blocked, 
id=3140]
  0x0b072558 JavaThread "http-8081-Processor2" daemon [_thread_blocked, 
id=3480]
  0x0ae77f00 JavaThread "http-8081-Processor1" daemon [_thread_blocked, 
id=2400]
  0x0b1c51f8 JavaThread "ContainerBackgroundProcessor[StandardEngine
[Catalina]]" daemon [_thread_blocked, id=3604]
  0x00976c10 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=228]
  0x00975220 JavaThread "CompilerThread0" daemon [_thread_blocked, id=1260]
  0x00974580 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3240]
  0x00971790 JavaThread "JDWP Command Reader" daemon [_thread_in_native, 
id=3776]
  0x009708e8 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, 
id=2948]
  0x0096eff8 JavaThread "JDWP Transport Listener: dt_socket" daemon 
[_thread_blocked, id=2388]
=>0x00961190 JavaThread "Finalizer" daemon [_thread_in_native, id=1224]
  0x0095fd00 JavaThread "Reference Handler" daemon [_thread_blocked, id=2624]
  0x003a76f0 JavaThread "main" [_thread_in_native, id=1200]

Other Threads:
  0x0095dd58 VMThread [id=3876]
  0x00977e38 WatcherThread [id=1432]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 def new generation   total 576K, used 73K [0x02a20000, 0x02ac0000, 0x02f00000)
  eden space 512K,   1% used [0x02a20000, 0x02a225a8, 0x02aa0000)
  from space 64K, 100% used [0x02aa0000, 0x02ab0000, 0x02ab0000)
  to   space 64K,   0% used [0x02ab0000, 0x02ab0000, 0x02ac0000)
 tenured generation   total 5140K, used 5115K [0x02f00000, 0x03405000, 
0x06a20000)
   the space 5140K,  99% used [0x02f00000, 0x033fec48, 0x033fee00, 0x03405000)
 compacting perm gen  total 9472K, used 9262K [0x06a20000, 0x07360000, 
0x0aa20000)
   the space 9472K,  97% used [0x06a20000, 0x0732b960, 0x0732ba00, 0x07360000)
No shared spaces configured.

Dynamic libraries:
0x00400000 - 0x0040c000 	C:\JDK1.5.0_04\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
0x77d10000 - 0x77da0000 	C:\WINDOWS\system32\USER32.dll
0x77ef0000 - 0x77f37000 	C:\WINDOWS\system32\GDI32.dll
0x77be0000 - 0x77c38000 	C:\WINDOWS\system32\MSVCRT.dll
0x6d6b0000 - 0x6d839000 	C:\JDK1.5.0_04\jre\bin\client\jvm.dll
0x76b00000 - 0x76b2e000 	C:\WINDOWS\system32\WINMM.dll
0x5d160000 - 0x5d167000 	C:\WINDOWS\system32\serwvdrv.dll
0x5b480000 - 0x5b487000 	C:\WINDOWS\system32\umdmxfrm.dll
0x6d2f0000 - 0x6d2f8000 	C:\JDK1.5.0_04\jre\bin\hpi.dll
0x76bb0000 - 0x76bbb000 	C:\WINDOWS\system32\PSAPI.DLL
0x6d3f0000 - 0x6d425000 	C:\JDK1.5.0_04\jre\bin\jdwp.dll
0x6d680000 - 0x6d68c000 	C:\JDK1.5.0_04\jre\bin\verify.dll
0x6d370000 - 0x6d38d000 	C:\JDK1.5.0_04\jre\bin\java.dll
0x6d6a0000 - 0x6d6af000 	C:\JDK1.5.0_04\jre\bin\zip.dll
0x6d290000 - 0x6d297000 	C:\JDK1.5.0_04\jre\bin\dt_socket.dll
0x71a30000 - 0x71a47000 	C:\WINDOWS\system32\WS2_32.dll
0x71a20000 - 0x71a28000 	C:\WINDOWS\system32\WS2HELP.dll
0x719d0000 - 0x71a10000 	C:\WINDOWS\System32\mswsock.dll
0x76ee0000 - 0x76f07000 	C:\WINDOWS\system32\DNSAPI.dll
0x76f70000 - 0x76f78000 	C:\WINDOWS\System32\winrnr.dll
0x76f20000 - 0x76f4d000 	C:\WINDOWS\system32\WLDAP32.dll
0x76f80000 - 0x76f86000 	C:\WINDOWS\system32\rasadhlp.dll
0x66740000 - 0x66799000 	C:\WINDOWS\system32\hnetcfg.dll
0x71a10000 - 0x71a18000 	C:\WINDOWS\System32\wshtcpip.dll
0x6d530000 - 0x6d543000 	C:\JDK1.5.0_04\jre\bin\net.dll
0x10000000 - 0x1008f000 	C:\ms4w\Apache\cgi-bin\mapscript.dll
0x0bb70000 - 0x0be47000 	C:\ms4w\Apache\cgi-bin\libmap.dll
0x0be50000 - 0x0be62000 	C:\ms4w\Apache\cgi-bin\zlib1.dll
0x0be70000 - 0x0bea6000 	C:\ms4w\Apache\cgi-bin\proj.dll
0x7c340000 - 0x7c396000 	C:\WINDOWS\system32\MSVCR71.dll
0x0beb0000 - 0x0c340000 	C:\ms4w\Apache\cgi-bin\gdal13.dll
0x12000000 - 0x121ad000 	C:\ms4w\Apache\cgi-bin\xerces-c_2_7.dll
0x0c340000 - 0x0c35a000 	C:\ms4w\Apache\cgi-bin\LIBPQ.dll
0x71a50000 - 0x71a5a000 	C:\WINDOWS\system32\WSOCK32.dll
0x76740000 - 0x76749000 	C:\WINDOWS\system32\SHFOLDER.dll
0x745e0000 - 0x7461d000 	C:\WINDOWS\system32\ODBC32.dll
0x58c30000 - 0x58cc7000 	C:\WINDOWS\system32\COMCTL32.dll
0x7c9d0000 - 0x7d1ef000 	C:\WINDOWS\system32\SHELL32.dll
0x77f40000 - 0x77fb6000 	C:\WINDOWS\system32\SHLWAPI.dll
0x76360000 - 0x763aa000 	C:\WINDOWS\system32\comdlg32.dll
0x39d00000 - 0x39e19000 	C:\ms4w\Apache\cgi-bin\libecwj2.dll
0x76c50000 - 0x76c78000 	C:\WINDOWS\system32\imagehlp.dll
0x77bd0000 - 0x77bd8000 	C:\WINDOWS\system32\VERSION.dll
0x77a50000 - 0x77ae5000 	C:\WINDOWS\system32\CRYPT32.dll
0x77af0000 - 0x77b02000 	C:\WINDOWS\system32\MSASN1.dll
0x774b0000 - 0x775ed000 	C:\WINDOWS\system32\ole32.dll
0x7c3a0000 - 0x7c41b000 	C:\WINDOWS\system32\MSVCP71.dll
0x0c360000 - 0x0c53e000 	C:\ms4w\Apache\cgi-bin\lti_dsdk_dll.dll
0x0c540000 - 0x0c560000 	C:\ms4w\Apache\cgi-bin\geotiff.dll
0x0c560000 - 0x0c5f8000 	C:\ms4w\Apache\cgi-bin\libtiff.dll
0x0c600000 - 0x0c741000 	C:\ms4w\Apache\cgi-bin\LIBMYSQL.dll
0x770f0000 - 0x7717c000 	C:\WINDOWS\system32\OLEAUT32.dll
0x0c750000 - 0x0c77b000 	C:\ms4w\Apache\cgi-bin\libcurl.dll
0x0c780000 - 0x0c887000 	C:\ms4w\Apache\cgi-bin\LIBEAY32.dll
0x0c890000 - 0x0c8c1000 	C:\ms4w\Apache\cgi-bin\SSLEAY32.dll
0x55300000 - 0x5542a000 	C:\ms4w\Apache\cgi-bin\pdflib.dll
0x0c8d0000 - 0x0c9e4000 	C:\ms4w\Apache\cgi-bin\iconv.dll
0x773a0000 - 0x774a2000 	C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-
Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll
0x20000000 - 0x20018000 	C:\WINDOWS\system32\odbcint.dll

VM Arguments:
jvm_args: -Dcatalina.home=C:\desarrollo\Tomcat 5.0 -
Dcatalina.base=C:\desarrollo\Tomcat 5.0 -
Djava.endorsed.dirs=C:\desarrollo\Tomcat 5.0/common/endorsed -
Djava.io.tmpdir=C:\desarrollo\Tomcat 5.0\temp -
Djava.library.path=C:\JDK1.5.0_04\bin;C:\desarrollo\Tomcat 5.0\bin -
Dsun.io.useCanonCaches=false -Djava.library.path=C:/ms4w/Apache/cgi-bin/ -
Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,suspend=y,address=localhost:2051
java_command: org.apache.catalina.startup.Bootstrap start

Environment Variables:
JAVA_HOME=C:\JDK1.5.0_04
CLASSPATH=.;.;C:\ARCHIV~1\JMF21~1.1E\lib\sound.jar;C:\ARCHIV~1
\JMF21~1.1E\lib\jmf.jar;C:\ARCHIV~1\JMF21~1.1E\lib;€w}mystemroot\java\classes;.
PATH=C:\JDK1.5.0_04\bin;C:\oracle\ora92\bin;C:\Archivos de 
programa\Oracle\jre\1.3.1\bin;C:\Archivos de programa\Oracle\jre\1.1.8
\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Archivos de 
programa\ATI Technologies\ATI Control Panel;C:\Archivos de programa\Archivos 
comunes\Adaptec Shared\System;C:\desarrollo\Sun\jstudio_ent8\AppServ8.1UR2
\bin;C:\desarrollo\Sun\jstudio_ent8\ide\uml1
\modules\DoorsIntegrationFiles\modules\bin;C:\ms4w\Apache\cgi-bin
USERNAME=Santiago Atella
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 2 Stepping 7, 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 752624k(266996k free), swap 1844812k(1438408k free)

vm_info: Java HotSpot(TM) Client VM (1.5.0_04-b05) for windows-x86, built on 
Jun  3 2005 02:10:41 by "java_re" with MS VC++ 6.0

Change History (7)

comment:1 Changed 13 years ago by unicoletti

I need more info to take action. See the 'What to do if mapscript crashes'
section at: http://mapserver.gis.umn.edu/docs/howto/javamapscript

I also need some code to reproduce and test the bug.

comment:2 Changed 13 years ago by info@…

Windows XP service Pack 2.
mapserver : ms4w 4.1
java version :1.5.0_04-b05 


I call the following function several times in my application (vehicle is an 
object with the vehicle data)

//open the postgis layer
layer.open();
//create and add to the layer the new class
classObj clase = new classObj(layer);
clase.setName(vehicle.getId());
clase.setTemplate(vehicle.getTemplate());
//SET THE POSTGIS expression
clase.setExpression("(" + vehicle.getFieldName() + "=" + vehicle.getId() +")");
			
//create the symbol
symbolObj symbol = new symbolObj(vehicle.getId(),vehicle.getSymbolPath());
map.getSymbolset().appendSymbol(symbol);
styleObj style = new styleObj(clase);
style.setSymbol(map.getSymbolset().index(vehicle.getId()));
		
//IF I REMOVE THIS LINE THE JVM CRASH
       symbol.delete();
       style.delete();
       clase.delete();
//END
layer.close();

comment:3 Changed 13 years ago by szekerest

I would suggest to visit
http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1743

This is the similar problem has been fixed for C#.


comment:4 Changed 13 years ago by unicoletti

Do you experience the crash also with the following lines commented out?

       symbol.delete();
       style.delete();
       clase.delete();

You don't need to open/close the layer, unless you are querying it.


comment:5 Changed 13 years ago by info@…

With this lines the problem is solved.

Santiago

comment:6 Changed 13 years ago by hiver.sanglant@…

I am meeting this problem, too.

The problem occurs since i use "classObj" and "styleObj" in java code (outside 
of a ".map" file).

JVM always crashes while deleting these objects, ie:

j  edu.umn.gis.mapscript.mapscriptJNI.delete_layerObj(J)V+0
j  edu.umn.gis.mapscript.layerObj.delete()V+25
j  edu.umn.gis.mapscript.layerObj.finalize()V+1

This is a "random" behavior, so i think it's caused by garbage collector.

Deleting the objects in java code (the three lines you wrote: "(...)
clase.delete()") don't solve thhe problem, but it happens less often...




comment:7 Changed 12 years ago by unicoletti

Resolution: fixed
Status: newclosed

We are addressing this issue globally in RFC-24, which will be ready for mapserver 5.

Note: See TracTickets for help on using tickets.