Does anyone use threading debug PYTHONTHREADDEBUG=1 env var? Can I remove it?

Hi, Does anyone use threading debug PYTHONTHREADDEBUG=1 env var on a Python debug build? If not, can I just remove it? -- To fix a race condition at thread exit on Linux using the glibc, I removed calls to pthread_exit() (PyThread_exit_thread()) in the _thread module: https://bugs.python.org/issue44434 A side effect of this change is the removal of the "PyThread_exit_thread called" threading debug log when using PYTHONTHREADDEBUG=1 environment variable. I never used PYTHONTHREADDEBUG. I just tried it and it produces tons of output in stdout about locks. It looks basically useless because it produces way too many logs, and it pollutes stdout (ex: most Python tests fail when it's enabled). This debug mode requires to build Python in debug mode (./configure --with-pydebug): https://docs.python.org/dev/using/configure.html#python-debug-build IMO there are enough external debugging tools to debug threading issues. Python no longer has to come with its built-in logs. I propose to deprecate the feature in Python 3.11 and remove it in 2 releases (Python 3.13). Victor -- Night gathers, and now my watch begins. It shall not end until my death.

On Wed, Jul 7, 2021 at 2:28 AM Victor Stinner <vstinner@python.org> wrote:
Hi,
Does anyone use threading debug PYTHONTHREADDEBUG=1 env var on a Python debug build? If not, can I just remove it?
--
To fix a race condition at thread exit on Linux using the glibc, I removed calls to pthread_exit() (PyThread_exit_thread()) in the _thread module:
https://bugs.python.org/issue44434
A side effect of this change is the removal of the "PyThread_exit_thread called" threading debug log when using PYTHONTHREADDEBUG=1 environment variable.
I never used PYTHONTHREADDEBUG. I just tried it and it produces tons of output in stdout about locks. It looks basically useless because it produces way too many logs, and it pollutes stdout (ex: most Python tests fail when it's enabled).
This debug mode requires to build Python in debug mode (./configure --with-pydebug):
https://docs.python.org/dev/using/configure.html#python-debug-build
IMO there are enough external debugging tools to debug threading issues. Python no longer has to come with its built-in logs.
I propose to deprecate the feature in Python 3.11 and remove it in 2 releases (Python 3.13).
I agree with its removal.
Victor -- Night gathers, and now my watch begins. It shall not end until my death. _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/NMLGCDRU... Code of Conduct: http://python.org/psf/codeofconduct/

I agree, that flag was probably last useful when we were debugging the threading machinery itself. (Evidenced by it only working on --with-pydebug, which is for when you're debugging CPython itself, not any user apps.) On Wed, Jul 7, 2021 at 9:33 AM Gregory P. Smith <greg@krypto.org> wrote:
On Wed, Jul 7, 2021 at 2:28 AM Victor Stinner <vstinner@python.org> wrote:
Hi,
Does anyone use threading debug PYTHONTHREADDEBUG=1 env var on a Python debug build? If not, can I just remove it?
--
To fix a race condition at thread exit on Linux using the glibc, I removed calls to pthread_exit() (PyThread_exit_thread()) in the _thread module:
https://bugs.python.org/issue44434
A side effect of this change is the removal of the "PyThread_exit_thread called" threading debug log when using PYTHONTHREADDEBUG=1 environment variable.
I never used PYTHONTHREADDEBUG. I just tried it and it produces tons of output in stdout about locks. It looks basically useless because it produces way too many logs, and it pollutes stdout (ex: most Python tests fail when it's enabled).
This debug mode requires to build Python in debug mode (./configure --with-pydebug):
https://docs.python.org/dev/using/configure.html#python-debug-build
IMO there are enough external debugging tools to debug threading issues. Python no longer has to come with its built-in logs.
I propose to deprecate the feature in Python 3.11 and remove it in 2 releases (Python 3.13).
I agree with its removal.
Victor -- Night gathers, and now my watch begins. It shall not end until my death. _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/NMLGCDRU... Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/F3MFU5YD... Code of Conduct: http://python.org/psf/codeofconduct/
-- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...>

Ok, thanks. I created https://bugs.python.org/issue44584 to deprecate the feature and schedule its removal in Python 3.12. Victor On Wed, Jul 7, 2021 at 8:09 PM Guido van Rossum <guido@python.org> wrote:
I agree, that flag was probably last useful when we were debugging the threading machinery itself. (Evidenced by it only working on --with-pydebug, which is for when you're debugging CPython itself, not any user apps.)
On Wed, Jul 7, 2021 at 9:33 AM Gregory P. Smith <greg@krypto.org> wrote:
On Wed, Jul 7, 2021 at 2:28 AM Victor Stinner <vstinner@python.org> wrote:
Hi,
Does anyone use threading debug PYTHONTHREADDEBUG=1 env var on a Python debug build? If not, can I just remove it?
--
To fix a race condition at thread exit on Linux using the glibc, I removed calls to pthread_exit() (PyThread_exit_thread()) in the _thread module:
https://bugs.python.org/issue44434
A side effect of this change is the removal of the "PyThread_exit_thread called" threading debug log when using PYTHONTHREADDEBUG=1 environment variable.
I never used PYTHONTHREADDEBUG. I just tried it and it produces tons of output in stdout about locks. It looks basically useless because it produces way too many logs, and it pollutes stdout (ex: most Python tests fail when it's enabled).
This debug mode requires to build Python in debug mode (./configure --with-pydebug):
https://docs.python.org/dev/using/configure.html#python-debug-build
IMO there are enough external debugging tools to debug threading issues. Python no longer has to come with its built-in logs.
I propose to deprecate the feature in Python 3.11 and remove it in 2 releases (Python 3.13).
I agree with its removal.
Victor -- Night gathers, and now my watch begins. It shall not end until my death. _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/NMLGCDRU... Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/F3MFU5YD... Code of Conduct: http://python.org/psf/codeofconduct/
-- --Guido van Rossum (python.org/~guido) Pronouns: he/him (why is my pronoun here?)
-- Night gathers, and now my watch begins. It shall not end until my death.
participants (3)
-
Gregory P. Smith
-
Guido van Rossum
-
Victor Stinner