Ticket #2783 (closed defect: fixed)
Opened 6 years ago
Last modified 6 years ago
fcgi wrapper shouldn't report "Internal Error" on catching SystemExit
| Reported by: | matthew.johnston@… | Owned by: | mgood |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.10 |
| Component: | general | Version: | 0.9.6 |
| Severity: | normal | Keywords: | |
| Cc: | |||
| Release Notes: | |||
| API Changes: | |||
Description (last modified by cboos) (diff)
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
Change History
comment:1 Changed 6 years ago by anonymous
Changed 6 years ago by bga@…
- Attachment trac-0.9.4-alt-fcgi-exit.patch added
SystemExit? patch for 0.9.4
comment:2 Changed 6 years ago by cboos
- Description modified (diff)
comment:3 Changed 6 years ago by mgood
- Owner changed from jonas to mgood
Alright, I'll check this out.
comment:4 follow-up: ↓ 5 Changed 6 years ago by 003.tmp@…
- Version changed from 0.9.3 to 0.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.
comment:5 in reply to: ↑ 4 Changed 6 years ago by 003.tmp@…
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 Changed 6 years ago by mgood
- Milestone set to 0.10
- Resolution set to fixed
- Status changed from new to closed
Fixed in [3678]
comment:7 Changed 6 years ago by mgood
#2139 has been marked as a duplicate.



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