Error on some forked thread termination in python threading module

Bug #1100343 reported by Charles R. Harwood
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python2.7 (Ubuntu)
Fix Released
Undecided
Unassigned
Precise
Fix Released
Undecided
Unassigned

Bug Description

I'd like for the fix to python issue 14308 to be ported to python2.7 in Ubuntu Precise.
http://bugs.python.org/issue14308

As near as I can tell, it affects python 2.7 threading.Thread threads which have were are created, call currentThread(), are then forked, and then terminate.

For my purposes, it is affecting some code I wrote which does spawns processes to run simple shell scripts in the background. It also seems to have affected various Django projects as well as Duplicity as per https://bugs.launchpad.net/duplicity/+bug/946993. As I read that ticket, it was fixed via a workaround in Duplicity/Debbugs? It seems to me that this is really a Python2.7 bug.

I was able to easily reproduce this bug with this small test case as per the python bug ticket on Ubuntu Precise Server:
<code>
#!/usr/bin/python
import os
import thread
import threading
import time

def t():
    threading.currentThread() # Populate threading._active with a DummyThread
    time.sleep(3)

thread.start_new_thread(t, ())
time.sleep(1)

pid = os.fork()
if pid == 0:
    os._exit(0)

os.waitpid(pid, 0)
</code>

The fix is a simple two-line patch to threading.py implemented by the fix for python bug 14308. I have also attached that, again from http://bugs.python.org/issue14308.

As far as I can tell, this has not made its way from upstream to Precise. My sincerest apologies if this is reported elsewhere or my report is somehow inappropriate.

Revision history for this message
Charles R. Harwood (charles-harwood) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Patch from Python Bug 14308" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
Matthias Klose (doko) wrote :

fixed in quantal and raring

Changed in python2.7 (Ubuntu Precise):
milestone: none → precise-updates
status: New → In Progress
Changed in python2.7 (Ubuntu):
status: New → Fix Released
Revision history for this message
Chris Halse Rogers (raof) wrote : Please test proposed package

Hello Charles, or anyone else affected,

Accepted python2.7 into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/python2.7/2.7.3-0ubuntu3.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in python2.7 (Ubuntu Precise):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Colin Watson (cjwatson) wrote :

This seems to be doing the right thing; no exception now with the provided test case.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Scott Kitterman (kitterman) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python2.7 - 2.7.3-0ubuntu3.2

---------------
python2.7 (2.7.3-0ubuntu3.2) precise-proposed; urgency=low

  * Backport fix for issue #14308. Fix an exception when a "dummy" thread is
    in the threading module's active list after a fork(). LP: #1100343.
  * Remove dangling symlink in pkgconfig. LP: #1088771.
  * Make python2.7{,-minimal,-dbg} Multi-Arch: allowed. LP: #1130709.
 -- Matthias Klose <email address hidden> Thu, 28 Mar 2013 12:40:39 +0100

Changed in python2.7 (Ubuntu Precise):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.