[Bug 1100343] [NEW] Error on some forked thread termination in python threading module

Charles R. Harwood charles.harwood at zuerchertech.com
Wed Jan 16 16:02:37 UTC 2013


Public bug reported:

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.

** Affects: python2.7 (Ubuntu)
     Importance: Undecided
         Status: New

** Patch added: "Patch from Python Bug 14308"
   https://bugs.launchpad.net/bugs/1100343/+attachment/3484789/+files/dummythreadafterfork2.patch

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python2.7 in Ubuntu.
https://bugs.launchpad.net/bugs/1100343

Title:
  Error on some forked thread termination in python threading module

Status in “python2.7” package in Ubuntu:
  New

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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/1100343/+subscriptions




More information about the foundations-bugs mailing list