Fatal Python error: Inconsistent interned string state

Tim Peters tim.one at comcast.net
Sat Mar 13 21:52:14 EST 2004


[Byron Morgan]
> Anyone run into this before?

Sorry, I've never heard of this check triggering before.

> I have a python app that has been reliable, running for days on end
> without a crash. Suddenly, It repeatedly crashes with the following
> message:
>
> "Fatal Python error: Inconsistent interned string state.
> abnormal program termination"
>
> Some background:
>
> Platform is W2K.
>
> My app receives data (short strings, 25 - 40 character in length) from
> a telnet connection, using telnetlib. The strings are placed in a
> queue (I am using Queue.Queue(). The telnet session runs in a thread.
> A second thread gets strings from the queue and does stuff with the
> contents, involving queries to a mysql database. The main thread just
> watches for keyboard input for a shutdown command. Other than that, it
> prints to console and logs to a file.
>
> I cannot find any place in my code that overtly uses the concept of an
> interned string (I had never before heard of an interned string). The
> crashes began after I started using the following simple construct, to
> trap a particular value in the data:
>
> if line[0] == '2': (do something)
>
> Naturally, I assume that the problem may have something to do with
> this change, but I cannot fathom how it could cause this problem

You're not going to solve this without a lot of debugging.  The error can
come from one of two places in Python's stringobject.c.  In either case, it
means the value of a Python string object's ob->sstate member has an
impossible value.  Virtually any error, anywhere in any C code, could cause
this -- some extension leaving memory uninitialzed, someone doing a wild
store, anything.  Running with a debug build of Python and all extensions
might help.  Since this has (AFAICT) never been reported before, the cause
is unlikely to be in core Python, and likely to be in a C extension that
doesn't ship with the core.





More information about the Python-list mailing list