Bug 567386

Summary: pycups crash in Connection_dealloc() from free()
Product: [Fedora] Fedora Reporter: Edgar Hoch <edgar.hoch>
Component: system-config-printerAssignee: Tim Waugh <twaugh>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: batucador, dmatejic, joflixo, jplorier, jpopelka, lenumina, richard, SnakyChic, sorkan, tom, twaugh, vonbrand, ykt
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: abrt_hash:f0fdb438586f17077ce67a04e9681ef40dbb24d2
Fixed In Version: system-config-printer-1.1.18-2.fc11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 571451 (view as bug list) Environment:
Last Closed: 2010-03-20 03:40:16 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:
Bug Depends On:    
Bug Blocks: 571451    
Attachments:
Description Flags
File: backtrace none

Description Edgar Hoch 2010-02-22 20:04:46 UTC
abrt 1.0.6 detected a crash.

architecture: x86_64
Attached file: backtrace
cmdline: python /usr/share/system-config-printer/applet.py
component: system-config-printer
executable: /usr/bin/python
kernel: 2.6.31.12-174.2.3.fc12.x86_64
package: system-config-printer-1.1.16-13.fc12
rating: 4
reason: Process was terminated by signal 6 (Aborted)
release: Fedora release 12 (Constantine)

How to reproduce
-----
I don't know how to reproduce.
I just printed something and deleted some jobs from the print server queue, and then the printer applet crashes.

Comment 1 Edgar Hoch 2010-02-22 20:04:48 UTC
Created attachment 395557 [details]
File: backtrace

Comment 2 Jiri Popelka 2010-02-23 10:29:42 UTC
Can you describe how exactly did you deleted those jobs ? Thanks.

Comment 3 Tim Waugh 2010-02-23 15:36:19 UTC
So the crash was from freeing the list of Connection objects, and it was most likely caused by some kind of memory scribble.

The only thing I can see wrong in that code is that it assumes the to-be-dealloc'd Connection object appears in the list.  However, it ought to.

Anyway, I can harden that (to protect against e.g. bit-errors) by only removing the object from the list if it appears there in the first place.  Hopefully that will prevent this kind of problem.

Comment 4 Tim Waugh 2010-02-23 16:31:10 UTC
Fixed upstream.

Comment 5 Tim Waugh 2010-03-08 15:18:00 UTC
I've discovered the reason for this, and have confirmed that the upstream fix is correct.

First, a reproducer:

==>
import signal
import cups

def alarmclock (signum, frame):
    raise KeyboardInterrupt

signal.signal (signal.SIGALRM, alarmclock)
connections = []
while True:
    # Create
    signal.alarm (10)
    connections.append (cups.Connection ())
    signal.alarm (0)
<==

This just keeps creating more and more connections until cupsd stops accepting them (when it hits its maximum file descriptor count).  At that point, the program raises an exception and exits.

What happens is that Connection_init() fails *before* the newly-allocated Connection object is added into the list.  As the initialization failed, the object is deallocated with Connection_dealloc(), and of course that assumes the object is in the list.

So the correct behaviour is to verify that the connection is in the list before trying to remove it.

Comment 7 Jiri Popelka 2010-03-08 15:48:01 UTC
*** Bug 571356 has been marked as a duplicate of this bug. ***

Comment 8 Jiri Popelka 2010-03-08 15:49:29 UTC
*** Bug 570806 has been marked as a duplicate of this bug. ***

Comment 10 Fedora Update System 2010-03-10 10:48:13 UTC
system-config-printer-1.1.93-6.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/system-config-printer-1.1.93-6.fc13

Comment 11 Fedora Update System 2010-03-11 07:20:10 UTC
system-config-printer-1.1.93-6.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update system-config-printer'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/system-config-printer-1.1.93-6.fc13

Comment 12 Fedora Update System 2010-03-13 11:25:20 UTC
system-config-printer-1.1.18-1.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/system-config-printer-1.1.18-1.fc12

Comment 13 Fedora Update System 2010-03-13 11:27:40 UTC
system-config-printer-1.1.18-1.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/system-config-printer-1.1.18-1.fc11

Comment 14 Tim Waugh 2010-03-13 11:28:33 UTC
*** Bug 573157 has been marked as a duplicate of this bug. ***

Comment 15 Jiri Popelka 2010-03-15 08:59:01 UTC
*** Bug 573379 has been marked as a duplicate of this bug. ***

Comment 16 Fedora Update System 2010-03-16 00:38:47 UTC
system-config-printer-1.1.18-1.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update system-config-printer'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/system-config-printer-1.1.18-1.fc11

Comment 17 Fedora Update System 2010-03-16 00:52:51 UTC
system-config-printer-1.1.18-1.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update system-config-printer'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/system-config-printer-1.1.18-1.fc12

Comment 18 Fedora Update System 2010-03-16 23:21:15 UTC
system-config-printer-1.1.93-6.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 19 Fedora Update System 2010-03-18 03:15:15 UTC
system-config-printer-1.1.18-2.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update system-config-printer'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/system-config-printer-1.1.18-2.fc12

Comment 20 Fedora Update System 2010-03-18 03:29:39 UTC
system-config-printer-1.1.18-2.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update system-config-printer'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/system-config-printer-1.1.18-2.fc11

Comment 21 Fedora Update System 2010-03-20 03:39:30 UTC
system-config-printer-1.1.18-2.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 22 Fedora Update System 2010-03-23 02:11:37 UTC
system-config-printer-1.1.18-2.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 23 Tim Waugh 2010-03-29 15:55:13 UTC
*** Bug 556686 has been marked as a duplicate of this bug. ***