Project

General

Profile

Actions

Bug #499

closed

FastCGI stderr output doesn't go to error log

Added by Anonymous about 18 years ago. Updated about 8 years ago.

Status:
Wontfix
Priority:
Normal
Category:
mod_fastcgi
Target version:
-
ASK QUESTIONS IN Forums:

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

lighttpd-1.4.x-fastcgi-print-stderrlog.patch (1.68 KB) lighttpd-1.4.x-fastcgi-print-stderrlog.patch patch for lighttpd 1.4.x's mod_fastcgi to link stderr for the fastcgi processes with the error log -- carenas Anonymous, 2007-01-28 08:22
lighttpd-1.4.8-fastcgi-stderr.patch (651 Bytes) lighttpd-1.4.8-fastcgi-stderr.patch patch to close stderr for the fastcgi processes as per the spec carenas, 2007-01-28 12:49
lighttpd-1.4.x-fastcgi-print-stderrlog.2.patch (2.11 KB) lighttpd-1.4.x-fastcgi-print-stderrlog.2.patch patch for lighttpd 1.4.x's mod_fastcgi to link stderr for the fastcgi processes with the error log (version 2) carenas, 2007-01-28 13:30
Actions #1

Updated by Anonymous almost 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

Actions #2

Updated by Anonymous over 17 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

Actions #3

Updated by carenas over 17 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

Actions #4

Updated by Anonymous over 17 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

Actions #5

Updated by stbuehler over 15 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.

Actions #6

Updated by Anonymous over 15 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.

Actions #7

Updated by stbuehler over 15 years ago

  • Status changed from Need Feedback to Fixed
  • Resolution set to wontfix
Actions #8

Updated by stbuehler over 15 years ago

  • Status changed from Fixed to Wontfix
Actions #9

Updated by gstrauss about 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.

Actions

Also available in: Atom