Opened 15 years ago

Closed 13 years ago

#3032 closed defect (fixed)

Java tests in the trunk are crashing on Windows/Linux

Reported by: tamas Owned by: unicoletti
Priority: normal Milestone:
Component: MapScript-Java Version: unspecified
Severity: normal Keywords:
Cc:

Description

Here is the java crashlog I encounter in the recent days when running the java tests:

# # An unexpected error has been detected by Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7d6210e8, pid=26312, tid=88332 # # Java VM: Java HotSpot(TM) Client VM (11.2-b01 mixed mode, sharing windows-x86) # Problematic frame: # C [ntdll.dll+0x210e8] # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. #


Current thread (0x03e14800): JavaThread "Finalizer" daemon [_thread_in_native, id=88332, stack(0x04010000,0x04060000)]

siginfo: ExceptionCode=0xc0000005, reading address 0xbff00000

Registers: EAX=0x03ee6208, EBX=0x003d0000, ECX=0xbff00000, EDX=0x00000000 ESP=0x0405d674, EBP=0x0405d680, ESI=0x03ee6200, EDI=0x03ee6540 EIP=0x7d6210e8, EFLAGS=0x00010246

Top of Stack: (sp=0x0405d674) 0x0405d674: 003d0000 03ee6540 00000000 0405d768 0x0405d684: 7d620ec5 bff00000 03ee6540 0405d748 0x0405d694: 00000000 00000022 03ee6548 00000001 0x0405d6a4: 7d61f60d 03edefc8 03ecafa8 03edefd0 0x0405d6b4: 7d61f60d 03ec1434 03ed5cc0 00000001 0x0405d6c4: 03ece4f0 03ed55e0 7d61f60d 03ed5230 0x0405d6d4: 03ed4c88 003d0178 7c342151 003d01b0 0x0405d6e4: 03edd7a8 00000000 03edb8e0 003d0178

Instructions: (pc=0x7d6210e8) 0x7d6210d8: 85 ad 53 03 00 8b 4e 0c 8d 46 08 8b 10 89 4d 08 0x7d6210e8: 8b 09 3b 4a 04 89 55 0c 0f 85 f2 26 00 00 3b c8

Stack: [0x04010000,0x04060000], sp=0x0405d674, free space=309k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [ntdll.dll+0x210e8] C [ntdll.dll+0x20ec5] C [msvcr71.dll+0x218a] C [libmap.dll+0xd93c5] C [mapscript.dll+0x23d63] j edu.umn.gis.mapscript.mapscriptJNI.delete_mapObj(J)V+0 j edu.umn.gis.mapscript.mapObj.delete()V+25 j edu.umn.gis.mapscript.mapObj.finalize()V+1 v ~StubRoutines::call_stub

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j edu.umn.gis.mapscript.mapscriptJNI.delete_mapObj(J)V+0 j edu.umn.gis.mapscript.mapObj.delete()V+25 j edu.umn.gis.mapscript.mapObj.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


Java Threads: ( => current thread )

0x03e5c000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=37284, stack(0x04250000,0x042a0000)] 0x03e55800 JavaThread "CompilerThread0" daemon [_thread_blocked, id=27980, stack(0x041c0000,0x04210000)] 0x03e54000 JavaThread "Attach Listener" daemon [_thread_blocked, id=14060, stack(0x04130000,0x04180000)] 0x03e52c00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=9884, stack(0x040a0000,0x040f0000)]

=>0x03e14800 JavaThread "Finalizer" daemon [_thread_in_native, id=88332, stack(0x04010000,0x04060000)]

0x03e0fc00 JavaThread "Reference Handler" daemon [_thread_blocked, id=76976, stack(0x03f80000,0x03fd0000)] 0x003d7400 JavaThread "main" [_thread_in_native, id=75004, stack(0x01bf0000,0x01c40000)]

Other Threads:

0x03e0e400 VMThread [stack: 0x03ef0000,0x03f40000] [id=75152] 0x03e5d800 WatcherThread [stack: 0x042e0000,0x04330000] [id=37144]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap

def new generation total 960K, used 35K [0x23dd0000, 0x23ed0000, 0x242b0000)

eden space 896K, 4% used [0x23dd0000, 0x23dd8ff0, 0x23eb0000) from space 64K, 0% used [0x23eb0000, 0x23eb0000, 0x23ec0000) to space 64K, 0% used [0x23ec0000, 0x23ec0000, 0x23ed0000)

tenured generation total 4096K, used 110K [0x242b0000, 0x246b0000, 0x27dd0000)

the space 4096K, 2% used [0x242b0000, 0x242cba98, 0x242cbc00, 0x246b0000)

compacting perm gen total 12288K, used 338K [0x27dd0000, 0x289d0000, 0x2bdd0000)

the space 12288K, 2% used [0x27dd0000, 0x27e248d8, 0x27e24a00, 0x289d0000)

ro space 8192K, 67% used [0x2bdd0000, 0x2c337448, 0x2c337600, 0x2c5d0000) rw space 12288K, 53% used [0x2c5d0000, 0x2cc44d58, 0x2cc44e00, 0x2d1d0000)

Dynamic libraries: 0x00400000 - 0x00424000 C:\Java\jdk1.6.0_12\bin\java.exe 0x7d600000 - 0x7d6f0000 C:\WINDOWS\system32\ntdll.dll 0x7d4c0000 - 0x7d5f0000 C:\WINDOWS\syswow64\kernel32.dll 0x7d1e0000 - 0x7d27c000 C:\WINDOWS\syswow64\ADVAPI32.dll 0x7da20000 - 0x7db00000 C:\WINDOWS\syswow64\RPCRT4.dll 0x7d8d0000 - 0x7d920000 C:\WINDOWS\syswow64\Secur32.dll 0x7c340000 - 0x7c396000 C:\Java\jdk1.6.0_12\jre\bin\msvcr71.dll 0x6d8b0000 - 0x6db06000 C:\Java\jdk1.6.0_12\jre\bin\client\jvm.dll 0x7d930000 - 0x7da00000 C:\WINDOWS\syswow64\USER32.dll 0x7d800000 - 0x7d890000 C:\WINDOWS\syswow64\GDI32.dll 0x76aa0000 - 0x76acd000 C:\WINDOWS\system32\WINMM.dll 0x71bc0000 - 0x71bc8000 C:\WINDOWS\system32\rdpsnd.dll 0x771f0000 - 0x77201000 C:\WINDOWS\system32\WINSTA.dll 0x77ba0000 - 0x77bfa000 C:\WINDOWS\syswow64\msvcrt.dll 0x71c40000 - 0x71c97000 C:\WINDOWS\syswow64\NETAPI32.dll 0x76b70000 - 0x76b7b000 C:\WINDOWS\system32\PSAPI.DLL 0x6d340000 - 0x6d348000 C:\Java\jdk1.6.0_12\jre\bin\hpi.dll 0x6d860000 - 0x6d86c000 C:\Java\jdk1.6.0_12\jre\bin\verify.dll 0x6d3e0000 - 0x6d3ff000 C:\Java\jdk1.6.0_12\jre\bin\java.dll 0x6d8a0000 - 0x6d8af000 C:\Java\jdk1.6.0_12\jre\bin\zip.dll 0x10000000 - 0x100a8000 E:\builds\sdk\vc7\mapserver\mapscript\java\mapscript.dll 0x04370000 - 0x04588000 E:\builds\release-1310\bin\libmap.dll 0x04590000 - 0x045a2000 E:\builds\release-1310\bin\zlib1.dll 0x045b0000 - 0x045f0000 E:\builds\release-1310\bin\proj.dll 0x045f0000 - 0x046e0000 E:\builds\release-1310\bin\libxml2.dll 0x71bb0000 - 0x71bb9000 C:\WINDOWS\system32\WSOCK32.dll 0x71c00000 - 0x71c17000 C:\WINDOWS\system32\WS2_32.dll 0x71bf0000 - 0x71bf8000 C:\WINDOWS\system32\WS2HELP.dll 0x046e0000 - 0x047b9000 E:\builds\release-1310\bin\iconv.dll 0x047c0000 - 0x047cd000 E:\builds\release-1310\bin\libfcgi.dll 0x7c3a0000 - 0x7c41b000 C:\WINDOWS\system32\MSVCP71.dll 0x55300000 - 0x55418000 E:\builds\release-1310\bin\pdflib.dll 0x047d0000 - 0x047ec000 E:\builds\release-1310\bin\fribidi.dll 0x047f0000 - 0x0480d000 E:\builds\release-1310\bin\LIBPQ.dll 0x766d0000 - 0x766d9000 C:\WINDOWS\system32\SHFOLDER.dll 0x04810000 - 0x04d43000 E:\builds\release-1310\bin\gdal17dev.dll 0x12000000 - 0x121ab000 E:\builds\release-1310\bin\xerces-c_2_8.dll 0x04d50000 - 0x04d74000 E:\builds\release-1310\bin\libexpat.dll 0x48890000 - 0x488cd000 C:\WINDOWS\system32\ODBC32.dll 0x7dbd0000 - 0x7dcd3000 C:\WINDOWS\WinSxS\WOW64_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.3790.3959_x-ww_5FA17F4E\COMCTL32.dll 0x04d80000 - 0x04dd2000 C:\WINDOWS\syswow64\SHLWAPI.dll 0x7c8d0000 - 0x7d0cf000 C:\WINDOWS\syswow64\SHELL32.dll 0x762b0000 - 0x762f9000 C:\WINDOWS\syswow64\comdlg32.dll 0x04de0000 - 0x04e54000 E:\builds\release-1310\bin\sqlite3.dll 0x04e60000 - 0x04f3a000 E:\builds\release-1310\bin\geos_c.dll 0x04f40000 - 0x04f6c000 E:\builds\release-1310\bin\libcurl.dll 0x76f10000 - 0x76f3e000 C:\WINDOWS\syswow64\WLDAP32.dll 0x04f70000 - 0x04ffb000 C:\WINDOWS\syswow64\OLEAUT32.dll 0x77670000 - 0x777a9000 C:\WINDOWS\syswow64\ole32.dll 0x051c0000 - 0x051d7000 C:\WINDOWS\system32\odbcint.dll

VM Arguments: jvm_args: -Djava.library.path=. java_command: RFC24 ..\..\tests\test.map Launcher Type: SUN_STANDARD

Environment Variables: PATH=E:\builds\release-1310\bin;E:\builds\release-1310\bin\ms\java;C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\VC7\BIN;C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Common7\Tools;C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Common7\Tools\bin\prerelease;C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Common7\Tools\bin;C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\SDK\v1.1\bin;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322;C:\Program Files (x86)\Subversion;C:\Perl64\site\bin;C:\Perl64\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\buildbot-0.7.4\buildbot;C:\Program Files (x86)\cvsnt;C:\Python24;E:\buildbot\SWIG-1.3.31;C:\Program Files (x86)\Subversion\bin;C:\Program Files\7-Zip;C:\Program Files (x86)\OpenSSH\bin;C:\Program Files (x86)\Mono-1.2.6\bin;C:\Program Files (x86)\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell;C:\Program Files (x86)\Microsoft Visual Studio 2008 SDK\VisualStudioIntegration\Tools\Sandcastle\ProductionTools\; USERNAME=szekerest OS=Windows_NT PROCESSOR_IDENTIFIER=AMD64 Family 15 Model 35 Stepping 2, AuthenticAMD


OS: Windows Server 2003 family Build 3790 Service Pack 2

CPU:total 2 (2 cores per cpu, 1 threads per core) family 15 model 35 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2, sse3, mmxext, 3dnow, 3dnowext

Memory: 4k page, physical 4193528k(1483836k free), swap 4194303k(4095060k free)

vm_info: Java HotSpot(TM) Client VM (11.2-b01) for windows-x86 JRE (1.6.0_12-b04), built on Jan 17 2009 09:57:14 by "java_re" with MS VC++ 7.1

time: Thu May 28 21:59:22 2009 elapsed time: 0 seconds

Change History (9)

comment:1 by tamas, 15 years ago

Here is the output:

SET PATH=E:\builds\release-1310\bin;E:\builds\release-1310\bin\ms\java;C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\VC7\BIN;C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Common7\Tools;C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Common7\Tools\bin\prerelease;C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Common7\Tools\bin;C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\SDK\v1.1\bin;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322;C:\Program Files (x86)\Subversion;C:\Perl64\site\bin;C:\Perl64\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\buildbot-0.7.4\buildbot;C:\Program Files (x86)\cvsnt;C:\Python24;E:\buildbot\SWIG-1.3.31;C:\Program Files (x86)\Subversion\bin;C:\Program Files\7-Zip;C:\Program Files (x86)\OpenSSH\bin;C:\Program Files (x86)\Mono-1.2.6\bin;C:\Program Files (x86)\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\binn\;C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell;C:\Program Files (x86)\Microsoft Visual Studio 2008 SDK\VisualStudioIntegration\Tools\Sandcastle\ProductionTools\; cd sdk\vc7\mapserver\mapscript\java nmake /f makefile.vc test EXT_NMAKE_OPT=E:\builds\release-1310\mapserver.opt C:\Java\jdk1.6.0_12\bin\javac -classpath ./mapscript.jar -d examples\ examples\*.java C:\Java\jdk1.6.0_12\bin\java -cp ./;examples/;./mapscript.jar -Djava.library.path=. DumpShp ../../tests/point.shp

Shapefile opened (type = point with 1 shapes). Shape[0] has 1 part(s) bounds (0.0,51.477222)(0.0,51.477222) Part[0] has 1 point(s) Point[0] = 0.0, 51.477222

C:\Java\jdk1.6.0_12\bin\java -cp ./;examples/;./mapscript.jar -Djava.library.path=. ShapeInfo ..\..\tests\point.shp ..\..\tests\point.dbf

Shapefile name = ..\..\tests\point.shp Type = point Number of features 1 bounds (0.0,51.477222)(0.0,51.477222)

C:\Java\jdk1.6.0_12\bin\java -cp ./;examples/;./mapscript.jar -Djava.library.path=. DrawMap ..\..\tests\test.map .\map.png

Image size is: 3796 Image size from getBytes is: 3796 0) the map will be drawn to:.\map.png

C:\Java\jdk1.6.0_12\bin\java -cp ./;examples/;./mapscript.jar -Djava.library.path=. RFC24 ..\..\tests\test.map

Running RFC24

  • testLayerObj PASSED
  • testClassObj PASSED
  • testInsertLayerObj PASSED

# # An unexpected error has been detected by Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7d6210e8, pid=26312, tid=88332 # # Java VM: Java HotSpot(TM) Client VM (11.2-b01 mixed mode, sharing windows-x86) # Problematic frame: # C [ntdll.dll+0x210e8] # # An error report file with more information is saved as: # E:\builds\sdk\vc7\mapserver\mapscript\java\hs_err_pid26312.log # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # # [ timer expired, abort... ]

comment:2 by unicoletti, 13 years ago

Status: newassigned
Summary: Java tests in the trunk are crashing on WindowsJava tests in the trunk are crashing on Windows/Linux

It seems they are also crashing on linux now, changing the summary, working on it

comment:3 by tamas, 13 years ago

According to my recent experiences the java bindings generated with SWIG 1.3.36 is working correctly. But SWIG 1.3.39 causes the tests to crash.

in reply to:  3 comment:4 by unicoletti, 13 years ago

Replying to tamas:

According to my recent experiences the java bindings generated with SWIG 1.3.36 is working correctly. But SWIG 1.3.39 causes the tests to crash.

I am using swig 1.3.40 but the crash seems to be caused by memory corruption somewhere in msFreeHashItems. To isolate the problem I have commented out the two free(tp->key) and free(tp->data) and now malloc complains as follows:

*** glibc detected *** java: free(): invalid pointer: 0xbff00000 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(+0x6b591)[0x400c9591]
/lib/tls/i686/cmov/libc.so.6(+0x6cde8)[0x400cade8]
/lib/tls/i686/cmov/libc.so.6(cfree+0x6d)[0x400cdecd]
/home/unicoletti/Workspace/eclipse/subversion/trunk/mapserver/mapscript/java/libmapscript.so(msFreeHashItems+0x80)[0x775dab6a]
/home/unicoletti/Workspace/eclipse/subversion/trunk/mapserver/mapscript/java/libmapscript.so(freeLayer+0x2fb)[0x775fb515]
/home/unicoletti/Workspace/eclipse/subversion/trunk/mapserver/mapscript/java/libmapscript.so(msFreeMap+0x1aa)[0x7766077d]
/home/unicoletti/Workspace/eclipse/subversion/trunk/mapserver/mapscript/java/libmapscript.so(+0x551e8)[0x775721e8]
/home/unicoletti/Workspace/eclipse/subversion/trunk/mapserver/mapscript/java/libmapscript.so(Java_edu_umn_gis_mapscript_mapscriptJNI_delete_1mapObj+0x6a)[0x7759d1b7]

seems a memory mgmt problem to me. Has anyone worked on the hash items implementation recently?

comment:5 by unicoletti, 13 years ago

I've spent one day on this and I am at a total loss as to what is causing it. I might try a less recent version of swig (1.3.36) but I'm not even sure swig is the cause.

comment:6 by tamas, 13 years ago

I've also spent some time to track this down earlier, but the best thing I could do is to get back to SWIG 1.3.36 The csharp tests are working fine with 1.3.39 so it's less likely a problem of the mapserver core.

comment:7 by unicoletti, 13 years ago

Tried swig 1.3.36, still crashing, definitely a memory management error:

*** glibc detected *** java: double free or corruption (out): 0x7ae00040 ***

comment:8 by rouault, 13 years ago

I think I've found the reason. I've added a debug statement in initLayer() :

printf("layerObj size from mapserv: %d\n", sizeof(layerObj));

and one in new_layerObj() in mapscript_warp.c :

printf("layerObj size from mapscript: %d\n", sizeof(layerObj));

And here's the output :

layerObj size from mapscript: 864
layerObj size from mapserv: 896

So mapscript allocates a too small layerObj structure and initLayer() or freeLayer() will access fields outsize it.

This is likely due to the definition of layerObj in mapserver.h that has :

#ifndef SWIGJAVA  
  rectObj extent;
#endif /* not SWIGJAVA */

I've commented out manually the #define SWIGJAVA at the beginning of mapscript_wrap.c and the test no longer crash.

in reply to:  8 comment:9 by unicoletti, 13 years ago

Resolution: fixed
Status: assignedclosed

@rouault : you're right, thanks!

I have searched for other similar ifdefs, that was the only one left in the h/c files.

fixed in r11324

Note: See TracTickets for help on using tickets.