陆零云
27
0
下午三点开始零星 502,十分钟后整站打不开。php-fpm 的 status 页显示 20 个 worker 全是 active,max_children 也是 20,一个空闲的都没有。
挨个看进程栈,都停在 curl_exec,对端是同一个第三方地址。第一反应是对方接口慢,抓包看过去,连接建好了,请求也发出去了,就是一直不回。代码里 curl_setopt 只设了 URL 和 RETURNTRANSFER,超时一个都没写。
更关键的是 request_...
陆零云
26
0
合同导出从 30 页涨到 200 页,接口 504,Nginx 日志 upstream timed out 60s。Dompdf 0.8.6,memory_limit 512M,报错里没有内存,只有 Maximum execution time of 60 seconds exceeded。
我先 set_time_limit(0),再把 memory_limit 调到 1G。任务能跑完,但要 140 秒,前端早就断了,队列里的 worker 也被占死。...
陆零云
39
0
现象
同步接口执行到 60 秒左右被切断,Nginx 返回 504 Gateway Timeout。FPM 日志里写着 WARNING: [pool www] child 4321, script '/app/sync.php' execution timed out (60.5 sec), terminating。业务日志显示数据只写了一半,重试还会产生重复记录。
原因
request_terminate_timeout 是 FPM 层面的硬超时,优先级...
陆零云
33
0
现象
数据导出接口本地跑 90 秒能完成,线上浏览器却返回 504 Gateway Timeout。脚本开头已经写了 set_time_limit(0),PHP 日志显示任务最后执行完毕,但用户始终拿不到结果。Nginx 的 error_log 里是 upstream timed out while reading response header。
原因
504 是网关等不到上游响应产生的,不由 PHP 的 max_execution_time 单独决定。...