Description
Description
Currently tcp_info
structure is used to get information about listen queue that is then shown in FPM status. It uses tcpi_unacked
(or __tcpi_unacked
on FreeBSD or NetBSD) for current listen queue
status value and tcpi_sacked
(or __tcpi_sacked
on FreeBSD or NetBSD) which is used for max listen queue
and listen queue length
. The queue length is however just approximation (at least on Linux) expecting that maximum is reached which is often not the case on modern Linux kernl (one of the example is a bug #76323). In addition this works only for inet socket but doesn't work for unix domain socket as mentioned in bug #80739.
The solution for this on Linux is to use netlink with sock_diag
. It brings some challenges (like keeping inode number for the socket) but provides the required info and more. We could consider using libnl but that might not be a good idea as it would require an explicit non default dependency so it might not be always available (e.g. when FPM is compiled without it).
The FreeBSD should probably prefer the SO_LISTENQLIMIT
, SO_LISTENQLEN
and SO_LISTENINCQLEN
(for UDS) to get the required info as those options are specifically meant to be used for this and tcp_info
is quite undocumented there. It also can provide the info for unix domain socket as mentioned.