#1146 closed defect (worksforme)
large stderr freeze request
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | other | Version: | 1.11.x |
Keywords: | Cc: | ||
uname -a: | Microsoft Windows [Version 10.0.14393] | ||
nginx -V: |
nginx version: nginx/1.11.4
built by cl 16.00.30319.01 for 80x86 built with OpenSSL 1.0.2h 3 May 2016 TLS SNI support enabled configure arguments: --with-cc=cl --builddir=objs.msvc8 --with-debug --prefix= --conf-path=conf/nginx.conf --pid-path=logs/nginx.pid --http-log-path=logs/access.log --error-log-path=logs/error.log --sbin-path=nginx.exe --http-client-body-temp-path=temp/client_body_temp --http-proxy-temp-path=temp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --http-scgi-temp-path=temp/scgi_temp --http-uwsgi-temp-path=temp/uwsgi_temp --with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs.msvc8/lib/pcre-8.39 --with-zlib=objs.msvc8/lib/zlib-1.2.8 --with-select_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_stub_status_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_slice_module --with-mail --with-stream --with-openssl=objs.msvc8/lib/openssl-1.0.2h --with-openssl-opt=no-asm --with-http_ssl_module --with-mail_ssl_module --with-stream_ssl_module --with-ipv6 |
Description
Steps:
- exec via browser PHP 7.1 script:
#!/usr/bin/env php
<?
if (!defined("STDERR"))
define("STDERR", fopen("php://stderr", "w"));
for ($i=0; $i<256; $i++)
fprintf(STDERR, "Missing some file\n");
print "done.";
?>
Expected: to see "done."
Actual: loading until timeout.
The loop make 227 iterates and stop. 227 iterates ~= 4k of output => somewhere 4k buffer?
Logs are empty.
If run same script from command line, or Apache - all fine.
Via nginx - problem.
Not sure that problem in nginx, but can you check, please?
my fastcgi settings:
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
tried change output_buffering in PHP - doesn't help.
Using WTServer (https://wtserver.wtriple.com/)
Windows x64, PHP VC14 x64 Non Thread Safe (2016-Nov-09 15:37:06) ( http://windows.php.net/qa/ )
thank you.
There is no such 4k limitation anywhere in nginx, and any amount of FastCGI stderr data works just fine. Just tested the exact script on Windows with PHP 7.1, and it works fine too.
Note though, that writing to
php://stderr
in PHP currently will _not_ output to FastCGI's stderr as it should, but will rather write to the file descriptor 2, see this bug. That is, when startingphp-cgi -b
manually from the command line you'll see the output on the screen. Given the above, most likely the problem is related to how you startphp-cgi
, likely execution hangs when the buffer it writes to is exhausted. Try startingphp-cgi
manually from the command line to see if it helps.