Bug #998
closedfastcgi prints an additional empty line for each packet of type FCGI_STDERR
Description
every time a fastcgi script writes an error using (for example for the C API) :
FCGX_FPrintF(err, "This is an error message");
2 packets of type FCGI_STDERR are generated (the first one containing the message and the second one of length 0), but lighttpd print both generating an empty lane as shown by (from the errorlog) :
2007-01-27 23:13:02: (mod_fastcgi.c.2519) FastCGI-stderr: This is an error message
2007-01-27 23:13:02: (mod_fastcgi.c.2519) FastCGI-stderr:
attached patches for lighttpd-1.4.x and trunk with a fix that uses the same logic applied for packets of type FCGI_STDOUT
-- carenas
Files
Updated by carenas almost 18 years ago
in lighttpd 1.5 the implementation used for mod_proxy_backend_fastcgi doesn't show this problem as shown in :
mod_proxy_backend_fastcgi.c.476: (trace) (fastcgi-stderr) this is an error message mod_proxy_backend_fastcgi.c.476: (trace) (fastcgi-stderr) this is an error message
Updated by carenas almost 18 years ago
a fastcgi program using the fcgi_stdio emulation is shown below:
#include "fcgi_config.h" #include "fcgi_stdio.h" int main() { while (FCGI_Accept() >=0) { printf("Content-type: text/html\r\n"); printf("\r\n"); printf("This is some content"); fprintf(stderr, "This is some error"); } return 0; }
a fastcgi C program using the native API :
#include "fcgi_config.h" #include "fcgiapp.h" int main() { FCGX_Stream *in, *out, *err; FCGX_ParamArray envp; while (FCGX_Accept(&int, &out, &err, &envp) >= 0) { FCGX_FPrintF(out, "This is some content"); FCGX_FPrintF(err, "This is some error"); } return 0; }
Updated by Anonymous almost 18 years ago
this patch however doesn't solve problem with PHP-FCGI error logs:
2007-01-30 02:26:31: (mod_fastcgi.c.2504) FastCGI-stderr: error 2007-01-30 02:26:37: (mod_fastcgi.c.2504) FastCGI-stderr: error 2007-01-30 02:26:38: (mod_fastcgi.c.2504) FastCGI-stderr: error
#!ShellExample $ cat z.php tore <? error_log("error");
-- Elan Ruusamäe <glen
Updated by carenas almost 18 years ago
the problem with PHP is a bug in PHP not in lighttpd or fastcgi as error_log is printing a an extra "CRLF" at the end of the message
http://bugs.php.net/bug.php?id=31472
interestingly enough though this patch "fixes" the problem by redirecting stderr into the log file as can be seen if instead the following script is used :
<?php $stderr = fopen("php://stderr", "w"); fputs ($stderr, "error\n"); fclose ($stderr); ?>
Updated by glen almost 18 years ago
- Status changed from New to Fixed
- Resolution set to fixed
Updated by glen about 17 years ago
this patch addresses the PHP problem:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/php-fcgi-error_log-no-newlines.patch
Updated by glen almost 4 years ago
r1607 matches 1c662e07ba258f8868b99a25c6f40b37522f6b38 git commit
Also available in: Atom