JDK-4997933 : REG: Printing from multiple threads throws Exception when printer is busy
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux_redhat_4.0,solaris_9
  • CPU: x86,sparc
  • Submitted: 2004-02-20
  • Updated: 2006-10-04
  • Resolved: 2005-12-05
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 6
6 b63Fixed
Related Reports
Duplicate :  
Description
I am printing an image to the same print service from 2 different threads where each thread maintains it's own print data and DocPrintJob. When the printer is busy printing a huge document or currently waiting for user input, this multithread test throws a PrintJobFlavorException saying invalid flavor. The flavor is actually supported by the printer and this application works fine when printer is not busy. 

This is reproducible only on Solaris / Linux systems and not reproducible on win32 platforms. I executed this application on Tiger-beta-b09 and the application waits for a long time to complete. When I execute the same application on Tiger-beta-b30, I am getting this exception. I am using a Xerox Docuprint N4025 printer and I have CUPS installed on my machine. I tested this with Solaris 9, JDS and Linux RH 9 and I am able to reproduce the problem.

I have attached a test. Execute it as follows:
java MultiThreadTest fish.gif
Before running this command, make the printer busy. Probably the easy way to to do this is to make the printer wait for user input by changing the default media size. When I do that, my printer (Xerox Docuprint N4025) waits and asks the user whether it can use the default paper. During that time, I get the exception when I run the attached multithread test.

Here is the exception:
sun.print.PrintJobFlavorException: invalid flavor
 at sun.print.UnixPrintJob.print(UnixPrintJob.java:306)
 at MultiThreadTest.print(MultiThreadTest.java:25)
 at MultiThreadTest.run(MultiThreadTest.java:34)

I could not trace out the build in which this was introduced, though i could figure out that it is introduced between b10 - b29 (both inclusive).

Comments
EVALUATION The new thread's flag already indicated that list of docflavors is already initialized but in fact the list is still null. Need a synchronize block.
17-11-2005

EVALUATION ===================================== Function that initializes different attributes need to be synchronized. ###@###.### 2004-02-23 ===================================
23-02-2004