tcp_out_of_resources(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… tcp_out_of_resources πŸ’…

okay so bestie, this is a page from the Kernel API Manual β€” yes, we're reading kernel manpages now, this is our era β€” and it's all about tcp_out_of_resources, which is literally the function that closes a socket if we're out of resources. brutal but necessary, no cap.


🌸 SYNOPSIS 🌸

int tcp_out_of_resources (struct sock *sk , bool do_reset );

✨ ARGUMENTS ✨

  • sk β€” pointer to the current socket 🫢 the main character of this whole situation.
  • do_reset β€” send a last packet with the reset flag, iykyk πŸ’€ like a little goodbye text but make it rude.

πŸ¦‹ DESCRIPTION πŸ¦‹

the whole point: do not allow orphaned sockets to eat all our resources. periodt. that's the rule and we are enforcing it.

and yeah, this is a direct violation of TCP specs 😭 but it is required to prevent DoS attacks, so we're being a little lawless for the greater good. it's giving vigilante justice.

it gets called when a retransmission timeout or zero probe timeout occurs on an orphaned socket. so like, when the socket is out there unattended and the timers start screaming.

it also closes if our net namespace is exiting β€” because at that point there is no hope of ever communicating again, since all netns interfaces are already down (or about to be down). we need to release our dst references, which have been moved to the netns loopback interface, so the namespace can finish exiting. 🧚 cleaner vibes only.

this condition is only possible if we are a kernel socket, because those do not hold references to the namespace. important detail, don't forget it.

⚠️ heads up: the criteria is still not confirmed experimentally and may change. so like... don't get too attached to these rules, bestie. πŸ™ˆ

πŸ’€ we kill the socket if:

  1. the number of orphaned sockets exceeds an administratively configured limit β€” you had your chance, babes.
  2. we have strong memory pressure β€” the system is literally suffocating, someone has to go.
  3. our net namespace is exiting β€” it's not you, it's the namespace 🌈

πŸ‘‘ SEE ALSO πŸ‘‘

go read those too, they're all part of the same friend group fr fr πŸ”₯


aaand that's the tea β˜• this lil masterpiece lives in ./net/ipv4, dated October 2026, and it's officially page tcp_out_of_resources(9) of the Kernel API Manual β€” slay, iconic, no notes βœ¨πŸŽ€πŸ’œ

πŸ“¦ where this page comes from