JDK-6355183 : packager.exe crashes when called from within ANT
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-11-24
  • Updated: 2011-03-07
  • Resolved: 2011-03-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u10Fixed 7 b14Fixed
Description
FULL PRODUCT VERSION :
Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'
has value '1.4', but '1.5' is required.
Error: could not find java.dll
Error: could not find Java 2 Runtime Environment.

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

EXTRA RELEVANT SYSTEM CONFIGURATION :
ANT 1.6.2

A DESCRIPTION OF THE PROBLEM :
Calling packager.exe with the following parameters works well if done frome CMD.exe:

packager.exe -clsid {83D226C9-8CC7-4FF8-B8B1-FDBAF361CBA6} -out dist VielstellenAnzeige.jar de.quipsy.client.ui.beans.vielstellenanzeige.VielstellenAnzeige

But if I do the same from within an ANT script, the VM crashes:

		<exec executable="${jdk.home}/bin/packager.exe" newenvironment="true">
			<env key="PATH" path="${vc98.path}" />
			<env key="INCLUDE" path="${vc98.include}" />
			<arg value="-clsid" />
			<arg value="${bean.clsid}" />
			<arg value="-out" />
			<arg path="${packager.out}" />
			<arg file="${module.name}" />
			<arg value="${bean.name}" />
		</exec>

The crash produces the following output:

    [exec] #
     [exec] # An unexpected error has been detected by HotSpot Virtual Machine:
     [exec] #
     [exec] #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x77c17e9f, pid=4072, tid=1340
     [exec] #
     [exec] # Java VM: Java HotSpot(TM) Client VM (1.5.0_05-b05 mixed mode, sharing)
     [exec] # Problematic frame:
     [exec] # C  [MSVCRT.dll+0x37e9f]
     [exec] #
     [exec] # An error report file with more information is saved as hs_err_pid4072.log
     [exec] #
     [exec] # If you would like to submit a bug report, please visit:
     [exec] #   http://java.sun.com/webapps/bugreport/crash.jsp
     [exec] #
     [exec] Die IDL-Datei konnte nicht erstellt werden.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See ANT script in Description field. I can send you the VielstellenAnzeige.jar file so you can reproduce it. Just ask me to do so.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
As with every other JAR it should run fine.
ACTUAL -
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x77c17e9f, pid=4072, tid=1340
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_05-b05 mixed mode, sharing)
# Problematic frame:
# C  [MSVCRT.dll+0x37e9f]
#

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

Current thread (0x02c92500):  JavaThread "AWT-Windows" daemon [_thread_in_native, id=1340]

siginfo: ExceptionCode=0xc0000005, reading address 0x00000000

Registers:
EAX=0x00000000, EBX=0x2b36ba58, ECX=0x02f7fa5c, EDX=0x00000000
ESP=0x02f7f83c, EBP=0x02f7f83c, ESI=0x6d19fd78, EDI=0x02c92500
EIP=0x77c17e9f, EFLAGS=0x00010296

  Top of Stack: (sp=0x02f7f83c)
0x02f7f83c:   02f7fc88 6d154618 02f7fa5c 00000000
0x02f7f84c:   6d19cb30 73011734 00000474 00000042
0x02f7f85c:   00530025 00530059 00450054 0052004d
0x02f7f86c:   004f004f 00250054 0043005c 00720075
0x02f7f87c:   006f0073 00730072 0033005c 00670064
0x02f7f88c:   00720061 006f0072 0063002e 00720075
0x02f7f89c:   00090000 77e162a0 02f7f9fc 02f7fa84
0x02f7f8ac:   02f7f9e8 77da8771 00095960 00000002

Instructions: (pc=0x77c17e9f)
0x77c17e8f:   cc cc cc cc cc 8b ff 55 8b ec 8b 4d 08 8b 55 0c
0x77c17e9f:   66 8b 02 66 89 01 41 41 42 42 66 85 c0 75 f1 8b


Stack: [0x02f40000,0x02f80000),  sp=0x02f7f83c,  free space=254k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [MSVCRT.dll+0x37e9f]
C  [awt.dll+0xe4618]
j  sun.awt.windows.WToolkit.init()Z+0
j  sun.awt.windows.WToolkit.run()V+1
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub
V  [jvm.dll+0x8295c]
V  [jvm.dll+0xd752e]
V  [jvm.dll+0x8282d]
V  [jvm.dll+0x8258a]
V  [jvm.dll+0x9d476]
V  [jvm.dll+0x1042ae]
V  [jvm.dll+0x10427c]
C  [MSVCRT.dll+0x2a3b0]
C  [kernel32.dll+0xb50b]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  sun.awt.windows.WToolkit.init()Z+0
j  sun.awt.windows.WToolkit.run()V+1
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub

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

Java Threads: ( => current thread )
=>0x02c92500 JavaThread "AWT-Windows" daemon [_thread_in_native, id=1340]
  0x02c92010 JavaThread "AWT-Shutdown" [_thread_blocked, id=3276]
  0x00a6e050 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3176]
  0x00a6cd58 JavaThread "CompilerThread0" daemon [_thread_blocked, id=2788]
  0x00a6bec0 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=640]
  0x00a670a0 JavaThread "Finalizer" daemon [_thread_blocked, id=404]
  0x00a65bc0 JavaThread "Reference Handler" daemon [_thread_blocked, id=3776]
  0x00035d00 JavaThread "main" [_thread_blocked, id=588]

Other Threads:
  0x00a63320 VMThread [id=2640]
  0x00a6f390 WatcherThread [id=3640]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 def new generation   total 576K, used 182K [0x22a80000, 0x22b20000, 0x22f60000)
  eden space 512K,  23% used [0x22a80000, 0x22a9dba0, 0x22b00000)
  from space 64K, 100% used [0x22b10000, 0x22b20000, 0x22b20000)
  to   space 64K,   0% used [0x22b00000, 0x22b00000, 0x22b10000)
 tenured generation   total 1408K, used 135K [0x22f60000, 0x230c0000, 0x26a80000)
   the space 1408K,   9% used [0x22f60000, 0x22f81d08, 0x22f81e00, 0x230c0000)
 compacting perm gen  total 8192K, used 122K [0x26a80000, 0x27280000, 0x2aa80000)
   the space 8192K,   1% used [0x26a80000, 0x26a9eab0, 0x26a9ec00, 0x27280000)
    ro space 8192K,  66% used [0x2aa80000, 0x2afdae88, 0x2afdb000, 0x2b280000)
    rw space 12288K,  46% used [0x2b280000, 0x2b818490, 0x2b818600, 0x2be80000)

Dynamic libraries:
0x00400000 - 0x0040c000 	C:\PROGRA~1\Java\JDK15~3.0_0\bin\java.exe
0x7c910000 - 0x7c9c7000 	C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c906000 	C:\WINDOWS\system32\kernel32.dll
0x77da0000 - 0x77e4a000 	C:\WINDOWS\system32\ADVAPI32.dll
0x77e50000 - 0x77ee1000 	C:\WINDOWS\system32\RPCRT4.dll
0x77be0000 - 0x77c38000 	C:\WINDOWS\system32\MSVCRT.dll
0x6d6b0000 - 0x6d83c000 	C:\PROGRA~1\Java\JDK15~3.0_0\jre\bin\client\jvm.dll
0x77d10000 - 0x77da0000 	C:\WINDOWS\system32\USER32.dll
0x77ef0000 - 0x77f36000 	C:\WINDOWS\system32\GDI32.dll
0x76af0000 - 0x76b1e000 	C:\WINDOWS\system32\WINMM.dll
0x6d2f0000 - 0x6d2f8000 	C:\PROGRA~1\Java\JDK15~3.0_0\jre\bin\hpi.dll
0x76bb0000 - 0x76bbb000 	C:\WINDOWS\system32\PSAPI.DLL
0x77fc0000 - 0x77fd1000 	C:\WINDOWS\system32\Secur32.dll
0x6d680000 - 0x6d68c000 	C:\PROGRA~1\Java\JDK15~3.0_0\jre\bin\verify.dll
0x6d370000 - 0x6d38d000 	C:\PROGRA~1\Java\JDK15~3.0_0\jre\bin\java.dll
0x6d6a0000 - 0x6d6af000 	C:\PROGRA~1\Java\JDK15~3.0_0\jre\bin\zip.dll
0x6d070000 - 0x6d1d7000 	C:\Programme\Java\jdk1.5.0_05\jre\bin\awt.dll
0x72f70000 - 0x72f96000 	C:\WINDOWS\system32\WINSPOOL.DRV
0x76330000 - 0x7634d000 	C:\WINDOWS\system32\IMM32.dll
0x774b0000 - 0x775ec000 	C:\WINDOWS\system32\ole32.dll
0x5b0f0000 - 0x5b128000 	C:\WINDOWS\system32\uxtheme.dll
0x736d0000 - 0x73719000 	C:\WINDOWS\system32\ddraw.dll
0x73b30000 - 0x73b36000 	C:\WINDOWS\system32\DCIMAN32.dll
0x738b0000 - 0x73980000 	C:\WINDOWS\system32\D3DIM700.DLL
0x746a0000 - 0x746eb000 	C:\WINDOWS\system32\MSCTF.dll

VM Arguments:
java_command: sun.plugin.com.Packager de.quipsy.client.ui.beans.vielstellenanzeige.VielstellenAnzeige C:\WINDOWS\ {83D226C9-8CC7-4FF8-B8B1-FDBAF361CBA6} {83D226CA-8CC7-4FF8-B8B1-FDBAF361CBA6} {83D226CB-8CC7-4FF8-B8B1-FDBAF361CBA6} {83D226CC-8CC7-4FF8-B8B1-FDBAF361CBA6}

Environment Variables:
PATH=C:\PROGRA~1\MICROS~4\VC98\Bin;C:\PROGRA~1\MICROS~4\Common\MSDev98\Bin



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

OS: Windows XP Build 2600 Service Pack 2

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

Memory: 4k page, physical 523244k(117636k free), swap 1278080k(793068k free)

vm_info: Java HotSpot(TM) Client VM (1.5.0_05-b05) for windows-x86, built on Aug 26 2005 15:36:02 by "java_re" with MS VC++ 6.0



ERROR MESSAGES/STACK TRACES THAT OCCUR :
see description / actual result

REPRODUCIBILITY :
This bug can be reproduced often.

---------- BEGIN SOURCE ----------
see description
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Do not use packager.exe from within an ANT script but use CMD.EXE only.

Comments
SUGGESTED FIX the webrev could be found at http://sa.sfbay.sun.com/projects/awt_data/7/6355183/ it is also attached.
21-05-2007

EVALUATION it looks like this code was added to fix some painting problem (CR #4196958) which is specific for Windows 9x. And since Win98 is dropped by MS, we can safely remove this code, this way we will fix the crash and clean our code.
15-05-2007

EVALUATION Please reread the evaluation above. The root cause of the crash has been very clearly tracked down to that portion of the code in the AWT. The customer has indicated that the error messages at the beginning of the description came from a broken JDK installation but that the crash occurs with a working JDK.
13-01-2006

EVALUATION Though unable to reproduce the crash in-house, the three hs_err log files in one of the attachments (attached directly to the bug report for convenience) point to a place in awt.dll where it is calling in to the C runtime resulting in a crash. Extracting the awt.dll.map file from the 5.0u6 intermediate build results indicates that offset 0xe4818 in awt.dll is contained in the method AwtToolkit::detect_themes. Looking at the source code for this method, there is a point at which it performs a getenv of the environment variable SYSTEMROOT and, without checking the return result of this call, passes the value down to strcpy. This would be consistent with the symptom of the crash. I don't know why under only the circumstance of being run under Ant the SYSTEMROOT environment variable is not set (or, conversely, why this problem does not show up when AWT-based programs are run outside the context of Ant) but I believe this is the root cause of the crashes of packager.exe. At minimum a test of the return result of the getenv call should be introduced and if it's NULL then something different should be done. I'm transferring this bug to the AWT team for further investigation and resolution.
12-01-2006

EVALUATION At first, I'd ask you to handle somehow these messages: """ Error: could not find java.dll Error: could not find Java 2 Runtime Environment. """ If problem still exist then it's unlikely the reason of that crash. Then tracked that fragment back (we thought it's a swing part) and found that it deals with the cursor performance. (delta 1.122.1.1)
12-01-2006