JDK-6508941 : java.awt.Desktop.open causes VM to crash with video files sporadically
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-01-02
  • Updated: 2023-12-08
  • Resolved: 2020-12-03
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 16
16 b28Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

FULL OS VERSION :
Microsoft Windows XP [Version 5.1.2600]

EXTRA RELEVANT SYSTEM CONFIGURATION :
Graphics Card: NVidia Geforce nx7600GS
Sound Card:      Creative Labs Soundblaster Audigy 2ZS

A DESCRIPTION OF THE PROBLEM :
Launching video files using java.awt.Desktop.open occasionally results in a crash of the JRE.

THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes

THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try to launch a video file using java.awt.Desktop.open from any class/method.

EXPECTED VERSUS ACTUAL BEHAVIOR :
Instead of launching the associated video player the JRE shuts down.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
#
# An unexpected error has been detected by Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x1005d617, pid=3640, tid=3060
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0-b105 mixed mode, sharing)
# Problematic frame:
# C  [nvcpl.dll+0x5d617]
#
# 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 (0x0304e400):  JavaThread "AWT-EventQueue-0" [_thread_in_native, id=3060]

siginfo: ExceptionCode=0xc0000005, reading address 0x03218b64

Registers:
EAX=0x00000a38, EBX=0x0339f170, ECX=0x00000000, EDX=0x00010000
ESP=0x0339f0cc, EBP=0x00000000, ESI=0x03216430, EDI=0x03214bd0
EIP=0x1005d617, EFLAGS=0x00090202

  Top of Stack: (sp=0x0339f0cc)
0x0339f0cc:   0339f1cc 03214bd0 0339f150 0339f170
0x0339f0dc:   00000000 00000001 00000000 592c15ac
0x0339f0ec:   00010015 0339f150 7ca5611b 03214bd0
0x0339f0fc:   0339f170 000eeee8 000f0a38 00000000
0x0339f10c:   00000000 02acf308 0effffff 7c9e5eb8
0x0339f11c:   7c9e5eb8 7c80a996 7c9e5da0 0339f14c
0x0339f12c:   7caa86d5 0339f3fc 000eeee8 00000000
0x0339f13c:   80004001 0339f3e0 7ca562ef 00000010

Instructions: (pc=0x1005d617)
0x1005d607:   8e 4c 02 00 00 8b 94 8e 50 02 00 00 8b 7c 24 2c
0x1005d617:   8b 8c 87 b4 16 00 00 85 8e 58 02 00 00 89 6c 24


Stack: [0x03350000,0x033a0000),  sp=0x0339f0cc,  free space=316k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [nvcpl.dll+0x5d617]

[error occurred during error reporting, step 120, id 0xc0000005]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  sun.awt.windows.WDesktopPeer.ShellExecute(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;+0
j  sun.awt.windows.WDesktopPeer.ShellExecute(Ljava/net/URI;Ljava/lang/String;)V+5
j  sun.awt.windows.WDesktopPeer.open(Ljava/io/File;)V+8
j  java.awt.Desktop.open(Ljava/io/File;)V+24
j  T.I.I(Ljava/lang/Object;Ljava/lang/String;Z)V+545
j  utils.swing.chooser.file.explorer.D.actionPerformed(Ljava/awt/event/ActionEvent;)V+36
j  javax.swing.JFileChooser.fireActionPerformed(Ljava/lang/String;)V+116
j  javax.swing.JFileChooser.approveSelection()V+23
j  W.Z.approveSelection()V+285
j  javax.swing.plaf.basic.BasicFileChooserUI$Handler.mouseClicked(Ljava/awt/event/MouseEvent;)V+105
j  sun.swing.FilePane$Handler.mouseClicked(Ljava/awt/event/MouseEvent;)V+351
j  java.awt.AWTEventMulticaster.mouseClicked(Ljava/awt/event/MouseEvent;)V+21
j  java.awt.Component.processMouseEvent(Ljava/awt/event/MouseEvent;)V+74
j  javax.swing.JComponent.processMouseEvent(Ljava/awt/event/MouseEvent;)V+23
j  java.awt.Component.processEvent(Ljava/awt/AWTEvent;)V+81
j  java.awt.Container.processEvent(Ljava/awt/AWTEvent;)V+18
j  java.awt.Component.dispatchEventImpl(Ljava/awt/AWTEvent;)V+562
J  java.awt.Container.dispatchEventImpl(Ljava/awt/AWTEvent;)V
J  java.awt.LightweightDispatcher.retargetMouseEvent(Ljava/awt/Component;ILjava/awt/event/MouseEvent;)V
j  java.awt.LightweightDispatcher.processMouseEvent(Ljava/awt/event/MouseEvent;)Z+157
j  java.awt.LightweightDispatcher.dispatchEvent(Ljava/awt/AWTEvent;)Z+50
J  java.awt.Container.dispatchEventImpl(Ljava/awt/AWTEvent;)V
j  java.awt.Window.dispatchEventImpl(Ljava/awt/AWTEvent;)V+19
J  java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V
J  java.awt.EventDispatchThread.pumpOneEventForFilters(I)Z
j  java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+30
j  java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11
j  java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4
j  java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3
j  java.awt.EventDispatchThread.run()V+9
v  ~StubRoutines::call_stub

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

Java Threads: ( => current thread )
  0x00386000 JavaThread "DestroyJavaVM" [_thread_blocked, id=3936]
=>0x0304e400 JavaThread "AWT-EventQueue-0" [_thread_in_native, id=3060]
  0x0304cc00 JavaThread "TimerQueue" daemon [_thread_blocked, id=2820]
  0x02b1c800 JavaThread "AWT-Windows" daemon [_thread_in_native, id=3832]
  0x02b1bc00 JavaThread "AWT-Shutdown" [_thread_blocked, id=4040]
  0x02b59000 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=2328]
  0x02a8cc00 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=1024]
  0x02a87c00 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3808]
  0x02a86c00 JavaThread "Attach Listener" daemon [_thread_blocked, id=3804]
  0x02a85c00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3896]
  0x02a81400 JavaThread "Finalizer" daemon [_thread_blocked, id=4048]
  0x02a7d000 JavaThread "Reference Handler" daemon [_thread_blocked, id=3952]

Other Threads:
  0x02a73c00 VMThread [id=4024]
  0x02a8e000 WatcherThread [id=836]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 def new generation   total 4544K, used 465K [0x1e960000, 0x1ee40000, 0x1f330000)
  eden space 4096K,   7% used [0x1e960000, 0x1e9a8df8, 0x1ed60000)
  from space 448K,  38% used [0x1edd0000, 0x1edfb9c0, 0x1ee40000)
  to   space 448K,   0% used [0x1ed60000, 0x1ed60000, 0x1edd0000)
 tenured generation   total 60544K, used 2409K [0x1f330000, 0x22e50000, 0x26960000)
   the space 60544K,   3% used [0x1f330000, 0x1f58a710, 0x1f58a800, 0x22e50000)
 compacting perm gen  total 12288K, used 2278K [0x26960000, 0x27560000, 0x2a960000)
   the space 12288K,  18% used [0x26960000, 0x26b99878, 0x26b99a00, 0x27560000)
    ro space 8192K,  62% used [0x2a960000, 0x2ae5b9c8, 0x2ae5ba00, 0x2b160000)
    rw space 12288K,  52% used [0x2b160000, 0x2b79e348, 0x2b79e400, 0x2bd60000)

Dynamic libraries:
0x00400000 - 0x00423000 	C:\Programme\Java\jre1.6.0\bin\javaw.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
0x77d10000 - 0x77da0000 	C:\WINDOWS\system32\USER32.dll
0x77ef0000 - 0x77f37000 	C:\WINDOWS\system32\GDI32.dll
0x7c340000 - 0x7c396000 	C:\Programme\Java\jre1.6.0\bin\msvcr71.dll
0x6d7c0000 - 0x6da07000 	C:\Programme\Java\jre1.6.0\bin\client\jvm.dll
0x76af0000 - 0x76b1e000 	C:\WINDOWS\system32\WINMM.dll
0x6d310000 - 0x6d318000 	C:\Programme\Java\jre1.6.0\bin\hpi.dll
0x76bb0000 - 0x76bbb000 	C:\WINDOWS\system32\PSAPI.DLL
0x6d770000 - 0x6d77c000 	C:\Programme\Java\jre1.6.0\bin\verify.dll
0x6d3b0000 - 0x6d3cf000 	C:\Programme\Java\jre1.6.0\bin\java.dll
0x6d7b0000 - 0x6d7bf000 	C:\Programme\Java\jre1.6.0\bin\zip.dll
0x6d000000 - 0x6d1c3000 	C:\Programme\Java\jre1.6.0\bin\awt.dll
0x72f70000 - 0x72f96000 	C:\WINDOWS\system32\WINSPOOL.DRV
0x77be0000 - 0x77c38000 	C:\WINDOWS\system32\msvcrt.dll
0x76330000 - 0x7634d000 	C:\WINDOWS\system32\IMM32.dll
0x774b0000 - 0x775ed000 	C:\WINDOWS\system32\ole32.dll
0x736d0000 - 0x73719000 	C:\WINDOWS\system32\ddraw.dll
0x73b30000 - 0x73b36000 	C:\WINDOWS\system32\DCIMAN32.dll
0x746a0000 - 0x746eb000 	C:\WINDOWS\system32\MSCTF.dll
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
0x5d450000 - 0x5d4ea000 	C:\WINDOWS\system32\comctl32.dll
0x6d2b0000 - 0x6d303000 	C:\Programme\Java\jre1.6.0\bin\fontmanager.dll
0x6d570000 - 0x6d583000 	C:\Programme\Java\jre1.6.0\bin\net.dll
0x71a10000 - 0x71a27000 	C:\WINDOWS\system32\WS2_32.dll
0x71a00000 - 0x71a08000 	C:\WINDOWS\system32\WS2HELP.dll
0x6d590000 - 0x6d599000 	C:\Programme\Java\jre1.6.0\bin\nio.dll
0x597d0000 - 0x59825000 	C:\WINDOWS\system32\netapi32.dll
0x71a80000 - 0x71a92000 	C:\WINDOWS\system32\MPR.dll
0x75f00000 - 0x75f07000 	C:\WINDOWS\System32\drprov.dll
0x71b90000 - 0x71b9e000 	C:\WINDOWS\System32\ntlanman.dll
0x71c50000 - 0x71c67000 	C:\WINDOWS\System32\NETUI0.dll
0x71c10000 - 0x71c50000 	C:\WINDOWS\System32\NETUI1.dll
0x71c00000 - 0x71c07000 	C:\WINDOWS\System32\NETRAP.dll
0x71b70000 - 0x71b83000 	C:\WINDOWS\System32\SAMLIB.dll
0x75f10000 - 0x75f19000 	C:\WINDOWS\System32\davclnt.dll
0x778f0000 - 0x779e4000 	C:\WINDOWS\system32\SETUPAPI.dll
0x77b10000 - 0x77b32000 	C:\WINDOWS\system32\appHelp.dll
0x770f0000 - 0x7717c000 	C:\WINDOWS\system32\OLEAUT32.dll
0x033a0000 - 0x03679000 	C:\WINDOWS\system32\xpsp2res.dll
0x6d1f0000 - 0x6d21f000 	C:\Programme\Java\jre1.6.0\bin\cmm.dll
0x6d450000 - 0x6d474000 	C:\Programme\Java\jre1.6.0\bin\jpeg.dll
0x76f90000 - 0x7700f000 	C:\WINDOWS\system32\CLBCATQ.DLL
0x77010000 - 0x770e3000 	C:\WINDOWS\system32\COMRes.dll
0x77bd0000 - 0x77bd8000 	C:\WINDOWS\system32\VERSION.dll
0x02fa0000 - 0x02fcc000 	C:\Programme\WinRAR\rarext.dll
0x779f0000 - 0x77a46000 	C:\WINDOWS\System32\cscui.dll
0x765a0000 - 0x765bd000 	C:\WINDOWS\System32\CSCDLL.dll
0x592c0000 - 0x592d4000 	C:\WINDOWS\system32\wmpshell.dll
0x10000000 - 0x1076d000 	C:\WINDOWS\system32\nvcpl.dll
0x76350000 - 0x7639a000 	C:\WINDOWS\system32\comdlg32.dll
0x76620000 - 0x766d5000 	C:\WINDOWS\system32\USERENV.dll
0x74c00000 - 0x74c2c000 	C:\WINDOWS\system32\OLEACC.dll
0x76020000 - 0x76085000 	C:\WINDOWS\system32\MSVCP60.dll
0x5b0f0000 - 0x5b128000 	C:\WINDOWS\system32\UxTheme.dll
0x03230000 - 0x03266000 	C:\WINDOWS\system32\nvapi.dll

VM Arguments:
jvm_args: -Xms64m -Xmx128m
java_command: utils.swing.chooser.file.explorer.JFileExplorer
Launcher Type: SUN_STANDARD

Environment Variables:
CLASSPATH=.;C:\Programme\Java\jdk1.6.0\lib\dt.jar
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\Java\jdk1.6.0\bin;C:\Programme\Java\WTK25\bin;\bin
USERNAME=vm
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 4 Stepping 8, AuthenticAMD



---------------  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, mmxext, 3dnowext, 3dnow

Memory: 4k page, physical 1571568k(1051364k free), swap 3512672k(3110364k 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



REPRODUCIBILITY :
This bug can be reproduced occasionally.

---------- BEGIN SOURCE ----------
public class VideoTest {
  public static void main(String[] args) {
    try {
      java.awt.Desktop.getDesktop().open(new File("C:\\dummy.avi"));
    } catch (IOException e) {}
  }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
As mentioned in the error log the problem relates to the file "nvcpl.dll" that comes with nvidia's drivers. Disabling the dll and all associated applications seems to have eliminated the error.

Comments
Changeset: 85269470 Author: Sergey Bylokhov <serb@openjdk.org> Date: 2020-12-03 20:08:09 +0000 URL: https://git.openjdk.java.net/jdk/commit/85269470
03-12-2020

The report is quite outdated, so can be closed but I found that according to the documentation: https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutea > Because ShellExecute can delegate execution to Shell extensions (data sources, context menu handlers, verb implementations) that are activated using Component Object Model (COM), COM should be initialized before ShellExecute is called. Some Shell extensions require the COM single-threaded apartment (STA) type. In that case, COM should be initialized as shown here: CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE) But this CoInitializeEx is missed in the Desktop class. Absent of this initialization caused some other crashes in past, see JDK-6950553 for example.
20-11-2020

Possible fixed already by the changes in VM and JDK-6457572
20-11-2020

EVALUATION Before execution of ShellExecute on the problematic host floating point status word is 0x80001. 0x80001 is an intersection of EM_INEXACT and EM_DENORMAL.
22-03-2007

EVALUATION I found out that after ShallExecute invocation control word is 0x9001. 0x9001 is a CW_DEFAULT constant which defined in float.h So, looks like during ShellExecute this flag is set as a control word. I tried explicitly to disable exceptions (with _control87 and _clear87 functions), but it does not bring any results. Looks like the single solution is to catch floating point exceptions in ShellExecute and continue execution.
22-03-2007

EVALUATION Looks like after execution of ShellExecuteW function exception occurs. bellow is an output after normal execution _STATUS_87: 1 _CONTROL_WORD_87: 9001f the output on the problematic host is Exception occurs! _STATUS_87: 0 _CONTROL_WORD_87: 9001f DIFFS: ------- awt_Desktop.cpp ------- *** /tmp/sccs.WvaW2p Wed Mar 21 16:05:18 2007 --- awt_Desktop.cpp Mon Mar 19 16:42:17 2007 *************** *** 25,34 **** const WCHAR* uri_c = env->GetStringChars(uri_j, JNI_FALSE); const WCHAR* verb_c = env->GetStringChars(verb_j, JNI_FALSE); // 6457572: ShellExecute possibly changes FPU control word - saving it here ! unsigned oldcontrol87 = _control87(0, 0); ! HINSTANCE retval = ShellExecuteW(NULL, verb_c, uri_c, NULL, NULL, SW_SHOWNORMAL); ! _control87(oldcontrol87, 0xffffffff); env->ReleaseStringChars(uri_j, uri_c); env->ReleaseStringChars(verb_j, verb_c); --- 25,47 ---- const WCHAR* uri_c = env->GetStringChars(uri_j, JNI_FALSE); const WCHAR* verb_c = env->GetStringChars(verb_j, JNI_FALSE); + HINSTANCE retval; + // 6457572: ShellExecute possibly changes FPU control word - saving it here ! try { ! unsigned oldcontrol87 = _control87(0, 0); ! retval = ShellExecuteW(NULL, verb_c, uri_c, NULL, NULL, SW_SHOWNORMAL); ! fprintf(stderr, "\n_STATUS_87: %x\n", _status87()); ! fprintf(stderr, "_CONTROL_WORD_87: %x\n", _control87(0, 0)); ! //_clear87(); ! _control87(oldcontrol87, 0xffffffff); ! } ! catch (...) ! { ! fprintf(stderr,"\n EXCEPTION IN Java_sun_awt_windows_WDesktopPeer_ShellExecute!\n"); ! fprintf(stderr, "_STATUS_87: %x\n", _status87()); ! fprintf(stderr, "_CONTROL_WORD_87: %x\n", _control87(0, 0)); ! } env->ReleaseStringChars(uri_j, uri_c); env->ReleaseStringChars(verb_j, verb_c);
21-03-2007

EVALUATION I have found the host where the problem is reproducible.
05-03-2007

EVALUATION The next program is very close to our implementation. I will try to send compiled version to submitter. ============ BEGIN: deskopener.cpp ================== #include "stdafx.h" #include <float.h> #include <windows.h> #include <ostream> void printHelp(); int _tmain(int argc, _TCHAR* argv[]) { if (3 != argc) { printHelp(); return 1; } WCHAR * verb_c = (WCHAR*)LocalAlloc(LPTR, 256 * sizeof(WCHAR)); WCHAR * uri_c = (WCHAR*)LocalAlloc(LPTR, 256 * sizeof(WCHAR)); mbstowcs(uri_c, argv[1], 256*sizeof(TCHAR)); mbstowcs(verb_c, argv[2], 256*sizeof(TCHAR)); unsigned oldcontrol87 = _control87(0, 0); HINSTANCE retval = ShellExecuteW(NULL, verb_c, uri_c, NULL, NULL, SW_SHOWNORMAL); _control87(oldcontrol87, 0xffffffff); LocalFree(uri_c); if ((int)retval <= 32) { // ShellExecute failed. LPVOID buffer; int len = FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPWSTR) &buffer, 0, NULL ); LocalFree(buffer); return 1; } return 0; } void printHelp() { std::cerr << "The syntax of this command is:\n\n" << "deskopener <full path to a file> <operation type>\n\n" << "Operation types:\n\n" << "edit\n" << "\tLaunches an editor and opens the document for editing.\n" << "\tIf lpFile is not a document file, the program will fail.\n" << "explore\n" << "\tExplores the folder specified by lpFile.\n" << "find\n" << "\tInitiates a search starting from the specified directory.\n" << "open\n" << "\tOpens the file specified by the lpFile parameter. The file\n" << "\tcan be an executable file, a document file, or a folder.\n" << "print\n" << "\tPrints the document file specified by lpFile. If lpFile is\n" << "\tnot a document file, the function will fail.\n" << "NULL\n" << "\tFor systems prior to Microsoft Windows 2000, the default verb\n" << "\tis used if it is valid and available in the registry. If not,\n" << "\tthe \"open\" verb is used." << "\n\n\n" << "For Windows 2000 and later systems, the default verb is used if\n" << "available. If not, the \"open\" verb is used. If neither verb is\n" << "available, the system uses the first verb listed in the registry.\n"; } ============ END: deskopener.cpp ==================
15-02-2007

EVALUATION I don't have an exact the same configuration as described in the bug, and the bug is not reproducible on my ATI desktop and another desktop with NVidia card.
25-01-2007

EVALUATION The crash happens in nvcpl.dll library, so it seems the bug is related to NVidia video card. I also was unable to reproduce the crash with my ATI card.
15-01-2007