[issue36475] PyEval_AcquireLock() and PyEval_AcquireThread() do not handle runtime finalization properly.

Eric Snow report at bugs.python.org
Fri Mar 29 15:26:20 EDT 2019


New submission from Eric Snow <ericsnowcurrently at gmail.com>:

Daemon threads keep running until they finish or until finalization starts.  For the latter, there is a check right after the thread acquires the GIL which causes the thread to exit if runtime finalization has started. [1]  However, there are functions in the C-API that facilitate acquiring the GIL, but do not cause the thread to exit during finalization:

  PyEval_AcquireLock()
  PyEval_AcquireThread()

Daemon threads that acquire the GIL through these can cause a deadlock during finalization.  (See issue #36469.)  They should probably be updated to match what PyEval_RestoreThread() does.


[1] see PyEval_RestoreThread() and the eval loop, in PyEval_EvalFrameEx()

----------
messages: 339138
nosy: eric.snow
priority: normal
severity: normal
stage: test needed
status: open
title: PyEval_AcquireLock() and PyEval_AcquireThread() do not handle runtime finalization properly.
type: behavior
versions: Python 3.7, Python 3.8

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


More information about the Python-bugs-list mailing list