[New-bugs-announce] [issue34486] "RuntimeError: release unlocked lock" when starting a thread

Stanisław Skonieczny (Uosiu) report at bugs.python.org
Fri Aug 24 10:02:35 EDT 2018


New submission from Stanisław Skonieczny (Uosiu) <stanislaw.skonieczny at gmail.com>:

Sometimes when thread is starting it raises "RuntimeError: release unlocked lock". That is when signal handler is invoked in the same time.

Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 551, in wait
    signaled = self._cond.wait(timeout)
  File "/usr/lib/python3.6/threading.py", line 304, in wait
    self._acquire_restore(saved_state)
  File "start_threads.py", line 12, in sighandler
    raise MyException("got signal")
__main__.MyException: got signal

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "start_threads.py", line 28, in <module>
    thread.start()
  File "/usr/lib/python3.6/threading.py", line 851, in start
    self._started.wait()
  File "/usr/lib/python3.6/threading.py", line 552, in wait
    return signaled
  File "/usr/lib/python3.6/threading.py", line 243, in __exit__
    return self._lock.__exit__(*args)
RuntimeError: release unlocked lock

I have attached to files that reproduce the problem. First runs python and starts noop threads in the loop. It uses signal handler that raises exception. Second is a bash script to run python script and send signal to it. After some time, when signal is handled in unfortunate place, python script breaks due to unreleased lock.

----------
components: Library (Lib)
files: start_threads.py
messages: 323998
nosy: Stanisław Skonieczny (Uosiu)
priority: normal
severity: normal
status: open
title: "RuntimeError: release unlocked lock" when starting a thread
versions: Python 3.6
Added file: https://bugs.python.org/file47761/start_threads.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34486>
_______________________________________


More information about the New-bugs-announce mailing list