[issue17094] sys._current_frames() reports too many/wrong stack frames

Charles-François Natali report at bugs.python.org
Thu Apr 4 09:57:23 CEST 2013


Charles-François Natali added the comment:

> Here is an updated patch.

_PyThreadState_DeleteExcept uses HEAD_LOCK: ISTM that
PyThreadState_Clear() can trigger arbitrary code execution: if a
thread ends up being created/destroyed, I think we can get a deadlock
when trying to acquire the head lock. I think it should be turned into
an open call if possible.

Also, as noted by Stefan, shouldn't we also iterate over other interpreters?

> Note that I think this patch could break some programs. For example, if you have a thread in your main process which has a database connection open, deleting the thread state in a child process might shutdown the database connection (depending on the exact protocol). Therefore, I think it would be better to only apply the patch in 3.4.

Indeed. For the database example, there's this other issue where the
database connection is stored in a thread-local storage... Some people
will definitely get bitten by this...

----------

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


More information about the Python-bugs-list mailing list