tcp_out_of_resources(9)
π 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:
- the number of orphaned sockets exceeds an administratively configured limit β you had your chance, babes.
- we have strong memory pressure β the system is literally suffocating, someone has to go.
- our net namespace is exiting β it's not you, it's the namespace π
π SEE ALSO π
- Kernel file
./net/ipv4/tcp_timer.c tcp_write_err(9)tcp_orphan_retries(9)retransmits_timed_out(9)tcp_delack_timer(9)tcp_retransmit_timer(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms