调用fastcgi_finish_request时,请求数超过max_requests时产生,fpm发送两次FCGI_END_REQUEST记录
测试的脚本及配置:
<?php
ignore_user_abort();
fastcgi_finish_request();
sleep(10);
?>
Nginx configuration
upstream fpm
{
server 127.0.0.1:9000;
keepalive 1;
}
server
{
......
fastcgi_keep_conn on;
fastcgi_param SCRIPT_NAME /index.php;
fastcgi_pass fpm;
......
}
PHP FPM configuration
max_children = 1
max_requests = 2
Expected result:
----------------
No errors in nginx error log
Actual result:
--------------
Every second request is finished with 502 status
Nginx error.log contains records:
2014/07/07 13:42:58 [error] 11253#0: *1 upstream sent unexpected FastCGI record: 3 while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /nginx_test.phtml HTTP/1.1", upstream: "fastcgi://127.0.0.1:8002", host: "localhost:8081"
解决方案:
1. 升级到 php 7.0.16及以上
2. 设置max_requests=0 可能有内存泄露风险
参考资源:
http://serverfault.com/questions/827561/nginx-php7-unexpected-fastcgi-record-while-reading-response-header-from-upstre/828203
https://bugs.php.net/bug.php?id=67583
相关推荐
此资源有两个文件,含 nginx-upstream-jvm-route 和 nginx 对应版本,都是tar.gz文件。 安装方法网上很多就不写了,亲测可用。 不用担心版本不匹配造成安装失败,再浪费积分去到处下载尝试的烦恼。 此资源有两个文件...
官方nginx 镜像不带主动健康,本镜像将 nginx_upstream_check健康检查 打包到了镜像中。
nginx-upstream-jvm-route 支持nginx版本1.15 解决nginx: [emerg] invalid parameter "srun_id=tomcat1" 问题
nginx上游动态服务器一个nginx模块,用于解析上游内部的域名并保持最新状态。 默认情况下,仅在nginx...安装./configure --add-module=/path/to/nginx-upstream-dynamic-serversmake && make install用法在上游内部使
这是一个很小的脚本文件用来管理 Nginx 的 upstream 配置。 使用方法:upstream_manager.py <cluster> <action> [...]
在centos上成功编译安装nginx 1.4、php 5.4并成功启动nginx和php-fpm后,访问php提示”File not found.”,同时在错误日志中看到: 代码如下:2013/10/22 20:05:49 [error] 12691#0: *6 FastCGI sent in stderr: ...
NGINX第三方模块:nginx_upstream_hash-0.3.1.tar.gz。
Nginx常见的错误和解决方法,1、Nginx 常见启动错误 有的时候初次安装nginx的时候会报这样的错误 sbin/nginx -c conf/nginx.conf 报错内容:sbin/nginx: error while loading shared libraries: libpcre.so.1: ...
NGINX第三方模块:nginx_upstream_hash-0.3.2版本。。。
nginx1.16版本 后端节点健康检查、自动隔离+nginx_upstream_check_module-master+nginx-upload-module
nginx_upstream_jvm_route 是一个 Nginx 的扩展模块,用来实现基于 Cookie 的 Session Sticky 的功能。 安装方法(进入Nginx源码目录): #patch -p0 # ./configure --prefix=/usr/nginx-0.8.1 --with-...
借助淘宝技术团队开发的nginx模快nginx_upstream_check_module来检测后方realserver的健康状态,如果后端服务器不可用,则会将其踢出upstream,所有的请求不转发到这台服务器。当期恢复正常时,将其加入upstream。 ...
nginx_upstream_check_module模块,2019年11月6日18:11:19下载的
Nginx upstream urlhash url hash 反向代理 Nginx upstream urlhash url hash 反向代理
nginx_upstream_jvm_route 是一个 Nginx 的扩展模块,用来实现基于 Cookie 的 Session Sticky 的功能。 安装方法(进入Nginx源码目录): #patch -p0 # ./configure --prefix=/usr/nginx-0.8.1 --with-...
docker容器中编译安装第三方后端检查模块nginx_upstream_check_module 使用方法见:https://blog.csdn.net/pcn01/article/details/105182600
nginx优化之request_time 和upstream_response_time差别笔者在根据nginx的accesslog中$request_time
介绍该模块可以在纯 nginx-1.4.7 中用于检查上游服务器,并应用了几个补丁。 该模块的主要目的是为上游服务器添加主动健康检查。 核心源文件来自阿里巴巴开发维护的Tengine。 有关更多详细信息,请查看。概要 ...
nginx配置upstream的资源文件文件,下载下来直接上传至服务解压即可