[Zope-dev] logging crash

Terry Kerr terry@bizarsoftware.com.au
Wed, 30 Jan 2002 16:43:46 +1100


Hi,

I have modified ZServer/medusa/http_server.py::http_request.log() so that the 
host is tacked onto the end of the log file.  This is so that I can track my 
virtual hosts.  The modification is very simple...only two lines added as shown 
by the *:

*       host=self.get_header('host')
         self.channel.server.logger.log (
             self.channel.addr[0],
             ' - %s [%s] "%s" %d %d "%s" "%s" "%s"\n' % (
                 name,
                 self.log_date_string (time.time()),
                 self.request, # blah...change this
                 self.reply_code,
                 bytes,
                 referer,
                 user_agent,
*               host
                 )
             )


However, my server is continually crashing and restarting about 4 or 5 times per 
day, and my log file shows up one particulary error quite regularly followed by 
the server crash:

2002-01-30T02:02:02 ERROR(200) ZServer uncaptured python exception, closing 
channel <zhttp_channel connected 24.237.103.242:4496 at 8a2b88c channel#: 5927 
requests:> (exceptions.AttributeError:'None' object has no attribute 'split' 
[/usr/local/lib/python2.1/asyncore.py|poll|104] 
[/usr/local/lib/python2.1/asyncore.py|handle_write_event|393] 
[/usr/local/zope/Zope-2.4.3-src/ZServer/medusa/asynchat.py|handle_write|147] 
[/usr/local/zope/Zope-2.4.3-src/ZServer/medusa/asynchat.py|initiate_send|209] 
[/usr/local/zope/Zope-2.4.3-src/ZServer/medusa/asynchat.py|refill_buffer|196] 
[/usr/local/zope/Zope-2.4.3-src/ZServer/Producers.py|more|108] 
[/usr/local/zope/Zope-2.4.3-src/ZServer/medusa/http_server.py|log|287])
------
2002-01-30T02:02:03 ERROR(200) zdaemon zdaemon: Wed Jan 30 13:02:03 2002: 
Aiieee! 21875 exited with error code: 256

This hints that the server is crashing when trying to log, although I cannot 
figure out why.  I cannot see where the 'split' comes into it.

The server is getting about 50,000 hits per day.  I am running 2.4.3, with 
python 2.1.2 on freebsd.

I originally found the logging hack on the zope site somewhere and cannot find 
it again.

Can any one explain why it would crash so often.


terry

-- 
Terry Kerr (terry@bizarsoftware.com.au)
Chief Technical Officer
Bizar Software Pty Ltd (www.bizarsoftware.com.au)
+61 3 9530 9182