Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6401955

java.awt.Desktop.open() crashes JVM (Mustang B75)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Cannot Reproduce
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: client-libs
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      FULL PRODUCT VERSION :
      P:\temp\dt>java -version
      java version "1.6.0-beta2"
      Java(TM) SE Runtime Environment (build 1.6.0-beta2-b75)
      Java HotSpot(TM) Client VM (build 1.6.0-beta2-b75, mixed mode)

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

      A DESCRIPTION OF THE PROBLEM :
      I'm using java.awt.Desktop to open MPG files from my Sony stills camera. I expect them to open in the default application (Windows Media Player).

      1) Sometimes they play in WMP OK.
      2) Sometimes I get an IOException with (Access is denied)
      3) Sometime the JVM crashes

      Please see attached testcase, DT.java
      (For path to sample file please refer comments section)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) Download the MPG files
      2) Update DT.java to have correct location for MPEG files
      3) Compile and run DT.java


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Files open in Windows Media Player
      ACTUAL -
      Output similar to the following is achieved:

      P:\temp\dt>java DT
      Opening P:\temp\dt\MOV01010.MPG
      java.io.IOException: Failed to open file:/P:/temp/dt/MOV01010.MPG. Error message: Access is denied.

              at sun.awt.windows.WDesktopPeer.ShellExecute(WDesktopPeer.java:59)
              at sun.awt.windows.WDesktopPeer.open(WDesktopPeer.java:36)
              at java.awt.Desktop.open(Desktop.java:252)
              at DT.process(DT.java:30)
              at DT.main(DT.java:15)
      Opening P:\temp\dt\MOV01012.MPG
      #
      # An unexpected error has been detected by Java Runtime Environment:
      #
      # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0b91887a, pid=2024, tid=3228
      #
      # Java VM: Java HotSpot(TM) Client VM (1.6.0-beta2-b75 mixed mode)
      # Problematic frame:
      # C [nvcpl.dll+0x5887a]
      #
      # An error report file with more information is saved as hs_err_pid2024.log
      #
      # If you would like to submit a bug report, please visit:
      # http://java.sun.com/webapps/bugreport/crash.jsp
      #

      Note that the number of iterations before the JVM crashes seems to vary randomly. The 'access is denied' message seems spurious, as the files are *not* read-only, and can be double-clicked OK to open them in WMP.




      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      #
      # An unexpected error has been detected by Java Runtime Environment:
      #
      # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0b91887a, pid=2024, tid=3228
      #
      # Java VM: Java HotSpot(TM) Client VM (1.6.0-beta2-b75 mixed mode)
      # Problematic frame:
      # C [nvcpl.dll+0x5887a]
      #
      # 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 (0x00296800): JavaThread "main" [_thread_in_native, id=3228]

      siginfo: ExceptionCode=0xc0000005, reading address 0x0b07f7bc

      Registers:
      EAX=0x0000e8f0, EBX=0x0090f7c0, ECX=0x00000000, EDX=0x00000001
      ESP=0x0090f71c, EBP=0x00000000, ESI=0x0b045418, EDI=0x0b043d58
      EIP=0x0b91887a, EFLAGS=0x00010202

        Top of Stack: (sp=0x0090f71c)
      0x0090f71c: 0090f81c 0b043d58 0090f7a0 0090f7c0
      0x0090f72c: 00000000 00000001 00000000 0b0115ec
      0x0090f73c: 00010015 0090f7a0 7ca46133 0b043d58
      0x0090f74c: 0090f7c0 000b8b70 000be8f0 00000000
      0x0090f75c: 00000000 0acf0cc8 0effffff 7c9d5ea8
      0x0090f76c: 7c9d5ea8 7c80a823 7c9d5d90 0090f79c
      0x0090f77c: 7ca97f79 0090fa4c 000b8b70 00000000
      0x0090f78c: 80004001 0090fa30 7ca46307 00000010

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


      Stack: [0x008c0000,0x00910000), sp=0x0090f71c, free space=317k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      C [nvcpl.dll+0x5887a]

      [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 DT.process(Ljava/lang/String;)V+40
      j DT.main([Ljava/lang/String;)V+15
      v ~StubRoutines::call_stub

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

      Java Threads: ( => current thread )
        0x0ace8c00 JavaThread "AWT-Windows" daemon [_thread_in_native, id=772]
        0x0acf0800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=2964]
        0x0ac0c400 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=3032]
        0x0ac09c00 JavaThread "CompilerThread0" daemon [_thread_blocked, id=2852]
        0x0ac08c00 JavaThread "Attach Listener" daemon [_thread_blocked, id=3856]
        0x0ab0fc00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2272]
        0x0aa59800 JavaThread "Finalizer" daemon [_thread_blocked, id=376]
        0x0aa55400 JavaThread "Reference Handler" daemon [_thread_blocked, id=2844]
      =>0x00296800 JavaThread "main" [_thread_in_native, id=3228]

      Other Threads:
        0x0aa4e000 VMThread [id=2884]
        0x0ac0dc00 WatcherThread [id=3748]

      VM state:not at safepoint (normal execution)

      VM Mutex/Monitor currently owned by a thread: None

      Heap
       def new generation total 960K, used 518K [0x02990000, 0x02a90000, 0x02e70000)
        eden space 896K, 57% used [0x02990000, 0x02a11988, 0x02a70000)
        from space 64K, 0% used [0x02a70000, 0x02a70000, 0x02a80000)
        to space 64K, 0% used [0x02a80000, 0x02a80000, 0x02a90000)
       tenured generation total 4096K, used 0K [0x02e70000, 0x03270000, 0x06990000)
         the space 4096K, 0% used [0x02e70000, 0x02e70000, 0x02e70200, 0x03270000)
       compacting perm gen total 12288K, used 3253K [0x06990000, 0x07590000, 0x0a990000)
         the space 12288K, 26% used [0x06990000, 0x06cbd520, 0x06cbd600, 0x07590000)
      No shared spaces configured.

      Dynamic libraries:
      0x00400000 - 0x00423000 C:\Program Files\Java\jdk1.6.0\bin\java.exe
      0x7c900000 - 0x7c9b0000 C:\WINDOWS\system32\ntdll.dll
      0x7c800000 - 0x7c8f4000 C:\WINDOWS\system32\kernel32.dll
      0x77dd0000 - 0x77e6b000 C:\WINDOWS\system32\ADVAPI32.dll
      0x77e70000 - 0x77f01000 C:\WINDOWS\system32\RPCRT4.dll
      0x7c340000 - 0x7c396000 C:\Program Files\Java\jdk1.6.0\jre\bin\msvcr71.dll
      0x6d7a0000 - 0x6d9d7000 C:\Program Files\Java\jdk1.6.0\jre\bin\client\jvm.dll
      0x77d40000 - 0x77dd0000 C:\WINDOWS\system32\USER32.dll
      0x77f10000 - 0x77f57000 C:\WINDOWS\system32\GDI32.dll
      0x76b40000 - 0x76b6d000 C:\WINDOWS\system32\WINMM.dll
      0x6d300000 - 0x6d308000 C:\Program Files\Java\jdk1.6.0\jre\bin\hpi.dll
      0x76bf0000 - 0x76bfb000 C:\WINDOWS\system32\PSAPI.DLL
      0x6d750000 - 0x6d75c000 C:\Program Files\Java\jdk1.6.0\jre\bin\verify.dll
      0x6d390000 - 0x6d3af000 C:\Program Files\Java\jdk1.6.0\jre\bin\java.dll
      0x6d790000 - 0x6d79f000 C:\Program Files\Java\jdk1.6.0\jre\bin\zip.dll
      0x6d000000 - 0x6d1bf000 C:\Program Files\Java\jdk1.6.0\jre\bin\awt.dll
      0x73000000 - 0x73026000 C:\WINDOWS\system32\WINSPOOL.DRV
      0x77c10000 - 0x77c68000 C:\WINDOWS\system32\msvcrt.dll
      0x76390000 - 0x763ad000 C:\WINDOWS\system32\IMM32.dll
      0x774e0000 - 0x7761d000 C:\WINDOWS\system32\ole32.dll
      0x73760000 - 0x737a9000 C:\WINDOWS\system32\ddraw.dll
      0x73bc0000 - 0x73bc6000 C:\WINDOWS\system32\DCIMAN32.dll
      0x7c9c0000 - 0x7d1d5000 C:\WINDOWS\system32\shell32.dll
      0x77f60000 - 0x77fd6000 C:\WINDOWS\system32\SHLWAPI.dll
      0x773d0000 - 0x774d2000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll
      0x5d090000 - 0x5d127000 C:\WINDOWS\system32\comctl32.dll
      0x5b860000 - 0x5b8b4000 C:\WINDOWS\system32\netapi32.dll
      0x77920000 - 0x77a13000 C:\WINDOWS\system32\SETUPAPI.dll
      0x769c0000 - 0x76a73000 C:\WINDOWS\system32\USERENV.dll
      0x77b40000 - 0x77b62000 C:\WINDOWS\system32\appHelp.dll
      0x76fd0000 - 0x7704f000 C:\WINDOWS\system32\CLBCATQ.DLL
      0x77050000 - 0x77115000 C:\WINDOWS\system32\COMRes.dll
      0x77120000 - 0x771ac000 C:\WINDOWS\system32\OLEAUT32.dll
      0x77c00000 - 0x77c08000 C:\WINDOWS\system32\VERSION.dll
      0x0b1f0000 - 0x0b22b000 C:\WINDOWS\system32\NVRSENG.DLL
      0x77a20000 - 0x77a74000 C:\WINDOWS\System32\cscui.dll
      0x76600000 - 0x7661d000 C:\WINDOWS\System32\CSCDLL.dll
      0x1c000000 - 0x1c008000 C:\Program Files\Vim\vim64\gvimext.dll
      0x78080000 - 0x78091000 C:\WINDOWS\system32\MSVCRT40.dll
      0x10000000 - 0x10013000 C:\Program Files\Vim\vim64\libintl.dll
      0x0b010000 - 0x0b025000 C:\WINDOWS\system32\wmpshell.dll
      0x71b20000 - 0x71b32000 C:\WINDOWS\system32\MPR.dll
      0x0b8c0000 - 0x0bfca000 C:\WINDOWS\system32\nvcpl.dll
      0x763b0000 - 0x763f9000 C:\WINDOWS\system32\comdlg32.dll
      0x74c80000 - 0x74cac000 C:\WINDOWS\system32\OLEACC.dll
      0x76080000 - 0x760e5000 C:\WINDOWS\system32\MSVCP60.dll
      0x5ad70000 - 0x5ada8000 C:\WINDOWS\system32\UxTheme.dll

      VM Arguments:
      java_command: DT
      Launcher Type: SUN_STANDARD

      Environment Variables:
      PATH=C:\Program Files\Vim\vim64;D:\rob\bin;C:\lpp\apache-ant-1.6.5\bin;C:\Program Files\Java\jdk1.6.0\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Common Files\GTK\2.0\bin;C:\lpp\jwsdp-2.0\jwsdp-shared\bin;C:\lpp\CVSNT\;C:\Program Files\OpenVPN\bin;;C:\PROGRA~1\COMMON~1\MUVEET~1\030625;C:\lpp\cvsnt;C:\lpp\unixutils\usr\local\wbin;d:\rob\cvs\priv\bin
      USERNAME=rob
      OS=Windows_NT
      PROCESSOR_IDENTIFIER=x86 Family 6 Model 6 Stepping 2, AuthenticAMD



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

      OS: Windows XP Build 2600 Service Pack 2

      CPU:total 1 family 6, cmov, cx8, fxsr, mmx, sse, mmxext, 3dnowext, 3dnow

      Memory: 4k page, physical 523760k(224268k free), swap 1542384k(1286096k free)

      vm_info: Java HotSpot(TM) Client VM (1.6.0-beta2-b75) for windows-x86, built on Mar 9 2006 00:29:19 by "java_re" with unknown MS VC++:1310



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

      import java.awt.Desktop;

      import java.io.File;

      public class DT {
          private static String[] fileNames = {
              "P:\\temp\\dt\\MOV01010.MPG",
              "P:\\temp\\dt\\MOV01012.MPG",
              "P:\\temp\\dt\\MOV01013.MPG",
              "P:\\temp\\dt\\MOV01038.MPG"};

          public static void main(String[] args) throws Exception {
              while (true) {
                  for (int i = 0; i < fileNames.length; i++) {
                      process(fileNames[i]);
                      try {
                          Thread.sleep(5000);
                      }
                      catch (Exception e) {
                      }
                  }
              }
          }

          public static void process(String s) {
              File f = new File(s);
              System.out.println("Opening " + f);
              try {
                  Desktop dt = Desktop.getDesktop();
                  dt.open(f);
              } catch (Exception e) {
                  e.printStackTrace();
              }
          }
      }

      ---------- END SOURCE ----------
      As I understand from the description of the problem submitter tries to open files that mounted from "Sony stills camera".

      I noticed that in attaced log file
      0x0b010000 - 0x0b025000 C:\WINDOWS\system32\wmpshell.dll
      library was loaded.

      I assume that the problem could be in WMP and mounted file system.

      I was wating long time to reproduce the problem but I could not.

      1. Could you try to reproduce the problem locally.
      2. Could you compile and run the next native program locally?

      ====================================

      // ShellResearch1.cpp : Defines the entry point for the application.
      //

      #include "stdafx.h"
      #include "shellapi.h"
      #include "stdio.h"

      int APIENTRY WinMain(HINSTANCE hInstance,
      HINSTANCE hPrevInstance,
      LPSTR lpCmdLine,
      int nCmdShow)

      {
      if (strlen(lpCmdLine)==0) {
      MessageBoxW(NULL, L"Please specify path to the MPEG file",L"Warning",MB_OK);
      return -1;
      }

      wchar_t *strBuffer = (wchar_t *)malloc( sizeof( wchar_t ));

      mbstowcs(strBuffer,lpCmdLine,strlen(lpCmdLine)+1);

      if (MessageBoxW(NULL, (LPWSTR)strBuffer, L"WMP test",MB_YESNO) == IDNO) {
      return -1;
      }

      for (int i=100; i>0; i--) {
      ShellExecuteW(NULL,L"open",strBuffer, NULL, NULL, SW_SHOWNORMAL);

      int lastError = GetLastError();

      if (lastError) {

      LPVOID buffer;
      int len = FormatMessageW(
      FORMAT_MESSAGE_ALLOCATE_BUFFER |
      FORMAT_MESSAGE_FROM_SYSTEM |
      FORMAT_MESSAGE_IGNORE_INSERTS,
      NULL,
      lastError,
      MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
      (LPWSTR) &buffer,
      0,
      NULL );

      MessageBoxW(NULL, (LPWSTR)buffer, L"From native",0);
      return 0;
      }

      Sleep(5000);

      }
      }

      ===============================


      if you cannot compile the source code you could try to use attached compilied version.

      Please execute the application following way:

      ShellResearch1 file:/<path to your mpeg file>

      If you would see a crash the problem is not related to Desktop API.

        Attachments

          Activity

            People

            • Assignee:
              denis Denis Fokin (Inactive)
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: