pcntl_fork() 中超过 300 秒的最大执行时间 [英] Maximum execution time of 300 seconds exceeded in pcntl_fork()

查看:26
本文介绍了pcntl_fork() 中超过 300 秒的最大执行时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些代理正在运行,经过几周的正常模式,我们突然得到:

I have some agents running, and after several weeks of normal mode, suddenly we get:

最大执行时间超过 300 秒

$this->pids[$next_child] = pcntl_fork();

我们也有:

[root@a ~]# ulimit -u
385913

[root@a ~]# ps ax | wc -l
400

[root@a ~]# cat /proc/sys/kernel/pid_max
4194303

strace shows

poll([{fd=4, events=POLLIN|POLLPRI|POLLHUP}], 1, 1000) = 0 (Timeout)

我们在 php5.4 centos,会不会是 PHP 的 bug?或者有什么问题?
更新2年后仍然出现此错误,从那时起我们升级到php5.6,然后升级到php7,现在升级到php7.3.1

we are on php5.4 centos, could it be a PHP bug? or what could be wrong?
update 2 years after still having this error, since then we upgraded to php5.6 then to php7, and now to php7.3.1

推荐答案

这个错误有点神秘.所以,我们必须做一些调试才能找到问题的根源.

This error is a bit cryptic. So, we must do some debugging to get to the bottom of the issue.

注意:而不是专注于函数 pcntl_fork 或 PHP 错误.我将专注于这是一个系统资源问题.因为,它抛出错误的行包含 fork.我们会看看它从那里去哪里

Note: Rather than concentrating on the function pcntl_fork or PHP bugs. I'll concentrate on this being a system resource issue. Because, the line it throwing the error contains fork. We'll see where it goes from there

  • 错误可能是错误或不重要的.要对此进行测试,请将 ini_set('MAX_EXECUTION_TIME', -1); 添加到脚本的最顶部.如果您的脚本按预期运行而没有任何问题,那么它是正确的.如果不是,那么我们应该检查行为.如果您的代理在他们通常会抛出错误的时候开始遇到为客户服务的问题,那可能意味着错误意味着资源不足.如果不是这种情况,您应该检查代理的行为,以便了解有关问题原因的更多信息.

  • The error might be a bug or unimportant. To test this add ini_set('MAX_EXECUTION_TIME', -1); to the very top of your script. If your script runs as intended without any problems, then it is true. If not, then we should examine the behavior. If your agents start having problems serving clients around the time they would normal throw the error, that might mean the error meant something along the lines of resources not being enough. If that's not the case you should examine the behavior of the agents so you can learn more about the cause of the issue.

据我所知,如果您使用的是 Active URL 缓存,则该错误可能与它的大小过高有关.

The error might be related to the size of Active URL cache being too high if you are using it from what I've heard.

如果问题仍然存在,您需要提供有关您的环境和配置的更多信息,以便我们为您提供帮助.

If the problem still persists, you need to provide more information about your environment and configurations so that we can help you.

问题:您是否有机会使用 Magento?

Question: Are you by any chance using Magento?

这篇关于pcntl_fork() 中超过 300 秒的最大执行时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆