Missing python import: socket in trac.web.api

Bug #631321 reported by Jeroen T. Vermeulen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
trac (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: trac

My web server hangs up every few days since I upgraded it to lucid. One error I see in the logs is this trac bug.

Line 464 of /usr/lib/python2.6/dist-packages/trac/web/api.py references the socket module, in Request.write:

    except (IOError, socket.error), e:

The file does not import the socket module, so I get a traceback:

2010-09-05 02:13:53,373 Trac[main] ERROR: Internal Server Error:
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 450, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.6/dist-packages/trac/web/main.py", line 230, in dispatch
    req.send(output, content_type or 'text/html')
  File "/usr/lib/python2.6/dist-packages/trac/web/api.py", line 358, in send
    self.write(content)
  File "/usr/lib/python2.6/dist-packages/trac/web/api.py", line 464, in write
    except (IOError, socket.error), e:
NameError: global name 'socket' is not defined

A simple "import socket" near the top of the file should fix this.

I have yet to see whether this fix stops the hangups. The hangups seem to be related to trac fcgi processes spinning forever on a lock. Sometimes I catch them merely using up all CPU. I can only guess about the times when I can no longer get into the server; the server still runs to some extent and reportedly uses all available CPU time when that happens.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Unfortunately, fixing this does not cure the regular server hangs.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Ah, and it wouldn't—there's a similarly missing import for errno in the same file. Used one line down from the bug I reported originally, so it's going to cause the same number of failures.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Even with those things solved, the application still hangs up regularly. I'm beginning to suspect the spam filter plugin.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.