Staging
v0.5.1
https://github.com/python/cpython
Revision 448db2155fc81d2aa84f37dc58683251cba8772e authored by Thomas Wouters on 16 September 2009, 20:06:36 UTC, committed by Thomas Wouters on 16 September 2009, 20:06:36 UTC
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74841 | thomas.wouters | 2009-09-16 12:55:54 -0700 (Wed, 16 Sep 2009) | 23 lines


  Fix issue #1590864, multiple threads and fork() can cause deadlocks, by
  acquiring the import lock around fork() calls. This prevents other threads
  from having that lock while the fork happens, and is the recommended way of
  dealing with such issues. There are two other locks we care about, the GIL
  and the Thread Local Storage lock. The GIL is obviously held when calling
  Python functions like os.fork(), and the TLS lock is explicitly reallocated
  instead, while also deleting now-orphaned TLS data.

  This only fixes calls to os.fork(), not extension modules or embedding
  programs calling C's fork() directly. Solving that requires a new set of API
  functions, and possibly a rewrite of the Python/thread_*.c mess. Add a
  warning explaining the problem to the documentation in the mean time.

  This also changes behaviour a little on AIX. Before, AIX (but only AIX) was
  getting the import lock reallocated, seemingly to avoid this very same
  problem. This is not the right approach, because the import lock is a
  re-entrant one, and reallocating would do the wrong thing when forking while
  holding the import lock.

  Will backport to 2.6, minus the tiny AIX behaviour change.
........
1 parent c5a6fd7
History
Tip revision: 448db2155fc81d2aa84f37dc58683251cba8772e authored by Thomas Wouters on 16 September 2009, 20:06:36 UTC
Merged revisions 74841 via svnmerge from
Tip revision: 448db21
File Mode Size
Demo
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Python
RISCOS
Tools
.bzrignore -rw-r--r-- 673 bytes
.hgignore -rw-r--r-- 866 bytes
.hgtags -rw-r--r-- 3.9 KB
LICENSE -rw-r--r-- 13.6 KB
Makefile.pre.in -rw-r--r-- 38.1 KB
README -rw-r--r-- 53.6 KB
configure -rwxr-xr-x 668.0 KB
configure.in -rw-r--r-- 106.8 KB
install-sh -rwxr-xr-x 7.0 KB
pyconfig.h.in -rw-r--r-- 28.8 KB
setup.py -rw-r--r-- 80.8 KB

README

back to top