IBM Support

What is "discarded due to listener's queue full" counter in netstat -s output?

Question & Answer


Question

What is "discarded due to listener's queue full" counter in netstat -s output?

Answer

=> netstat -s | grep -i "queue full"
0 discarded due to listener's queue full

Each listening socket in TCP/IP stack has two queues (1) incomplete connection queue (2) complete connection queue. When SYN arrives from client, TCP creates a new entry in on the incomplete queue and then responds with the second segment of the three-way handshake which is SYN/ACK to the client. This entry will remain on the incomplete queue until the third segment of the three-way handshake which is ACK arrives from client or until the entry times out (timeout is 75 seconds by default e.g. no option tcp_keepinit=150). If the three-way handshake completes normally, the entry moves from the incomplete queue to the end of completed queue. When server application calls accept(), first entry from completed queue is processed.


In TCP/IP stack, there are 3 variables as below.
(1) qlimit is what the user sets as the backlog value in listen(int socket, int backlog).
     Note: backlog value used is min(backlog value in listen(), somaxconn set by no option)
(2) qlen is number of completed connection.
 
(3) q0len is number of incomplete connection.
 

Once (qlen + q0len) reaches 1.5 times qlimit for the socket, TCP/IP stack will reject one new connection request, and the "discarded due to listener’s queue full" counter gets incremented by one.

• If server application is experiencing this problem, iptrace will show a SYN packet coming into the listening server port, but SYN/ACK is not going back to client. The netstat -Aan command will show lot of connection in SYN_RCVD state for the listening port.

How to check the qlimit, q0len and qlen for any LISTENing socket?

netstat –ano provides qlimit, q0len, qlen for any LISTENing socket. The qlen and q0len are dynamic, because they keep changing as new connections are coming in, and server applications call accept(). The qlimit is a static number set by the application in specifying “backlog” parameter in listen().  e.g. Following netstat -ano output is for telnetd listening on port 23.

Proto   Recv-Q    Send-Q    Local Address    Foreign Address    (state)
 tcp           0               0                  *.23                           *.*                   LISTEN

        so_options: (ACCEPTCONN|REUSEADDR)
        q0len:0   qlen:0   qlimit:1000   so_state: (PRIV)
        timeo:0 uid:0
        timeo:0 uid:0
        so_special: (LOCKBALE|MEMCOMPRESS|DISABLE)
        so_special2: (PROC)
        sndbuf:
                hiwat:524176 lowat:4096 mbcnt:0 mbmax:2096704
        rcvbuf:
                hiwat:524176 lowat:1 mbcnt:0 mbmax:2096704
                sb_flags: (SEL|NOTIFY)
        TCP:
        mss:1448  flags: (RFC1323|COPYFLAGS)


T
o determine whether qlimit (i.e. backlog) needs to be increased or not, run netstat -ano every few seconds when a high number of new connection requests are coming in. If netstat -ano shows (qlen + q0len) reached 1.5 times qlimit, then qlimit needs to be increased. The qlimit is determined by following function.
qlimit = MIN (backlog value in listen(), somaxconn set by no option)
 
The somaxconn is a global parameter for all the applications in this system and can be set by no command and the backlog is set in the application code by listen() function. Many applications have backlog configurable in the configuration file. e.g. For Domino, notes.ini has  the parameter TCP_QLENGTH to increase the listening backlog.
Author: Darshan Patel
Platform: AIX on Power
Feedback: aix_feedback@wwpdl.vnet.ibm.com

[{"Type":"MASTER","Line of Business":{"code":"LOB08","label":"Cognitive Systems"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG10","label":"AIX"},"ARM Category":[{"code":"a8m0z000000cw0AAAQ","label":"Networking-\u003ETCPIP"}],"ARM Case Number":"","Platform":[{"code":"PF002","label":"AIX"}],"Version":"All Versions"}]

Document Information

Modified date:
04 December 2022

UID

isg3T1024414