Hi,
I started hitting Py_FatalError("Invalid thread state for this thread") 
in pystate.c when a thread bootstraps since my upgrade to Python 2.4.2 
(was using 2.4.1 previously).
I'm embedding Python in C++, using multiple interpreters and threads.
I think the problem is that PyThreadState_Delete (which is used when I 
destroy thread states and interpreters) is not making the same clean up 
that PyThreadState_DeleteCurrent is doing:

if (autoTLSkey && PyThread_get_key_value(autoTLSkey) == tstate)
        PyThread_delete_key_value(autoTLSkey);

If a thread id is reused (and this often happens), and the previous 
thread used PyThreadState_Delete instead of PyThreadState_DeleteCurrent, 
  an old and invalid value for autoTLSkey is stored, and that is 
triggering the Py_FatalError.
Thanks.

-- 


Gabriel Becedillas
Developer
CORE SECURITY TECHNOLOGIES

Florida 141 - 2º cuerpo - 7º piso
C1005AAC Buenos Aires - Argentina
Tel/Fax: (54 11) 5032-CORE (2673)
http://www.corest.com
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to