Bug #499
closedFastCGI stderr output doesn't go to error log
Description
When a FastCGI script started with the fastcgi.server directive returns output on the stderr channel, and server.errorlog is set in the config file, that stderr output should go to the errlog. Instead, it's printed on the stderr of the process that started the lighttpd.
-- cjs
Files
Updated by Anonymous over 18 years ago
Has this bug been fixed since 1.4.9 ?
I'm using 1.4.11_1 (ssl) on FreeBSD 6.1, the bug seems to be persist here.... :-(
-- Ricky Sun
Updated by Anonymous almost 18 years ago
this is still present on the last release and the semantics of a fix are complicated by the fact that the fastcgi processes are independent of lighttpd (could be started independently or even reside in a different server and communicate using a tcp socket).
still, as described on the bug report, for the cases where lighttpd spawns the fastcgi processes and they run locally (using either a unix or a tcp socket) then when possible, the stderr for the fastcgi processes should be linked to the error log (to mimic compatibility with mod_cgi) even though the recommended way to send errors from the fastcgi applications should be by generating FCGI_STDERR as described in BUG998 and as described by the fastcgi spec.
-- carenas
Updated by carenas almost 18 years ago
just to clarify:
sending errors directly to the log violates the fastcgi specification as it specifically says that stderr should be closed and therefore lighttpd's implementation was buggy just because it was leaving stderr open and connected to the controlling terminal.
a correctly written fastcgi application should be able to send the errors to lighttpd using FCGI_STDERR packets by calling the right interface and therefore the fact that the errors were being written to the controlling terminal and not the log means that the fastcgi application was buggy as well.
attached a patch for lighttpd 1.4.9 that closes stderr correctly and therefore prevents the messages to get printed in the console, but that doesn't violate the spec by sending those messages to the log directly.
for details on how to fix the fastcgi application bug refer to ticket 998 test cases or to the fastcgi documentation
Updated by Anonymous almost 18 years ago
Yes, a properly written FastCGI app will never produce output to stderr. However, the point of sending stderr output to the log (which of course we can do only when lighttpd is the one starting the FastCGI server) is to help people debug FastCGI apps that are broken or running on misconfigured systems.
Take as an example one that starts up and then discovers it can't load a necessary FastCGI library: it has no way to report this error via the FastCGI protocol, because it doesn't have any code for it. So it will likely try its best and print an exception or whatever to stdout, and exit with an error code.
Here lighttpd has two choices. One is to say, "the user misconfigured his application, it's not my problem," and do nothing, and the other is to try to collect whatever information is there, be it gotten in a FastCGI-standard-compliant way or not, and log it.
"Be liberal in what you accept, and conservative in what you send."
-- cjs
Updated by stbuehler about 16 years ago
- Status changed from New to Fixed
- Resolution set to wontfix
If you want to see the stderr from a fastcgi app, just redirect in a wrapper script. apart from that, stderr is now redirected to /dev/null by default.
Updated by Anonymous about 16 years ago
- Status changed from Fixed to Need Feedback
- Resolution deleted (
wontfix)
Ok, so here's my other proposal for solving this: remove all ability for lighttpd to start a FastCGI server. If people are starting them as separate processes, they'll see the messaages to stderr from misconfigured servers (for example, the non-existence of the program they're trying to run). I argue that lighttpd's behaviour when starting up servers is broken because, although there's no spec for what to do when a program fails to start, it's considered normal to report errors to the user rather than silently ignore the errors.
Updated by stbuehler about 16 years ago
- Status changed from Need Feedback to Fixed
- Resolution set to wontfix
Updated by gstrauss over 8 years ago
- Description updated (diff)
Clarification: server.breakagelog config option allows admin to control this.
If server.breakagelog config option is set, fastcgi and scgi backends send stderr to server.breakagelog.
If server.breakagelog config option is not set and lighttpd is daemonized, stderr is sent to /dev/null.
If server.breakagelog config option is not set and lighttpd is not daemonized, stderr is sent to the console or that of whatever started lighttpd.
Also available in: Atom