What does TCP: too many orphaned sockets mean

sockettcp

When I use dmesg to look at linux kernel messages, I see a flood of….

TCP: too many orphaned sockets

messages. My guess is this is sockets that are hanging around in TIME_WAIT after being closed that are waiting to be cleared up. I am interested to know if this would be likely to affect services running on these servers.

Best Answer

From the LARTC HOWTO:

/proc/sys/net/ipv4/tcp_max_orphans

Maximal number of TCP sockets not attached to any user file handle, 
held by system. If this number is exceeded orphaned connections are
reset immediately and warning is printed. This limit exists only to
prevent simple DoS attacks, you _must_ not rely on this or lower the
limit artificially, but rather increase it (probably, after increasing
installed memory), if network conditions require more than default value,
and tune network services to linger and kill such states more aggressively.

Let me remind you again: each orphan eats up to  64K of unswappable memory.

The implementation of the function limiting the number of orphans is here.