[Python-bugs-list] Fatal Python error: PyThreadState_Delete: invalid tstate (PR#299)

greg@itasoftware.com greg@itasoftware.com
Tue, 18 Apr 2000 19:29:20 -0400 (EDT)


Hi,

I was getting this error:

   Fatal Python error: PyThreadState_Delete: invalid tstate

in a threaded program.

Eventually I looked on your bug list pages and found the fix, and
after several hours was able to get the code from CVS, update to r152,
and then update Python/pystate.c to rev 2.9, for which the log message
says:

> revision 2.9
> date: 1999/06/18 14:22:24;  author: guido;  state: Exp;  lines: +23 -5
> CRITICAL PATCH!
> 
> We occasionally received reports from people getting "invalid tstate"
> crashes (this is a fatal error in PyThreadState_Delete()).  Finally
> several people were able to reproduce it reliably and Tim Peters
> discovered that there is a race condition when multiple threads are
> calling this function without holding the global interpreter lock (the
> function may be called without holding that).
> 
> Solved the race condition by adding a lock around the mutating uses of
> interp->tstate_head.  Tim and Jonathan Giddy have run tests that make
> it likely that this fixes the crashes -- although Tim hasn't heard
> from the person who reported the original problem.

My question is, what is some normal user supposed to do?  Given that
the bug was fixed in June of 1999 and you didn't have a next release
planned for at least a year, wasn't a 1.5.3 warranted for a "CRITICAL
PATCH"?


thank you for your time,

Greg Klanderman
greg@itasoftware.com