Php 管理员打开太多FIFO文件的Laravel队列

Php 管理员打开太多FIFO文件的Laravel队列,php,laravel,supervisord,beanstalkd,Php,Laravel,Supervisord,Beanstalkd,我正在Ubuntu服务器上使用beanstalkd和supervisord运行一个名为“webhooks”的Laravel队列作业。我可以看到进程ID为4403的作业正常运行: webhooks RUNNING pid 4403, uptime 4 days, 19:47:01 如您所见,此作业已运行了4天。在我的错误日志中,我开始注意到出现以下错误: error:02001018:system library:fopen:Too many

我正在Ubuntu服务器上使用beanstalkd和supervisord运行一个名为“webhooks”的Laravel队列作业。我可以看到进程ID为4403的作业正常运行:

webhooks                         RUNNING    pid 4403, uptime 4 days, 19:47:01
如您所见,此作业已运行了4天。在我的错误日志中,我开始注意到出现以下错误:

error:02001018:system library:fopen:Too many open files
当我运行
lsof | php
查看打开了哪些文件时,我注意到打开了大量文件,这些文件的类型为
FIFO
。以下是输出中的一位专家:

COMMAND     PID   TID       USER   FD      TYPE             DEVICE SIZE/OFF       NODE NAME     
php        4403             root    0r     FIFO                0,8      0t0    9215811 pipe
php        4403             root    1w     FIFO                0,8      0t0    9215812 pipe
php        4403             root    2w     FIFO                0,8      0t0    9215812 pipe
php        4403             root    3w     FIFO                0,8      0t0    9215812 pipe
php        4403             root    4w     FIFO                0,8      0t0    9215812 pipe
php        4403             root    8r     FIFO                0,8      0t0    9215811 pipe
php        4403             root    9r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   10r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   11r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   12r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   13r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   14r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   15r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   16r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   17r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   18r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   19r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   20r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   21r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   22r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   23r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   24r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   25r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   26r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   27r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   28r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   29r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   30r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   31r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   32r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   33r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   34r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   35r     FIFO                0,8      0t0    9215811 pipe
php        4403             root   36r     FIFO                0,8      0t0    9215811 pipe
这只是一个摘录。实际上,大约有1200个这样的
FIFO
文件处于打开状态


有人知道是什么导致文件被创建吗?什么类型的代码会导致系统打开新的FIFO文件?这些文件的用途是什么?

我最终提高了系统上的文件打开限制,这似乎解决了问题。主管文件说:

supervisord大量使用文件描述符,并将输入失败 当无法从操作系统获取时的模式

将文件打开限制增加到10000后,我不再看到错误。我定期检查打开的FIFO文件的数量,有时非常高(以千计),有时则低得多(以百计)。所以看起来主管经常打开和关闭这些文件,我只需要确保系统允许主管有足够的空间来完成工作

如果有人想知道,我增加了文件限制,在
/etc/security/limits.conf
的底部添加了以下两行

root             soft    nofile          10000
root             hard    nofile          10000

在新的限制生效之前,我不得不重新启动supervisor并登录和退出我的系统几次,但最终它起了作用。

快速谷歌让你知道FIFO文件被命名为管道。脚本或supervisord中的某些内容正在创建这些管道。看看PHP手册中的命名管道,看看你是否能找到创建管道的代码。你知道什么类型的代码会导致系统创建命名管道吗?我知道这是一个广泛的问题,但我不确定从哪里开始。正在运行的代码正在我的内部系统和使用BigCommerceAPI的外部系统之间同步对象。因此,它不断地从Bigcommerce中推拉信息。以前我打开了太多的连接,导致了类似的太多文件打开错误,但现在已经解决了,这个FIFO问题已经取而代之。我对beanstalkd或supervisord都不熟悉,但我个人从for
proc\u open
mkfifo
开始。我自己不在任何地方调用这些函数。如果它们被使用,那是因为Laravel本身也在使用它们