|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80739 PHP-FPM status page shows listen queue 0
Submitted: 2021-02-12 15:21 UTC Modified: 2021-09-16 12:27 UTC
Avg. Score:3.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: micha at dietpi dot com Assigned:
Status: Open Package: FPM related
PHP Version: 8.0.10 OS: Debian Bullseye
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: micha at dietpi dot com
New email:
PHP Version: OS:


 [2021-02-12 15:21 UTC] micha at dietpi dot com
I enabled the PHP-FPM status page and configured a handler in Apache2:

<Location /status>
        SetHandler "proxy:unix:/run/php/php8.0-fpm.sock|fcgi://localhost/status"

This is the result:

pool:                 www
process manager:      static
start time:           28/Jan/2021:15:53:44 +0100
start since:          1147547
accepted conn:        1054191
listen queue:         0
max listen queue:     0
listen queue len:     0
idle processes:       11
active processes:     1
total processes:      12
max active processes: 12
max children reached: 0
slow requests:        0

As can be seen, while all running processes have been used concurrently (this is the case after a few hours already, so not a very rare event), the listen queue stays at zero. Especially the `listen queue len` stays at zero, even that `listen.backlog = 1024` is applied in the pool configuration and as well system-wide a sufficient backlog is permitted:

net.core.somaxconn = 2048
net.ipv4.tcp_max_syn_backlog = 1024

This is on PHP8.0.2, but it was the same before on PHP8.0.1 and PHP7.4.

Steps to reproduce the behavior:

1. Install Debian Bullseye
2. Install Apache2 and PHP-FPM
3. Enable the PHP-FPM status page and the related handler in Apache2
4. Cause more concurrent requests than `pm.max_children`
5. Watch PHP-FPM status page to show `listen queue len` and `max listen queue` being zero.

Probably related bug report:

Expected result:
I would expect that `listen queue len` matches `listen.backlog` and that I do see a non-zero value at `max listen queue`, when the process limit is hit regularly. But probably in this setup it is handled differently? At least connections are not dropped from what I can say, no related error messages appear in either PHP or Apache2 logs, so in fact requests are queried somewhere.

Actual result:
listen queue:         0
max listen queue:     0
listen queue len:     0


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-05-28 02:02 UTC] yuta at adachi dot life
I reproduced this as well. Checking the implementation, we see that "getsockopt" is used for getting the queue length. We can use the "SO_LISTENINCQLEN" option in FreeBSD to get the status of the UNIX domain socket, but I think there is no option in Linux to get it.

The original implementation did not support UNIX domain sockets, so I suppose this is more of an undocumented specification than a but.

We can use "netlink" to get the status of all sockets, but I think there are some privilege and performance concerns. Any ideas?
 [2021-09-16 12:27 UTC] micha at dietpi dot com
-PHP Version: 8.0.2 +PHP Version: 8.0.10
 [2021-09-16 12:27 UTC] micha at dietpi dot com
Indeed SO_LISTENINCQLEN seems to not exist on Linux:

I tried to find out other ways to get current and max queue length on Linux:

# ss -lx | sed -n '1p;/php/p'
Netid State  Recv-Q Send-Q                              Local Address:Port      Peer Address:Port     Process
u_str LISTEN 0      1024                     /run/php/php8.0-fpm.sock 157408202            * 0

If I understood it right, this means current queue length is zero and max is 1024? The latter is true, changing "listen.backlog" to 2048 makes "Send-Q" change accordingly. I'll now monitor whether "Recv-Q" is ever different from zero. Checking the internals of "ss" may then provide the options for the FPM as well, I hope.

Best regards,

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Oct 24 01:03:33 2021 UTC