This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Omer.Katz
Recipients Omer.Katz, vstinner
Date 2014-12-06.16:55:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1417884952.02.0.0666112917824.issue22985@psf.upfronthosting.co.za>
In-reply-to
Content
Capturing the signal provides the following traceback:
File "mt_example.py", line 10, in <module>
    p1 = ThreadPool()
  File "/home/omer/.virtualenvs/billiard/lib/python2.7/site-packages/billiard/pool.py", line 1016, in __init__
    self._result_handler.start()
  File "/home/omer/.virtualenvs/billiard/lib/python2.7/site-packages/billiard/pool.py", line 504, in start
    super(PoolThread, self).start(*args, **kwargs)
  File "/home/omer/.virtualenvs/billiard/lib/python2.7/site-packages/billiard/py2/dummy/__init__.py", line 69, in start
    threading.Thread.start(self)
  File "/home/omer/.pyenv/versions/2.7.8/lib/python2.7/threading.py", line 750, in start
    self.__started.wait()
  File "/home/omer/.pyenv/versions/2.7.8/lib/python2.7/threading.py", line 620, in wait
    self.__cond.wait(timeout)
  File "/home/omer/.pyenv/versions/2.7.8/lib/python2.7/threading.py", line 339, in wait
    waiter.acquire()
  File "mt_example.py", line 6, in handler
    print(''.join(traceback.format_stack(frame)))

  File "mt_example.py", line 10, in <module>
    p1 = ThreadPool()
  File "/home/omer/.virtualenvs/billiard/lib/python2.7/site-packages/billiard/pool.py", line 1016, in __init__
    self._result_handler.start()
  File "/home/omer/.virtualenvs/billiard/lib/python2.7/site-packages/billiard/pool.py", line 504, in start
    super(PoolThread, self).start(*args, **kwargs)
  File "/home/omer/.virtualenvs/billiard/lib/python2.7/site-packages/billiard/py2/dummy/__init__.py", line 69, in start
    threading.Thread.start(self)
  File "/home/omer/.pyenv/versions/2.7.8/lib/python2.7/threading.py", line 750, in start
    self.__started.wait()
  File "/home/omer/.pyenv/versions/2.7.8/lib/python2.7/threading.py", line 620, in wait
    self.__cond.wait(timeout)
  File "/home/omer/.pyenv/versions/2.7.8/lib/python2.7/threading.py", line 339, in wait
    waiter.acquire()

The following code reproduces that traceback every time:
from billiard.pool import ThreadPool
import signal

def handler(signum, frame):
        import traceback
        print(''.join(traceback.format_stack(frame)))

signal.signal(signal.SIGTERM, handler)

p1 = ThreadPool()

class Foo(object):
    def a(self):
        print("a")
        return 1

    def do(self):
        return p1.apply_async(self.a)


foo = Foo()
r = foo.do()

print(r.get())
p1.close()
p1.join()

I'm convinced that there is a bug somewhere and it seems that Python is the source of the bug.
History
Date User Action Args
2014-12-06 16:55:52Omer.Katzsetrecipients: + Omer.Katz, vstinner
2014-12-06 16:55:52Omer.Katzsetmessageid: <1417884952.02.0.0666112917824.issue22985@psf.upfronthosting.co.za>
2014-12-06 16:55:52Omer.Katzlinkissue22985 messages
2014-12-06 16:55:50Omer.Katzcreate