[mod_python] Win32 threading issue

Chris Trengove trengove at econdata.com.au
Wed May 9 08:27:50 EST 2001


Exactly what I see is variable in nature. The most usual thing will be an
entry in the Apache error log like this

[Tue May 08 16:47:37 2001] [error] PythonHandler hwtest: Traceback (most
recent call last):

[Tue May 08 16:47:37 2001] [error] PythonHandler hwtest:   File
"e:\python20\lib\mod_python\apache.py", line 189, in Dispatch     result =
object(self.req) [Tue May 08 16:47:37 2001] [error] PythonHandler hwtest:
File "c:/apache/apache/htdocs/python\hwtest.py", line 24, in handler
req.write("%d: %d\n" % (thread.get_ident(),counter)) 

[Tue May 08 16:47:37 2001] [error] PythonHandler hwtest: IOError: Write
failed, client closed connection. 

When I use my Python driver script, which keeps going even if no data is
returned from the server, I will often end up with an access violation
inside Apache.exe.

"The instruction at "0x6ff71679" referenced memory at "0x616c707b". The
memory could not be "read"."

Actually, this location appears to be always the same -- when it eventually
happens -- which might be after a significant number log error messages.
After the access violation, one of my driver scripts stops, because it
receives a socket exception (10054, "Connection reset by peer"), and the
other script continues merrily along.

Occassionally other things can happen too -- I think it just depends on
when the two threads conflict. As I mentioned earilier, one really
misterious occurrence is getting a "double message" returned to one thread,
just as the other receives no data. Like this

632: 1515843<LF>568: 1572286

Here <LF> is a line feed, and the numbers before the colons are the thread
IDs. I know that Apache has 50 threads which it is cycling through in
order. On this occassion 568 was due to be the thread to be used for the
OTHER client.


At 09:47 AM 8/05/2001 -0400, Gregory (Grisha) Trubetskoy wrote:
>Another question - when you say a thread crashes, what exactly do you see
>- is it something in the log or one of those dr. watson messages?
>On Tue, 8 May 2001, Chris Trengove wrote:
>> Grisha,
>> I did have KeepAlive On, but it appears to make no difference. I have just
>> tried with KeepAlive Off, and I get the same behaviour. Also, the clients I
>> have been using would be closing the connection after each request. As
>> clients I have been using a Python script with urllib, and a little C++
>> test program I wrote to see if trying a different client made any
>> difference. It didn't.

More information about the Mod_python mailing list