[issue33015] Fix function cast warning in thread_pthread.h
STINNER Victor
report at bugs.python.org
Fri Nov 30 11:54:56 EST 2018
STINNER Victor <vstinner at redhat.com> added the comment:
Oh... test_threaded_import started to crash on Python 2.7:
$ ./python -m test -F -v test_threaded_import
(...)
0:00:00 load avg: 1.06 [ 3] test_threaded_import
Trying 20 threads ... OK.
Trying 50 threads ... OK.
Trying 20 threads ... OK.
Segmentation fault (core dumped)
The problem is that PyMem_Malloc() is not thread safe when Python is compiled in debug mode! In release mode, it's safe because PyMem_Malloc() is a thin wrapper to malloc(). But in debug mode, PyMem_Malloc() uses the debug hooks and... pymalloc allocator which is not thread-safe!
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33015>
_______________________________________
More information about the Python-bugs-list
mailing list