Description

Errors or exceptions occur on every page served by the standalone server in 1.3beta4. I'm using it on Windows, viewing pages using Mozilla Firefox.

Example

Initial traceback: moin.log.txt

After adding {{{import traceback traceback.print_exc()}}} to request.py at lydon's request: attachment:moin.log2.txt

After switching to HTTP/1.0 requests: moin.log3.txt

Details

This Wiki.

Workaround

I intially believed it to be be an issue with how the connection was closed. All the files and pages seemed to serve up fine, so I thought it could be ignored, but it did cause constant scrolling of the console and filled up the log.

Discussion

lydon on IRC pointed out that it happened after every favicon.ico request, and suggested that the standalone server wouldn't serve that as a file because it's not under /wiki/. This turned out to be correct.

I changed the do_GET() function in standalone.py (starting at line 95) to add the following check between the initial wiki path check and the else:

   1 elif self.path == ('/favicon.ico'):
   2     self.expires = 7*24*3600 # 1 week expiry for png, css
   3     SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self)

This did indeed solve the problem.

No, it just changed the surface of the problem. This is the true fix:

   1 --- request.py.orig     Sat Nov 06 19:41:14 2004
   2 +++ request.py  Tue Nov 09 00:17:07 2004
   3 @@ -1475,7 +1475,12 @@
   4      def write(self, *data):
   5          """ Write to output stream.
   6          """
   7 -        self.wfile.write(self.encode(data))
   8 +        from socket import error as SocketError
   9 +        try:
  10 +            self.wfile.write(self.encode(data))
  11 +       except SocketError, ex:
  12 +            if ex.args[0] != 10053: # Software caused connection abort
  13 +                raise
  14 
  15      def flush(self):
  16          self.wfile.flush()

Fixed by running standalone do_GET in try: except, catch both "Broken pipe" and "Software caused abort" errors reported here.

Tested on Mac OS X. Please get patch-257 and test on Windows.

Plan


CategoryMoinMoinBugFixed

MoinMoin: MoinMoinBugs/ExceptionsUsingStandaloneServer (last edited 2007-10-29 19:06:03 by localhost)