[issue30967] Crash in PyThread_ReInitTLS() in the child process after os.fork() on CentOS 6.5 (Python 2.7.13)

STINNER Victor report at bugs.python.org
Wed Jul 19 05:54:03 EDT 2017


STINNER Victor added the comment:

Python 2.7 uses its own implementation of Thread Local Storage: see find_key() in Python/thread.c. This implementation uses a lock and a chained list. A fork only clones the current thread in the child process, all other threads are "removed", so Python has to manually remove all TLS variables of the other threads using PyThread_ReInitTLS().

I don't think that Python 3 is affected by such bug, since Python 3 uses native TLS APIs like pthread pthread_{get,set}specific() on UNIX/BSD.

----------
nosy: +haypo
title: Python core crash during os.fork() on CentOS 6.5 (Python 2.7.13) -> Crash in PyThread_ReInitTLS() in the child process after os.fork() on CentOS 6.5 (Python 2.7.13)

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


More information about the Python-bugs-list mailing list