Edgewall Software
Modify

Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#2783 closed defect (fixed)

fcgi wrapper shouldn't report "Internal Error" on catching SystemExit

Reported by: matthew.johnston@… Owned by: Matthew Good
Priority: normal Milestone: 0.10
Component: general Version: 0.9.6
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

When trac is run under FastCGI 2.4.2 (with Apache 2.2.0, Python 2.4.2), it sometimes prints a traceback at the bottom after rendering pages (see below). As far as I can tell this is harmless, it's just that the trac.fcgi wrapper is catching all exceptions, including SystemExit which gets throw by sys.exit(). Adding a "except SystemExit: pass" in trac.fcgi gets rid of the tracebacks. Perhaps it should check for an exitcode of 0, I'm not sure.

Traceback:

Oops...

Trac detected an internal error:

0

Traceback (most recent call last):
  File "/usr/local/share/trac/cgi-bin/trac.fcgi", line 20, in ?
    fcgi_frontend.run()
  File "/usr/local/stow/trac-0.9.3/lib/python2.4/site-packages/trac/web/fcgi_frontend.py", line 28, in run
    _fcgi.Server(_handler).run()
  File "/usr/local/stow/trac-0.9.3/lib/python2.4/site-packages/trac/web/_fcgi.py", line 1049, in run
    sock = self._setupSocket()
  File "/usr/local/stow/trac-0.9.3/lib/python2.4/site-packages/trac/web/_fcgi.py", line 994, in _setupSocket
    req.run()
  File "/usr/local/stow/trac-0.9.3/lib/python2.4/site-packages/trac/web/_fcgi.py", line 580, in run
    self._end(appStatus, protocolStatus)
  File "/usr/local/stow/trac-0.9.3/lib/python2.4/site-packages/trac/web/_fcgi.py", line 606, in _end
    sys.exit(appStatus)
SystemExit: 0

Attachments (1)

trac-0.9.4-alt-fcgi-exit.patch (327 bytes ) - added by bga@… 18 years ago.
SystemExit patch for 0.9.4

Download all attachments as: .zip

Change History (8)

comment:1 by anonymous, 18 years ago

Just to note, that line didn't work for me. I got it working, though I'm not sure if it'll mess other things up. I added the following

except Exception, SystemExit: pass

just before the line:

except Exception, e:

This is me using fcgid, apache, and Trac 0.9.4

by bga@…, 18 years ago

SystemExit patch for 0.9.4

comment:2 by Christian Boos, 18 years ago

Description: modified (diff)

comment:3 by Matthew Good, 18 years ago

Owner: changed from Jonas Borgström to Matthew Good

Alright, I'll check this out.

comment:4 by 003.tmp@…, 18 years ago

Version: 0.9.30.9.6

I get the same with Trac v0.96 (and mod_fastcgi v2.4.2). However there is something I'm missing there: the suggested action will obviously suppress the error message, but the problem is that sys.exit() be called after each request. At least in my case that's what happening, and that means the program has to be restarted each time, leading to performance probably slightly worse than CGI.

in reply to:  4 comment:5 by 003.tmp@…, 18 years ago

Got it. Trac falls back to CGI if FastCGI fails because it is not properly configured.

That's good practice to "degrade well", however I think it would be useful to log the event so that users are made aware they are using CGI, not FastCGI.

comment:6 by Matthew Good, 18 years ago

Milestone: 0.10
Resolution: fixed
Status: newclosed

Fixed in [3678]

comment:7 by Matthew Good, 18 years ago

#2139 has been marked as a duplicate.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Matthew Good.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Matthew Good to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.