FreeBSD 7.1 - syncache, tcp queue

Marcin Gryszkalis mg at
Sat Jan 24 14:45:55 PST 2009

I upgraded 2 machines to 7.1 (i386 and amd64) - both are 
running nginx web server and both are experiencing 
problem with resetting connections.

c -> s TCP 56473 > 80 [SYN] Seq=0 Win=5840 Len=0 MSS=1460 TSV=173160194 TSER=0 WS=6
s -> c TCP 80 > 56473 [SYN, ACK] Seq=0 Ack=1 Win=65535 [TCP CHECKSUM INCORRECT] Len=0 MSS=1460 WS=3 TSV=2680138265 TSER=173160194
c -> s TCP 56473 > 80 [ACK] Seq=1 Ack=1 Win=5888 Len=0 TSV=173160239 TSER=2680138265
s -> c TCP 80 > 56473 [RST] Seq=1 Win=0 [TCP CHECKSUM INCORRECT] Len=0
s -> c HTTP GET / HTTP/1.0

on the i386 I can see in debug log:

kernel: TCP: []:1909 to []:80; 
syncache_socket: Socket create failed due to limits or memory shortage
kernel: TCP: []:1909 to []:80 tcpflags 0x10<ACK>; 
tcp_input: Listen socket: Socket allocation failed due to 
limits or memory shortage, sending RST

syncache.count is 0:

net.inet.tcp.syncache.rst_on_sock_fail: 1
net.inet.tcp.syncache.rexmtlimit: 3
net.inet.tcp.syncache.hashsize: 512
net.inet.tcp.syncache.count: 0
net.inet.tcp.syncache.cachelimit: 15360
net.inet.tcp.syncache.bucketlimit: 30

and it seems that reason for the problem is that listen queue is overflown:
Current listen queue sizes (qlen/incqlen/maxqlen)
Proto Listen         Local Address
tcp4  193/0/128

I increased kern.ipc.somaxconn as temporary solution.

netstat shows many (~193 - like the queue length) connections, mostly in 
CLOSED state (why aren't they purged?)

I found some discussions about syncache changes in freebsd-net and other 
places but I'm not sure if my problem is known. Is there and reasoning 
and solution?

Marcin Gryszkalis, PGP 0x9F183FA3 
jabber jid:mg at, gg:2532994

More information about the freebsd-net mailing list