Charles-François Natali <neolo...@free.fr> added the comment:

And here's the test.
To sum up:
- reinit_tls.diff makes sure to call PyThread_ReInitTLS() at the beginning of 
PyOS_AfterFork(), so that the TLS API is usable within PyOS_AfterFork() (e.g. 
in _after_fork()). It would be applied to 3.2 and default, even though they are 
not affected (at least on platform withs a native TLS implementation)
- reinit_tls_test.diff would be applied to 2.7, 3.2 and default: it should not 
trigger a failure on any of the active branches (2.7, 3.2 and default), it's 
just to prevent potential future regressions.
Notes regarding the test:
- I replaced subprocess with bare fork(), since it's way cheaper than spawning 
an entire subprocess
- I reduced the number of threads compared to Christoph's reproducer, because I 
feel uncomfortable forking up to 1024 processes in parallel (even though in 
practise they won't be that much, because child processes will terminate before 
the other threads call fork())
- even with 2.7.2, it won't deadlock 100%, since the race window is really 
short (but having a failure on one of the buildbots once would be enough to 
detect the problem, should it ever resurface)

----------
versions: +Python 2.7
Added file: http://bugs.python.org/file24348/reinit_tls_test.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13817>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to