[issue22985] Segfault on time.sleep

Omer Katz report at bugs.python.org
Sat Dec 6 17:55:52 CET 2014


Omer Katz added the comment:

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.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22985>
_______________________________________


More information about the Python-bugs-list mailing list