Bug 618258

Summary: Printing from java fails when job-state-reasons contains printer-stopped
Product: Red Hat Enterprise Linux 6 Reporter: Tim Waugh <twaugh>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: qe-baseos-tools-bugs
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: aph, jakub, mfranc, pmuller
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: gcc-4.4.5-5.el6 Doc Type: Bug Fix
Doc Text:
Previously, if a Java application built with gcj attempted to submit a print job to a print queue that was disabled, the process would enter a busy loop. This update fixes this issue by first checking if the print queue is null before attempting to send it a print job.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 13:57:44 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
print.java none

Description Tim Waugh 2010-07-26 14:06:39 UTC
Description of problem:
The attached source file, built using gcj, goes into a busy loop after submitting the print job to a print queue that is not enabled.

Version-Release number of selected component (if applicable):
gcc-java-4.4.4-12.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Create a print queue and disable it (or: plug in a USB printer, switch it on, then after the queue is created switch it off again)
2. gcj -o print --main=print print.java
3. ./print
  
Actual results:
After displaying the name of the printer, the job is submitted but then the process goes into a busy loop.

Expected results:
No busy loop, process exits.

Additional info:
Found while investigating bug #595852.

Comment 1 Tim Waugh 2010-07-26 14:07:09 UTC
Created attachment 434427 [details]
print.java

Comment 2 Tim Waugh 2010-07-26 14:07:43 UTC
When examining it under gdb it seems to be due to the 'printer-stopped' string in the job-state-reasons attribute.

Comment 4 Andrew Haley 2010-07-30 10:44:48 UTC
Fixed by:

2010-07-30  Andrew Haley  <aph>

        * javax/print/attribute/standard/JobStateReasons.java (add): Fix
        infinite recursion with call to super.

Index: classpath/javax/print/attribute/standard/JobStateReasons.java
===================================================================
--- classpath/javax/print/attribute/standard/JobStateReasons.java       (revision 159065)
+++ classpath/javax/print/attribute/standard/JobStateReasons.java       (working copy)
@@ -129,7 +129,7 @@
     if (o == null)
       throw new NullPointerException("reason is null");  
     
-    return add(o);
+    return super.add(o);
   }
   
   /**

Comment 5 Jakub Jelinek 2010-07-30 10:48:00 UTC
Thanks, reassigning to self to actually backport this for RHEL 6.1.

Comment 7 Jakub Jelinek 2010-08-11 13:17:44 UTC
Seems Andrew has backported this to branches/gcc-4_{4,5}-branch/ already (and other libjava fixes too), so it will make it into the 4.[45]-RH branches whenever the new releases are prepared for them (as that includes merging from corresponding upstream branch).

Comment 10 Ryan Lerch 2011-04-20 04:29:57 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
libgcj printing has been fixed.

Comment 13 Ryan Lerch 2011-05-05 03:39:00 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-libgcj printing has been fixed.+Previously, if a Java application built with gcj attempted to submit a print job to a print queue that was disabled, the process would enter a busy loop.  This update fixes this issue by first checking if the print queue is null before attempting to send it a print job.

Comment 14 errata-xmlrpc 2011-05-19 13:57:44 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0663.html