Repository navigation
Conversation
kubo 0.43.1 leaks inbound TCP/WS connection reservations in the libp2p resource manager, the same leak as the content node (#10). In the three days after the 2026-10-16 restart each bootstrapper gained 5,400-9,000 inbound slots more than its live inbound connections, about 2,000-3,200 a day, so the 64000 limit from #7 (2 x ConnMgr.HighWater) runs out around 2026-10-31. Set System.ConnsInbound to 262144 in libp2p-resource-limit-overrides.json, carried in the kubo-config Secret and written into the repo by the init container on every start, and raise MaxFileDescriptors and IPFS_FD_MAX to 524288, since each leaked slot also holds an FD slot. IPFS_FD_MAX was still 65536 under a 131072 MaxFileDescriptors; they match again. ConnMgr stays at 32000/16000. After a deploy the role fails unless the running node reports both limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is wrong
The bootstrappers run the same kubo 0.43.1 as the content node, and it leaks inbound connection reservations in the libp2p resource manager the same way (see #10). Since their restart on 2026-10-16 about 21:53 UTC, each instance has 5,400 to 9,000 more inbound slots in use than live inbound connections. On sing-1 on 2026-10-19 that was 24,619 slots against 15,632 live connections. That is roughly 2,000–3,200 leaked slots a day per instance.
Today's limit is 64000. Kubo derives it as 2 ×
ConnMgr.HighWater(32000, from #7), which is larger than MaxMemory in MiB (8192). At the fastest rate, an instance runs out around 2026-10-31. After that it refuses new peers while the port still accepts TCP, which is the 2026-10-16 incident again.Only a restart clears a leaked slot, and no config setting stops the leak. So this change gives the leak room, the way #10 does for content.
The change
roles/bootstrap/files/libp2p-resource-limit-overrides.json:System.ConnsInbound262144. Kubo droppedSwarm.ResourceMgr.Limits, and this file in the repo replaced it. It goes into each instance'skubo-configSecret, and the init container writes it into$IPFS_PATHon every start. Kubo applies it on top of the limits it computes itself, so everything else stays as it is now, including Transient (ConnsInbound2048 = MaxMemory MiB / 4).Swarm.ResourceMgr.MaxFileDescriptors131072 → 524288, andIPFS_FD_MAX65536 → 524288. Each leaked slot also holds an FD slot in the resource manager. Raise the bootstrappers' inbound connection limit to 64000 #7 raised MaxFileDescriptors but leftIPFS_FD_MAXat 65536. The two now match again, so the resource manager refuses a connection before anopen/acceptwould fail with EMFILE.Swarm.ConnMgrstays at 32000/16000. The task asked whether these can go back to a value based on real load. Not yet:ConnsInboundset explicitly, HighWater no longer sets the limit. It can be tuned on its own later, once someone has measured total connections.ipfs swarm resources --enc=jsonand fails unlessSystem.ConnsInboundequals the overrides file andSystem.FDequals MaxFileDescriptors. The success message prints the usage of both.Sizing (32 cores, 123 GiB per box)
MaxMemory8GiB and the pod's 16Gi limit, and CPU by the 4-core limit.FDnever becomes the limit beforeConnsInbound. These are caps, not use, since real FDs track the live TCP connections. The worst case is chic-1: bootstrap and bootstrap-b at 524288 each, plus content at 131072 (Give the content kubo headroom for leaked inbound connection slots #10), comes to about 1.2M. That is underfs.file-max2097152 and within the 1048576 nofile limit thatroles/commonand the k3s unit set.The overrides file is headroom, not a fix: restarts are still needed, about every two months. The ipni/infra follow-up below adds a warning in time to plan one.
Rollout (not done; it restarts every instance)
A restart is a short outage per instance (Recreate, hostNetwork). On chic-1, bootstrap and bootstrap-b restart one after the other.
Optional, before the first run. Confirm that the container's hard nofile limit allows 524288. Read-only, on any box:
The hard limit (third column) should be at least 524288; it should be 1048576. If it is lower, kubo sets the soft limit to the hard limit, logs an error and still starts.
From the repo root, one box at a time, sing-1 first:
The diff should show only the
kubo-configSecret (its contents areno_log) and the Deployment's init script andIPFS_FD_MAX.Verify (below), then repeat for lith-1 and then chic-1, which has two instances.
Verify, on each box after its run
The role already fails if the limits are wrong, and its output shows
System.ConnsInbound 262144 (… in use), FD 524288 (… in use)for each instance. To check by hand, with port 5011 forbootstrapand 5012 forbootstrap-bon chic-1:sudo k3s kubectl -n bootstrap logs deploy/bootstrap -c kubo-config | tail -2resource manager overrides: {"System":{"ConnsInbound":262144}}.libp2p_rcmgr_limit{resource="conns_inbound",scope="system"}is 262144, andlibp2p_rcmgr_limit{resource="fd",scope="system"}is 524288.libp2p_rcmgr_blocked_resources{…resource="connection",scope="system"}stays flat.libp2p_rcmgr_connections{dir="inbound",scope="system"}with live inbound connections (sum(libp2p_swarm_connections_opened_total{dir="inbound"}) - sum(libp2p_swarm_connections_closed_total{dir="inbound"})). The gap is the leak, and it should grow at about the same 2,000–3,200 a day.BootstrapRefusingConnectionsstay quiet.Follow-ups (not in this PR)
rules/bootstrap.yaml: the thresholds readlibp2p_rcmgr_limit, so they follow the new limit without changes. The header comment says the limit followsConnMgr.HighWater; it now comes from the overrides file. Also add the leak-gap warning proposed in Give the content kubo headroom for leaked inbound connection slots #10 (above half the limit), so restarts can be planned instead of paged. At 262144, the existing 80%/95% alerts fire only about two months out.🤖 Generated with Claude Code