fix(docker): cap ERL_MAX_PORTS so idle memory stays low on hosts with unlimited nofile #48
Loading…
Reference in a new issue
No description provided.
Delete branch "jtk/erl-max-ports"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #47.
On Docker hosts whose containerd/dockerd unit sets
LimitNOFILE=infinity(Debian'sdocker.io, among others), containers getulimit -n≈ 1.07 billion. ERTS sizes its port table from that, so the v0.6.0 image idles at ~2.18 GB and a second BEAM (bin/fuzzy_catalog rpc/eval) gets OOM-killed on a 4 GB host.Changes
Dockerfilerunner stage:ENV ERL_MAX_PORTS=65536, next toMIX_ENV/UPLOAD_PATH. Still overridable at runtime with-e ERL_MAX_PORTS=….README.md:ERL_MAX_PORTSrow in the env table.No app code changes. Not releasing from this PR; whether it ships as v0.6.1 is Jeremy's call.
Check
Expect
port_limit65536 and total memory in the tens of MB, also with--ulimit nofile=1073741816:1073741816.Review by Nye: Approved. Diff is Dockerfile runner-stage ENV ERL_MAX_PORTS=65536 + README env row, no app code. Base
72368cb(v0.6.0), mergeable, CI / test green. Nothing in rel/overlays or config sets ERL_MAX_PORTS/ERL_FLAGS, so the env var is what ERTS sees. Independently checked: published 0.6.0 under --ulimit nofile=1073741816 with ERL_MAX_PORTS=65536 gives {35540824, 65536} from eval (vs ~2.2 GB idle / OOM without). Runtime -e override still works per your test.