Bug #79928 [NEW]: fastcgi_finish_request() doesn't finish request
| From: | vedad at kajtaz dot net | Date: | Tue, 04 Aug 2020 13:47:09 +0000 |
| Subject: | Bug #79928 [NEW]: fastcgi_finish_request() doesn't finish request | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-228397@lists.php.net to get a copy of this message | ||
From: vedad at kajtaz dot net
Operating system: FreeBSD 12.1-RELEASE
PHP version: 7.4.8
Package: FPM related
Bug Type: Bug
Bug description:fastcgi_finish_request() doesn't finish request
Description:
------------
Hi,
I have a FPM (unix socket) + nginx setup.
I have a couple of scripts, invoked from cron through nginx, that are
designed to run lengthy tasks.
The very first thing these scripts do is to invoke
fastcgi_finish_request() (after going through some routing logic).
They don't produce any output, neither before nor after invoking
fastcgi_finish_request(). I did try writing to stdout and/or seanding
headers before the call, the behavior remains the same.
Seldomly (roughly one request out of 10), FPM doesn't seem to notify
nginx, which results in nginx reporting a timeout (which is configured
to 30 seconds):
2020/08/03 18:38:33 [error] 82940#103032: *41412 upstream timed out
(60: Operation timed out) while reading response header from upstream,
client: XX.XXX.XXX.XXX, server: XXXXXXXXX.XXXXXXXXXX.com, request: "GET
/cron/XXXXXXXXXX HTTP/1.1", upstream:
"fastcgi://unix:/tmp/XXXXXXXXX.sock", host: "XXXXXXXXX.XXXXXXXXXX.com"
Even when the 30 seconds timeout is not reached, I see instances of
scripts running for more that a couple of milliseconds one would except
when fastcgi_finish_request() is invoked straight away (first column =
response time in seconds):
0.001 XX.XXX.XXX.XXX - - [04/Aug/2020:14:34:17 +0200] "GET
/cron/XXXXXXXXXX HTTP/1.1" 200 5 "-" "cron"
17.253 XX.XXX.XXX.XXX - - [04/Aug/2020:14:34:17 +0200] "GET
/cron/XXXXXXXXXX HTTP/1.1" 200 5 "-" "cron"
I have no idea where to start to try debugging this issue.
Any ideas?
--
Edit bug report at https://bugs.php.net/bug.php?id=79928&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79928&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79928&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79928&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79928&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79928&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79928&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79928&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79928&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79928&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79928&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79928&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79928&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79928&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79928&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79928&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79928&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79928&r=mysqlcfg