Hello All,
Thanks for all of your help so far. I did indeed have a mutex
problem in my code that caused some deadlock in my code. I replaced
the fcntl.flock calls with the lock in the threading module and
that seemed to do the trick.
Now that I have that problem out of the way, I am pretty confident
that there is some sort of socket problem with that code in the
flush method of the TASASSStreamOut class (or at least that's where
the socket problem is showing up).
I also figured out that I could replicate the problem by stopping
a request using Internet Explorer (of course :). So now that I can
actually replicate the problem, it should be only a matter of time
to figure out the source of the problem. So, I started looking
at the putting some print statements in the code since I don't
know how else to tackle debugging a web server...
Here is my modified code for debugging. I added 1 debug statement
and made debug a variable for holding the time and a random int:
def flush(self):
from time import time
from sys import stdout
from random import randint
debug=(time(), randint(1,100000))
result = ASStreamOut.flush(self)
if result: ##a true return value means we can send
reslen = len(self._buffer)
if debug: print debug, "TASASStreamout is sending %s bytes" %
reslen
sent = 0
while sent < reslen:
try:
sent = sent +
self._socket.send(self._buffer[sent:sent+8192])
except socket.error, e:
if e[0]==errno.EPIPE: #broken pipe
pass
else:
print "StreamOut Error: ", e
break
if debug: print debug, "TASASStreamout has sent %s bytes" %
sent
self.pop(sent)
stdout.flush()
Here are the results...
Request 1 and 2 are successful requests. Number 3 is the broken one.
Creating 5 threads.....
Ready (0.67 seconds after launch)
1 thread is Thread-3
1 2004-02-12 12:45:03 /WK/M/Page
(1076618708.494272, 32645) TASASStreamout is sending 20567 bytes
(1076618708.494272, 32645) TASASStreamout has sent 20567 bytes
(1076618708.496495, 59979) TASASStreamout is sending 0 bytes
(1076618708.496495, 59979) TASASStreamout has sent 0 bytes
1 5.01 secs /WK/M/Page
2 thread is Thread-4
2 2004-02-12 12:45:57 /WK/M/Page
(1076618757.3941059, 65872) TASASStreamout is sending 20697 bytes
(1076618757.3941059, 65872) TASASStreamout has sent 20697 bytes
(1076618757.396776, 79609) TASASStreamout is sending 0 bytes
(1076618757.396776, 79609) TASASStreamout has sent 0 bytes
2 0.12 secs /WK/M/Page
3 thread is Thread-5
3 2004-02-12 12:46:06 /WK/M/Page
(1076618768.8915739, 41809) TASASStreamout is sending 15068 bytes
StreamOut Error: (54, 'Connection reset by peer')
(1076618768.8915739, 41809) TASASStreamout has sent 8192 bytes
(1076618768.8936629, 69418) TASASStreamout is sending 6876 bytes
(1076618768.8936629, 69418) TASASStreamout has sent 0 bytes
As you can see, the flush command is being called twice (the random
integer shows that). I am, of course, unsure if this is a cause,
a result, or just what's suppose to happen.
If anyone with more experience with socket programming has any ideas
then I would be glad to hear them.
thanks again for your help,
ian
__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss