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

Exceptions thrown when creating diff print jobs on different threads multiple times, WinXP

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6
    • client-libs
    • 2d
    • x86
    • windows_xp

      I have an infinite loop within which I am creating 3 threads for each iteration. In thread 1, I am creating a PrintJob and calling some methods on print job and disposing it, without actually printing anything. In thread2, I am doing the same for PrinterJob and in thread 3, I am doing for DocPrintJob.

      This test is executed indefinitely and nothing is actually printed. However, all the print jobs are using the same printer. After some loops, I am seeing lot of different exceptions being thrown by Toolkit.getPrintJob(). Here are the stack traces:

      java.lang.NullPointerException
      at sun.print.Win32PrintService.initMedia(Win32PrintService.java:303)
      at sun.print.Win32PrintService.getSupportedAttributeValues(Win32PrintService.java:1139)
      at sun.print.RasterPrinterJob.updatePageAttributes(RasterPrinterJob.java:519)
      at sun.print.RasterPrinterJob.setPrintable(RasterPrinterJob.java:965)
      at sun.print.PrintJob2D.printDialog(PrintJob2D.java:475)
      at sun.awt.windows.WToolkit.getPrintJob(WToolkit.java:632)
      at MultiPrint$PrintJobThread.run(MultiPrint.java:50)
      at java.lang.Thread.run(Thread.java:619)

      java.awt.print.PrinterException: Invalid name of PrintService.
      at sun.awt.windows.WPrinterJob.setNativePrintService(Native Method)
      at sun.awt.windows.WPrinterJob.getPrintService(WPrinterJob.java:573)
      at sun.print.PrintJob2D.printDialog(PrintJob2D.java:392)
      at sun.awt.windows.WToolkit.getPrintJob(WToolkit.java:632)
      at MultiPrint$PrintJobThread.run(MultiPrint.java:50)
      at java.lang.Thread.run(Thread.java:619)

      This is reproduced on WinXP with a Xerox Docuprint N4025 printer with Mustang-b89. This is not reproducible on Tiger-FCS on the same machine. When I reduce the heap size to 8MB the problem becomes visible quickly. It appears like a regression in Mustang.

      I have attached a sample test. Execute the sample test (if you want to see the exceptions quickly, bring down the heap size). Allow the test to run for some loops. You will see the above exceptions on the console.

            prr Philip Race
            pmohansunw Praveen Mohan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: