Realtime and Logflare containers use ~2.3 GB RAM each when the host's nofile limit is huge (containerd LimitNOFILE=infinity)
Affected area
Local development
Supabase CLI version
2.122.1 (also checked develop at 95e86b3: realtime.service.ts and logflare.service.ts set no ulimit)
Operating system
Debian 13 (trixie), x86_64
Installation method
npx
Command
supabase start
Actual output
supabase start succeeds, but the Realtime and Logflare (analytics) containers each use about 2.3 GB of RAM while idle:
supabase_realtime_rerun-oss 2.278GiB
supabase_analytics_rerun-oss 2.312GiB
Inside both containers ulimit -n is 1073741816, and Realtime reports :erlang.system_info(:port_limit) = 134217727. :erlang.memory() shows system: 2156 MB with only 4 MB of binaries, 5 MB of ETS and 62 MB of code. The BEAM sizes its port table from the fd limit.
The huge limit comes from Debian's containerd.service (LimitNOFILE=infinity, containerd 1.7.24, docker.io 26.1.5). Containers inherit it when neither the daemon nor the container sets one.
Expected behavior
The two Erlang services stay at a few hundred MB, whatever the host's containerd limit is.
After adding "default-ulimits": {"nofile": {"Name": "nofile", "Soft": 65536, "Hard": 524288}} to /etc/docker/daemon.json and restarting Docker, the same stack settles at:
supabase_realtime_rerun-oss 228MiB
supabase_analytics_rerun-oss 589MiB
That saves about 3.8 GB on a 16 GB machine, and Realtime keeps working (websocket upgrade returns 101, channels join).
Steps to reproduce
- On Debian 13 with the distro
docker.ioandcontainerdpackages, runsupabase init && supabase start. docker stats --no-stream: realtime and analytics are around 2.3 GB each.docker exec supabase_realtime_<project> sh -c 'ulimit -n'prints1073741816.
Crash report ID
No response
Docker and service versions
docker.io 26.1.5+dfsg1-9+deb13u1, containerd 1.7.24~ds1-6+deb13u1, realtime v2.147.1, logflare 1.50.15
Additional context
The CLI already sets nofile for the Edge Runtime container (#5151 / #5152, edgeRuntimeNofileUlimit). Applying the same 65536 limit to the Realtime and Logflare containers, or setting ERL_MAX_PORTS=65536 in their env, would fix this for everyone whose containerd still ships LimitNOFILE=infinity. Supavisor is Elixir too and may be affected when the pooler is enabled.