-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
6
-
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.
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.
- duplicates
-
JDK-6446094 Win32PrintServiceLookup.getPrintServiceByName() should not recreate duplicate instances.
- Closed
- relates to
-
JDK-6255588 JDK windows printing implementation leaks GDI objects.
- Resolved