First reported as
ZBX-7933 , The zabbix agent frequently suffers TCP listen queue overflows, resulting in messages like "Mar 12 17:20:17 zabbix-p01 kernel: sonewconn: pcb 0xc809dad4: Listen queue overflow: 193 already in queue awaiting acceptance" printed to the system console. While this is not a correctness issue, it is still a performance issue. All of those dropped TCP connections hurt performance. On my system, I find that when the maximum listen queue is very large, the backlog quickly spikes from 0 to 215 connections before plateauing. This strongly suggests that raising the listen queue size is the correct solution.
The attached patch raises the listen queue from the old-fashioned SOMAXCONN to INT_MAX instead. The operating system will limit the actual queue depth, of course. On FreeBSD, the actual maximum queue depth is set by the kern.ipc.soacceptqueue sysctl. SOMAXCONN is a fossil that doesn't have any real meaning anymore.