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

PrinterJob.printDialog() crashes JVM when called from subthread

    XMLWordPrintable

    Details

    • Subcomponent:
      2d
    • Resolved In Build:
      b02
    • CPU:
      other, x86
    • OS:
      windows_xp, windows_vista

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.5.0_02"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
        Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)

        FULL OS VERSION :
        Microsoft Windows XP [Version 5.1.2600]

        EXTRA RELEVANT SYSTEM CONFIGURATION :
        Appears to be printer independent.

        A DESCRIPTION OF THE PROBLEM :
        calling PrinterJob.printDialog() from a subthread crashes the JVM. This looks like a timing-related issue, since it crashes the JVM only in abut 50% of the cases.

        THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes

        THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Run the program below, not with debugger (this reduces the chance of a crash). Click OK on the page setup dialog. After that the program crashes the JVM in most caes 8 out of 10.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        Expected is that after the step above a print dialog appears, but instead the JVM crashes.
        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        ================ Error test on console: ======================
        #
        # An unexpected error has been detected by HotSpot Virtual Machine:
        #
        # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x755c4f0d, pid=4984, tid=4060
        #
        # Java VM: Java HotSpot(TM) Client VM (1.5.0_02-b09 mixed mode, sharing)
        # Problematic frame:
        # C [msctfime.ime+0x4f0d]
        #
        # An error report file with more information is saved as hs_err_pid4984.log
        #
        # If you would like to submit a bug report, please visit:
        # http://java.sun.com/webapps/bugreport/crash.jsp
        #

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

        ============= contents of sump file: ==================
        #
        # An unexpected error has been detected by HotSpot Virtual Machine:
        #
        # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x755c4f0d, pid=4984, tid=4060
        #
        # Java VM: Java HotSpot(TM) Client VM (1.5.0_02-b09 mixed mode, sharing)
        # Problematic frame:
        # C [msctfime.ime+0x4f0d]
        #

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

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

        siginfo: ExceptionCode=0xc0000005, reading address 0x006e0069

        Registers:
        EAX=0x006e0069, EBX=0x00000000, ECX=0x0319e738, EDX=0x00080608
        ESP=0x0319e718, EBP=0x0319e71c, ESI=0x0319e738, EDI=0x000911e8
        EIP=0x755c4f0d, EFLAGS=0x00010206

          Top of Stack: (sp=0x0319e718)
        0x0319e718: 0319e738 0319e72c 755c5179 006e0069
        0x0319e728: 80004005 0319e740 755c552b 006e0069
        0x0319e738: 755c1454 006e0069 0319e784 755c567c
        0x0319e748: 0319e77c 0319e76c 000911e8 000b0a40
        0x0319e758: 755c1444 000c2f50 03b70bab 00000000
        0x0319e768: 00000000 755c1520 000ce078 00a20024
        0x0319e778: 00000000 755c62bf 000b0a40 0319e7d4
        0x0319e788: 755c62ce 000c7c70 00000000 00010c8b

        Instructions: (pc=0x755c4f0d)
        0x755c4efd: 85 c0 56 8b f1 89 46 04 c7 06 54 14 5c 75 74 06
        0x755c4f0d: 8b 08 50 ff 51 04 8b c6 5e 5d c2 04 00 cc cc cc


        Stack: [0x03160000,0x031a0000), sp=0x0319e718, free space=249k
        Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
        C [msctfime.ime+0x4f0d]
        C [msctfime.ime+0x5179]
        C [msctfime.ime+0x552b]
        C [msctfime.ime+0x567c]
        C [msctfime.ime+0x62ce]
        C [msctfime.ime+0x6f7a]
        C [msctfime.ime+0x196e0]
        C [IMM32.DLL+0x2ae3]
        C [USER32.dll+0x5b4ae]
        C [USER32.dll+0x5b991]
        C [USER32.dll+0x5c46b]
        C [USER32.dll+0x5c519]
        C [USER32.dll+0x8709]
        C [USER32.dll+0x87eb]
        C [USER32.dll+0xb368]
        C [USER32.dll+0xb3b4]
        C [ntdll.dll+0xeae3]
        C [COMDLG32.DLL+0x230be]
        C [USER32.dll+0x8709]
        C [USER32.dll+0x151cd]
        C [USER32.dll+0x14af2]
        C [USER32.dll+0x14d1c]
        C [USER32.dll+0x8709]
        C [USER32.dll+0x87eb]
        C [USER32.dll+0xb743]
        C [USER32.dll+0x158ef]
        C [USER32.dll+0x16877]
        C [USER32.dll+0x168cc]
        C [COMDLG32.DLL+0x2332a]
        C [COMDLG32.DLL+0x238d7]
        C [COMDLG32.DLL+0x2479f]
        C [awt.dll+0xd9d7e]
        C [USER32.dll+0x8709]
        C [USER32.dll+0x87eb]
        C [USER32.dll+0xb368]
        C [USER32.dll+0xb3b4]
        C [ntdll.dll+0xeae3]
        C [USER32.dll+0x93df]

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

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

        Java Threads: ( => current thread )
          0x00846390 JavaThread "Thread-3" [_thread_in_native, id=5196]
          0x00845b10 JavaThread "DestroyJavaVM" [_thread_blocked, id=5180]
          0x00842130 JavaThread "AWT-EventQueue-0" [_thread_in_native, id=5176]
        =>0x00840e80 JavaThread "AWT-Windows" daemon [_thread_in_native, id=4060]
          0x0083f4a0 JavaThread "AWT-Shutdown" [_thread_blocked, id=4124]
          0x0083ae80 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=5920]
          0x008319e0 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=5036]
          0x00830e70 JavaThread "CompilerThread0" daemon [_thread_blocked, id=3116]
          0x0082fc40 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3344]
          0x0082ed40 JavaThread "Finalizer" daemon [_thread_blocked, id=5028]
          0x0082dad0 JavaThread "Reference Handler" daemon [_thread_blocked, id=4804]

        Other Threads:
          0x0082cd20 VMThread [id=4960]
          0x00834d90 WatcherThread [id=5040]

        VM state:not at safepoint (normal execution)

        VM Mutex/Monitor currently owned by a thread: None

        Heap
         def new generation total 576K, used 501K [0x22cd0000, 0x22d70000, 0x231b0000)
          eden space 512K, 85% used [0x22cd0000, 0x22d3d670, 0x22d50000)
          from space 64K, 100% used [0x22d60000, 0x22d70000, 0x22d70000)
          to space 64K, 0% used [0x22d50000, 0x22d50000, 0x22d60000)
         tenured generation total 1408K, used 182K [0x231b0000, 0x23310000, 0x26cd0000)
           the space 1408K, 12% used [0x231b0000, 0x231ddbf0, 0x231ddc00, 0x23310000)
         compacting perm gen total 8192K, used 359K [0x26cd0000, 0x274d0000, 0x2acd0000)
           the space 8192K, 4% used [0x26cd0000, 0x26d29c20, 0x26d29e00, 0x274d0000)
            ro space 8192K, 62% used [0x2acd0000, 0x2b1d8018, 0x2b1d8200, 0x2b4d0000)
            rw space 12288K, 46% used [0x2b4d0000, 0x2ba5c620, 0x2ba5c800, 0x2c0d0000)

        Dynamic libraries:
        0x00400000 - 0x0040c000 C:\Program Files\Java\jre1.5.0_02\bin\javaw.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
        0x77d40000 - 0x77dd0000 C:\WINDOWS\system32\USER32.dll
        0x77f10000 - 0x77f56000 C:\WINDOWS\system32\GDI32.dll
        0x77c10000 - 0x77c68000 C:\WINDOWS\system32\MSVCRT.dll
        0x76390000 - 0x763ad000 C:\WINDOWS\system32\IMM32.DLL
        0x629c0000 - 0x629c9000 C:\WINDOWS\system32\LPK.DLL
        0x74d90000 - 0x74dfb000 C:\WINDOWS\system32\USP10.dll
        0x67900000 - 0x6793a000 C:\Program Files\Norman\Nvc\BIN\Niphk.dll
        0x77120000 - 0x771ac000 C:\WINDOWS\system32\OLEAUT32.dll
        0x774e0000 - 0x7761d000 C:\WINDOWS\system32\ole32.dll
        0x6d640000 - 0x6d7c5000 C:\Program Files\Java\jre1.5.0_02\bin\client\jvm.dll
        0x76b40000 - 0x76b6d000 C:\WINDOWS\system32\WINMM.dll
        0x6d280000 - 0x6d288000 C:\Program Files\Java\jre1.5.0_02\bin\hpi.dll
        0x76bf0000 - 0x76bfb000 C:\WINDOWS\system32\PSAPI.DLL
        0x6d610000 - 0x6d61c000 C:\Program Files\Java\jre1.5.0_02\bin\verify.dll
        0x6d300000 - 0x6d31d000 C:\Program Files\Java\jre1.5.0_02\bin\java.dll
        0x6d630000 - 0x6d63f000 C:\Program Files\Java\jre1.5.0_02\bin\zip.dll
        0x6d000000 - 0x6d166000 C:\Program Files\Java\jre1.5.0_02\bin\awt.dll
        0x73000000 - 0x73026000 C:\WINDOWS\system32\WINSPOOL.DRV
        0x5ad70000 - 0x5ada8000 C:\WINDOWS\system32\uxtheme.dll
        0x73760000 - 0x737a9000 C:\WINDOWS\system32\ddraw.dll
        0x73bc0000 - 0x73bc6000 C:\WINDOWS\system32\DCIMAN32.dll
        0x73940000 - 0x73a10000 C:\WINDOWS\system32\D3DIM700.DLL
        0x6d240000 - 0x6d27d000 C:\Program Files\Java\jre1.5.0_02\bin\fontmanager.dll
        0x74720000 - 0x7476b000 C:\WINDOWS\system32\MSCTF.dll
        0x755c0000 - 0x755ee000 C:\WINDOWS\system32\msctfime.ime
        0x77fe0000 - 0x77ff1000 C:\WINDOWS\system32\Secur32.dll
        0x76fd0000 - 0x7704f000 C:\WINDOWS\system32\CLBCATQ.DLL
        0x77050000 - 0x77115000 C:\WINDOWS\system32\COMRes.dll
        0x77c00000 - 0x77c08000 C:\WINDOWS\system32\VERSION.dll
        0x605d0000 - 0x605d9000 C:\WINDOWS\system32\mslbui.dll
        0x7c9c0000 - 0x7d1d4000 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
        0x763b0000 - 0x763f9000 C:\WINDOWS\system32\COMDLG32.DLL
        0x60600000 - 0x60644000 C:\WINDOWS\System32\spool\DRIVERS\W32X86\3\hpzntp04.dll
        0x10000000 - 0x1001e000 C:\WINDOWS\System32\spool\DRIVERS\W32X86\3\hpz2ku04.dll

        VM Arguments:
        jvm_args: -enableassertions -Xbootclasspath:C:\Program Files\Java\jre1.5.0_02\lib\rt.jar;C:\Program Files\Java\jre1.5.0_02\lib\jsse.jar;C:\Program Files\Java\jre1.5.0_02\lib\jce.jar;C:\Program Files\Java\jre1.5.0_02\lib\charsets.jar;C:\Program Files\Java\jre1.5.0_02\lib\ext\dnsns.jar;C:\Program Files\Java\jre1.5.0_02\lib\ext\localedata.jar;C:\Program Files\Java\jre1.5.0_02\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jre1.5.0_02\lib\ext\sunpkcs11.jar
        java_command: nl.timeware.bizsim.bizedit.BizEditApp

        Environment Variables:
        PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System
        USERNAME=paul
        OS=Windows_NT
        PROCESSOR_IDENTIFIER=x86 Family 6 Model 8 Stepping 3, GenuineIntel


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

        OS: Windows XP Build 2600 Service Pack 2

        CPU:total 1 family 6, cmov, cx8, fxsr, mmx, sse

        Memory: 4k page, physical 523496k(31028k free), swap 1540588k(196788k free)

        vm_info: Java HotSpot(TM) Client VM (1.5.0_02-b09) for windows-x86, built on Mar 4 2005 01:53:53 by "java_re" with MS VC++ 6.0



        REPRODUCIBILITY :
        This bug can be reproduced often.

        ---------- BEGIN SOURCE ----------
        package nl.timeware.bizsim.bizedit;
        import java.awt.Graphics;
        import java.awt.print.*;
        import javax.swing.*;
        import javax.swing.SwingUtilities;

        public class CrashJVM
        { static public void main(String[] args)
          { new AFrame().setVisible(true);
          }
          private static class AFrame extends JFrame
          { public AFrame()
             { final APanel aPanel = new APanel();
                SwingUtilities.invokeLater(new Runnable()
                     { public void run()
                         { aPanel.startPrint();
                         }
                     });
             }
          }
          private static class APanel extends JPanel
          { private APrintable report;
             public APanel()
             { report = new APrintable();
             }
             public Book getBook(PageFormat format)
             { return report.getBook(format);
             }
             public void startPrint()
             { PrinterJob job = PrinterJob.getPrinterJob();
                Paper a4Paper = new Paper();
                a4Paper.setSize(595, 840);
                a4Paper.setImageableArea(40, 40, 515, 760);
                PageFormat pageFormat = job.defaultPage();
                pageFormat.setOrientation(PageFormat.PORTRAIT);
                pageFormat.setPaper(a4Paper);
                pageFormat = job.pageDialog(pageFormat);
                job.setPageable(getBook(pageFormat));
                job.printDialog(); // <-- crashes the JVM
             }
             private class APrintable extends JPanel implements Printable
             { public Book getBook(PageFormat format)
                { return new PrintBook(format);
                }
                public int print(Graphics g, PageFormat format, int page)
                { return PAGE_EXISTS;
                }
                private class PrintBook extends Book
                { public PrintBook(PageFormat format)
                   { append(APrintable.this, format, 1);
                   }
                }
             }
          }
        }


        ---------- END SOURCE ----------
        Submitter provided the following two updates

        I tested this this today with 1.5.0_06. It still results in the same JVM
        crash.
        I tested it with several types of printers:
        - local printer HP d135, driver version 1.0 (USB),
        - network printer, HP 4550, driver version 2.0.5
        - fax, HP d135, driver version 1.0 (USB),
        - PDF driver, Jaws PdfCreator 3.0
        They all result in the same crash. So, I really don't believe it's a
        printer driver issue.
        I tried it on several computers, but got the error only on the following
        computer:
        - A Dell OptiPlex GX200, the CPU is an Processor Pentium III, Family 6
        Model 8 Stepping 3 GenuineIntel ~662 Mhz.
        - I was using Windows XP home (version 2002, SP-2, build 2600, with all
        updates installed).

        ------------------------------------

        Just tried with mustang dated Dec 1. Got same crash.
        No crash on:
        - DELL Inspiron 5160, Pentium 4, 2.80 GHz
        - DELL Inspiron 1150, Intel Celeron, 2.40 GHz
        - DELL Dimension 4600, Pentium 4, 2.40 GHz
        - DELL Dimension 200, Intel Celeron, 1.10 Ghz
        All with Windows XP home (version 2002, SP-2, build 2600, with all
        updates installed).

        Maybe more interesting: I just found that it only crashes if I run the
        program under
        my Eclipse (3.1.1) development environment (both debug and normal mode).
        If a create a JAR from it, then start it from there (outside Eclipse), I
        have no VM crash.
        ------------------------------------

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                jgodinez Jennifer Godinez (Inactive)
                Reporter:
                prr Philip Race
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: