[Zope] Zope 2.5.0b4/2.4.x crashes

Brian Lloyd brian.lloyd@zope.com
Mon, 28 Jan 2002 10:15:04 -0500


> Source code for the extension is at http://www.thuban.org/projects (see
> AstroMath).
> 
> As suggested, I set up a couple threading/non-threading tests outside of
> Zope.  Here are the results, and the sourcecode for the scripts.  My
> guess now is that it's a Python error, or something that I don't know
> about how C-extensions behave under Python threads.
> 
> AstroMathTest.py -- threaded, import outside of the thread run() method
> AstroMathTest-2.py -- threaded, import inside the thread run() method
> AstroMathTest-3.py -- unthreaded, import outside of the class
> 
> AstroMathTest.py triggers an abnormal termination (when running under
> Zope, this crashes the server).  The others execute normally.

Keith - 

I can't look into the specifics of this, but it very much looks like 
a thread-related problem in the interaction with the library you are 
calling. Note that "how C extensions behave under Python threads" 
depends totally on what your C extension does. If you are calling an 
external library, then you have to play by whatever threading rules 
it requires. It really depends on the library. 

You might try using Py_BEGIN_ALLOW_THREADS and friends or other tactics 
to serialize calls to the library, but even that is no guarantee 
depending on what kind of thread-dependent things your library may or 
may not do internally.

Brian Lloyd        brian@zope.com
Software Engineer  540.361.1716       
Zope Corporation   http://www.zope.com