cpython/Python
Thomas Wouters 448db2155f Merged revisions 74841 via svnmerge from
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.
........
2009-09-16 20:06:36 +00:00
..
Python-ast.c Merged revisions 66801,66803-66804,66813,66854-66856,66866,66870-66872,66874,66887,66903,66905,66911,66913,66927,66932,66938,66942,66962,66964,66973-66974,66977,66992,66998-66999,67002,67005,67007,67028,67040-67041,67044,67070,67089,67091,67101,67117-67119,67123-67124 via svnmerge from 2008-11-07 08:56:27 +00:00
_warnings.c Merged revisions 74040,74042 via svnmerge from 2009-07-17 06:33:03 +00:00
asdl.c Merge in release25-maint r60793: 2008-06-11 07:41:16 +00:00
ast.c Merged revisions 67590 via svnmerge from 2008-12-05 18:01:46 +00:00
atof.c Patch #411138: Rename config.h to pyconfig.h. Closes bug #231774. 2001-07-26 13:41:06 +00:00
bltinmodule.c Merged revisions 73776 via svnmerge from 2009-07-02 18:19:47 +00:00
ceval.c Merged revisions 73064-73065 via svnmerge from 2009-05-30 21:43:48 +00:00
codecs.c This reverts r63675 based on the discussion in this thread: 2008-06-09 04:58:54 +00:00
compile.c Merge in release25-maint r60793: 2008-06-11 07:41:16 +00:00
dup2.c Mass ANSIfication of function definitions. Doesn't cover all 'extern' 2000-07-22 18:47:25 +00:00
dynload_aix.c Fix SF bug #1072182, problems with signed characters. 2005-12-19 06:05:18 +00:00
dynload_atheos.c Patch #488073: AtheOS port. 2002-06-11 06:22:31 +00:00
dynload_beos.c Fix for 2002-01-23 15:51:12 +00:00
dynload_dl.c Use PyOS_snprintf instead of sprintf. 2001-11-28 20:42:20 +00:00
dynload_hpux.c Oops, I forgot to include this file in the last commit (46046): 2006-05-19 07:05:01 +00:00
dynload_next.c Fix for 838140: don't call NSUnlinkModule when we fail to find our 2004-07-15 22:28:48 +00:00
dynload_os2.c Use PyOS_snprintf instead of sprintf. 2001-11-28 20:42:20 +00:00
dynload_shlib.c Fix a warning from gcc by adding a missed const qualifier. 2006-01-04 01:30:17 +00:00
dynload_stub.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
dynload_win.c Merged revisions 69038 via svnmerge from 2009-01-27 23:30:15 +00:00
errors.c Merged revisions 71058,71149-71150,71212,71214-71216,71222,71225,71234,71237-71238,71240-71241,71243,71249,71251 via svnmerge from 2009-04-05 21:26:31 +00:00
formatter_string.c Refactor and clean up str.format() code (and helpers) in advance of optimizations. 2008-05-30 18:10:04 +00:00
formatter_unicode.c Refactor and clean up str.format() code (and helpers) in advance of optimizations. 2008-05-30 18:10:04 +00:00
frozen.c This is my patch 2002-08-15 14:59:02 +00:00
frozenmain.c Patch #569753: Remove support for WIN16. 2002-06-30 15:26:10 +00:00
future.c This reverts r63675 based on the discussion in this thread: 2008-06-09 04:58:54 +00:00
getargs.c Merged revisions 71058,71149-71150,71212,71214-71216,71222,71225,71234,71237-71238,71240-71241,71243,71249,71251 via svnmerge from 2009-04-05 21:26:31 +00:00
getcompiler.c The GCC version is loooooooooong; put it on a new line. 2000-09-05 04:40:39 +00:00
getcopyright.c Merged revisions 68133-68134,68141-68142,68145-68146,68148-68149,68159-68162,68166,68171-68174,68179,68195-68196,68210,68214-68215,68217-68222 via svnmerge from 2009-01-03 21:55:17 +00:00
getcwd.c Define MAXPATHLEN to be at least PATH_MAX, if that's defined. Python uses 2006-04-25 15:29:46 +00:00
getmtime.c spread the extern "C" { } magic pixie dust around. Python itself builds now 2006-04-13 02:06:09 +00:00
getopt.c Improve -X error message. 2008-04-13 20:50:29 +00:00
getplatform.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
getversion.c Use PyOS_snprintf instead of sprintf. 2001-11-28 20:42:20 +00:00
graminit.c Merged revisions 68523 via svnmerge from 2009-01-11 09:28:08 +00:00
import.c Merged revisions 74841 via svnmerge from 2009-09-16 20:06:36 +00:00
importdl.c Patch #794826: Add __file__ in dynamically loaded modules for multiple 2003-09-04 18:45:59 +00:00
importdl.h PEP 302 + zipimport: 2002-12-30 22:08:05 +00:00
mactoolboxglue.c This reverts r63675 based on the discussion in this thread: 2008-06-09 04:58:54 +00:00
marshal.c Merged revisions 72601 via svnmerge from 2009-05-13 13:13:18 +00:00
modsupport.c This reverts r63675 based on the discussion in this thread: 2008-06-09 04:58:54 +00:00
mysnprintf.c Fix issue2588: Do not execute str[size-1] = '\0' when a 0 size is 2008-05-26 22:07:28 +00:00
mystrtoul.c Revert r61969 which added casts to Py_CHARMASK to avoid compiler warnings. 2008-03-28 04:58:51 +00:00
peephole.c This reverts r63675 based on the discussion in this thread: 2008-06-09 04:58:54 +00:00
pyarena.c Fix more memory allocation issues found with failmalloc. 2006-07-22 16:20:49 +00:00
pyfpe.c Patch #411138: Rename config.h to pyconfig.h. Closes bug #231774. 2001-07-26 13:41:06 +00:00
pymath.c Issue #5724: Fix cmath failures on Solaris 10. 2009-05-04 13:30:43 +00:00
pystate.c Adds a sanity check to avoid a *very rare* infinite loop due to a corrupt tls 2008-08-04 07:33:37 +00:00
pystrcmp.c Remove compiler warnings (on Alpha at least) about using chars as 2008-03-23 06:19:57 +00:00
pystrtod.c Merged revisions 71976 via svnmerge from 2009-04-26 19:59:00 +00:00
pythonrun.c Merged revisions 71152 via svnmerge from 2009-04-04 14:19:56 +00:00
sigcheck.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
strdup.c Mass ANSIfication of function definitions. Doesn't cover all 'extern' 2000-07-22 18:47:25 +00:00
strtod.c Remove unnecessary curly braces around an int literal. 2008-02-07 08:04:07 +00:00
structmember.c This reverts r63675 based on the discussion in this thread: 2008-06-09 04:58:54 +00:00
symtable.c Merged revisions 71026 via svnmerge from 2009-04-02 02:58:49 +00:00
sysmodule.c Merged revisions 72871-72872 via svnmerge from 2009-05-23 19:35:33 +00:00
thread.c Adds a sanity check to avoid a *very rare* infinite loop due to a corrupt tls 2008-08-04 07:33:37 +00:00
thread_atheos.h Patch #488073: AtheOS port. 2002-06-11 06:22:31 +00:00
thread_beos.h Remove the unused & broken PyThread_*_sema() functions and related constants. 2002-01-19 22:02:55 +00:00
thread_cthread.h Remove the unused & broken PyThread_*_sema() functions and related constants. 2002-01-19 22:02:55 +00:00
thread_foobar.h Remove the unused & broken PyThread_*_sema() functions and related constants. 2002-01-19 22:02:55 +00:00
thread_lwp.h Remove the unused & broken PyThread_*_sema() functions and related constants. 2002-01-19 22:02:55 +00:00
thread_nt.h Fix problems in x64 build that were discovered by the testsuite: 2007-05-03 20:27:03 +00:00
thread_os2.h bugfix: PyThread_start_new_thread() returns the thread ID, not a flag; 2006-07-23 13:00:04 +00:00
thread_pth.h Patch #805613: Fix usage of the PTH library. 2003-09-20 11:13:36 +00:00
thread_pthread.h Patch #1454481: Make thread stack size runtime tunable. 2006-06-13 15:04:24 +00:00
thread_sgi.h Remove support for DYNIX, IRIX 4, --with-sgi-dl, --with-dl-dld 2004-01-17 04:04:13 +00:00
thread_solaris.h Patch #716969: Detect thread creation failure. Will backport to 2.2. 2003-04-19 07:44:52 +00:00
thread_wince.h bug 1234979 addition 2005-07-09 15:26:33 +00:00
traceback.c Merged revisions 70463 via svnmerge from 2009-03-18 21:49:29 +00:00