Interesting that might be to do with imports. Maybe the C code
compilation is not working and those imports are causing the problem??
The one big difference from the point of view of threading between 1.0.2
and 1.0.3 is that the latter has removed the ticker (replacing it with a
blank string), which was causing multi-threaded problems on some
platforms. But I'd be bloody amazed if removing a threading problem
created your threading problem!
Wayne
On Fri, 27 May 2005, Bruce D. Ray wrote:
> A further note on the error message I see:
>
> >>> Fatal Python error: PyEval_RestoreThread: NULL tstate
> /new-ccpnmr/ccpnmr/bin/analysis: line 1: 1282 Abort trap $CCPNMR_TOP_DIR/bin/python -i -O $CCPNMR_TOP_DIR/ccpnmr1.0/python/ccpnmr/analysis/AnalysisGui.py $1
>
> The error message is generated by the function PyEval_RestoreThread in
> the Python build as found in the Python directory of the source.
> The critical region reads:
>
> PyEval_RestoreThread(PyThreadState *tstate)
> {
> if (tstate == NULL)
> Py_FatalError("PyEval_RestoreThread: NULL tstate");
> #ifdef WITH_THREAD
> if (interpreter_lock) {
> int err = errno;
> PyThread_acquire_lock(interpreter_lock, 1);
> errno = err;
> }
> #endif
> PyThreadState_Swap(tstate);
> }
>
>
> Now this is called from only two places in the code in this directory,
> import.c, and pystate.c and note that the tstate referenced in the
> error message is a pointer.
>
> The thread state in import.c is generated in the code that reads:
>
> #include "pythread.h"
>
> static PyThread_type_lock import_lock = 0;
> static long import_lock_thread = -1;
> static int import_lock_level = 0;
>
> static void
> lock_import(void)
> {
> long me = PyThread_get_thread_ident();
> if (me == -1)
> return; /* Too bad */
> if (import_lock == NULL)
> import_lock = PyThread_allocate_lock();
> if (import_lock_thread == me) {
> import_lock_level++;
> return;
> }
> if (import_lock_thread != -1 || !PyThread_acquire_lock(import_lock, 0))
> {
> PyThreadState *tstate = PyEval_SaveThread();
> PyThread_acquire_lock(import_lock, 1);
> PyEval_RestoreThread(tstate);
> }
> import_lock_thread = me;
> import_lock_level = 1;
> }
>
> This does not seem to check for a NULL thread state pointer and I suspect that
> this is the call that generates the error message.
>
> The thread state pointer in pystate.c is checked for NULL before the call to
> PyEval_RestoreThread.
>
>
> As I read import.c, this is the code that handles the import declarations in
> python scripts. If I am correct in how I understand this then the error comes
> about from an import declaration in a python script that has gone awry.
>
> A diff of the python code in python/ccpnmr/analysis is over 80 pages long without
> even mentioning the entirely new module boxintegral.py
>
>
> Sincerely,
>
>
> --
> Bruce D. Ray, Ph.D.
> Associate Scientist, and Operations Director
> NMR Center
> IUPUI
> Physics Dept.
> 402 N. Blackford St.
> Indianapolis, IN 46202-3273
>
|