The problem is that ThreadedAppServer isn't catching the
exception that is raised when bad marshal data is sent from
the adaptor. Each time it receives some it hangs the
current thread. All that's needed to prevent this is a
simple try/except block. Here's how I did it in the
redesign code:
try:
recv = conn.recv
data = []
chunk = ''
while len(chunk) < int_length:
chunk += recv(int_length)
dict_length = loads(chunk)
if type(dict_length) != intType:
raise ValueError
chunk = ''
missing = dict_length
while missing > 0:
chunk += recv(missing)
missing = dict_length - len(chunk)
reqDict = loads(chunk)
except ValueError:
conn.close()
print "Webware Error: Invalid protocol"
# @@TR: should we do some sort of logging?
return 0
Line 443 in ThreadedAppServer.py is where this is needed.
It would also be a good idea to add an even higher level
try/except that catches any unhandled exception whatsoever
so WebKit's AppServer is uncrashable.
Tavis
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel