Swarm.ResourceMgr.MaxMemory vs GOMEMLIMIT #10621
Labels
kind/bug
A bug in existing code (including security flaws)
need/triage
Needs initial labeling and prioritization
Checklist
Installation method
dist.ipfs.tech or ipfs-update
Version
Config
https://github.com/ipfs/kubo/blob/master/docs/config.md#swarmresourcemgrmaxmemory
Description
Problem
Swarm.ResourceMgr.MaxMemory
is often interpreted and used as "memory limit for Kubo", while it is only passed to go-libp2p and used for limited set of things (transports, but not bitswap).Ref. https://github.com/libp2p/go-libp2p/tree/master/p2p/host/resource-manager#readme
The default
Swarm.ResourceMgr.MaxMemory
is dynamic and conservative:The actual memory limit people want to set is for entire Kubo, and that is likely
GOMEMLIMIT
but we do not set it by default.This means:
Swarm.ResourceMgr.MaxMemory
are still getting OOM, because it does not cover all the basesSolution brainstorm
Swarm.ResourceMgr.MaxMemory
.[TOTAL_SYSTEM_MEMORY]*0.75
?GOMEMLIMIT
if is present in env, it should always take precedence, and implicit default forSwarm.ResourceMgr.MaxMemory
should be calculated from that ceiling.Swarm.ResourceMgr.MaxMemory
higher than implicit (or explicit)GOMEMLIMIT
memory
in config and only findingResourceMgr.MaxMemory
Limits.MaxMemory
? Or genericEnv.*
and support settingEnv.GOMEMLIMIT
via config?cc @sukunrt @ipfs/kubo-maintainers for feedback / ideas.
The text was updated successfully, but these errors were encountered: