From 6eab78fa80a47adfeded4fe10cd57b77c20bed07 Mon Sep 17 00:00:00 2001 From: diogo464 Date: Fri, 8 Aug 2025 10:38:39 +0100 Subject: doubled tcp max orphan limit the default value on the machines seems to be 262144 but on some larger experiments dmesg will sometimes show the following logs: [Fri Aug 8 05:01:42 2025] TCP: too many orphaned sockets [Fri Aug 8 05:01:42 2025] TCP: too many orphaned sockets [Fri Aug 8 05:01:42 2025] TCP: too many orphaned sockets [Fri Aug 8 05:01:42 2025] TCP: too many orphaned sockets [Fri Aug 8 05:01:42 2025] TCP: too many orphaned sockets [Fri Aug 8 05:01:42 2025] TCP: too many orphaned sockets [Fri Aug 8 05:01:42 2025] TCP: too many orphaned sockets [Fri Aug 8 05:01:42 2025] TCP: too many orphaned sockets [Fri Aug 8 05:01:42 2025] TCP: too many orphaned sockets [Fri Aug 8 05:01:42 2025] TCP: too many orphaned sockets hopefully increasing this limit will fix that. https://serverfault.com/questions/624911/what-does-tcp-too-many-orphaned-sockets-mean the second answer on server faul also says it could be due to tcp memory limits: ``` The possible cause of this error is system run out of socket memory.Either you need to increase the socket memory(net.ipv4.tcp_mem) or find out the cause of memory consumption [root@test ~]# cat /proc/sys/net/ipv4/tcp_mem 362688 483584 725376 So here in my system you can see 725376(pages)*4096=2971140096bytes/1024*1024=708 megabyte So this 708 megabyte of memory is used by application for sending and receiving data as well as utilized by my loopback interface.If at any stage this value reached no further socket can be made until this memory is released from the application which are holding socket open which you can determine using netstat -antulp. ``` but for now I will just increase the max orphans and see if that is enough. --- src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.rs b/src/main.rs index 636a3dc..7ef6ff6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -883,6 +883,9 @@ fn machine_configuration_script(config: &MachineConfig) -> String { script.push_str("echo 16384 > /proc/sys/net/ipv4/neigh/default/gc_thresh2\n"); script.push_str("echo 32768 > /proc/sys/net/ipv4/neigh/default/gc_thresh3\n"); + // tcp max orphan limit + script.push_str("echo 524288 > /proc/sys/net/ipv4/tcp_max_orphans\n"); + // ip configuration script.push_str("cat << EOF | ip -b -\n"); for command in config.ip_commands.iter() { -- cgit