|
Gregory (Grisha) Trubetskoy
grisha at modpython.org
Wed Oct 12 08:08:31 EDT 2005
You may be onto something here... I'll see about testing this out on my
FreeBSD system.
Grisha
On Tue, 11 Oct 2005, Graham Dumpleton wrote:
> Making an educated guess (???), in src/mod_python.c, can you modify the
> release_interpreter() function and change:
>
> static void release_interpreter(void)
> {
> PyThreadState *tstate = PyThreadState_Get();
> #ifdef WITH_THREAD
> PyEval_ReleaseThread(tstate);
> #endif
> PyThreadState_Delete(tstate);
> }
>
> to:
>
> static void release_interpreter(void)
> {
> PyThreadState *tstate = PyThreadState_Get();
> #ifdef WITH_THREAD
> PyEval_ReleaseThread(tstate);
> #else
> PyThreadState_Swap(NULL);
> #endif
> PyThreadState_Delete(tstate);
> }
>
> The original doesn't seem quite right to me because it wouldn't revert
> the thread state before deleting it when threads aren't used. There is a
> similar bit of code in get_interpreter() where it has:
>
> if (!idata->obcallback)
> {
> #ifdef WITH_THREAD
> PyEval_ReleaseThread(tstate);
> #endif PyThreadState_Delete(tstate);
>
> which perhaps should be:
>
> if (!idata->obcallback)
> {
> #ifdef WITH_THREAD
> PyEval_ReleaseThread(tstate);
> #else
> PyThreadState_Swap(NULL);
> #endif
> PyThreadState_Delete(tstate);
>
> In this case it only gets invoked when mod_python callback can't be
> created.
>
> If this is indeed the problem, in mod_python 3.1.3, the callback may be
> created okay so it only dies in release_interpreter(). In mod_python 3.2
> though, maybe the callback creation itself is failing meaning it would
> die everytime a child process is created.
>
> If someone has the time and a non BSD platform could you independently
> build a version of Python without thread support and then build
> mod_python 3.2 and see if you get similar crashes. Ie., I feel this
> could be wrong for no threads and not be BSD specific. From what I have
> seen, FreeBSD is the only platform that still doesn't build in threads
> to Python by default and thus why it isn't seen more. I can't do it
> personally as have MacOS X and one has to be careful with multiple
> Python installations there in case one trashes system one accidentally.
> Would rather not risk it. :-)
>
> Graham
>
> Peter Sanchez wrote ..
>> Thanks for the reference. I tried adding the following line, no real help.
>> So I rebuilt apache2 and mod_python and made sure it didn't have threads
>> support. Now, I still get the same error message, but the entire page is
>> loading correctly?
>>
>> Same log entries though:
>>
>> Fatal Python error: PyThreadState_Delete: tstate is still current
>> [Tue Oct 11 13:05:15 2005] [notice] child pid 256 exit signal Abort trap
>> (6)
>>
>> I am wondering if at this point, its not related to Cheetah Template engine,
>> which I use for my templates (will be converting to psp template system
>> very
>> soon) I am not sure if that attempts any threaded functions, etc. Also,
>> I
>> dont know that if it was trying something like that, if it would effect
>> mod_python in this way.
>>
>> Is there any traces I can run, etc. to help debug this issue?
>>
>> Thanks,
>>
>> Peter
>>
>> On 10/11/05, Jim Gallacher <jg.lists at sympatico.ca> wrote:
>>>
|