Why apps hang while systemd calls them active. Every app unit has
MemoryHigh=768M (MemoryMax=1G): above 768M the kernel slows the process
instead of stopping it. Node does not read that. It sizes its heap from the
whole machine and lets garbage pile up past the mark before it collects.
Measured on Solon's production build (a database with no law acts), 930
requests eight at a time:
no limit 775 MB peak (855 and 990 on other runs), 364 MB idle
512 MB heap 585 MB peak, same answers, same speed
On 2026-11-28 solon stopped answering three times while "active", a favicon
took 4 s, and Loki, OrangeCat and Substrata on the same box were fine; the
reconciler also caught substrata, heidi and sites not answering within the
same day. Not proven from the box (no session can read it; forge-ops#29
prints memory.events), but it is the mechanism the unit file itself sets up.
launch.sh.tmpl: start node with --max-old-space-size at 65 % of the lower of
the unit's memory.high and memory.max (768M -> 499). NODE_HEAP_MB or an own
--max-old-space-size in the app's .env wins; a unit with no limit gets no
flag. Setting it from inside the app does not work (v8.setFlagsFromString
after start: 849 MB peak, no better than none).
deploy.sh: launch.sh was written once by sync-infra and never again, so a
template change reached no running app. Each deploy now renders it again
with the generator's own function (lib.sh render_launch, which sync-infra
uses too), keeping the box copy's port, checked with bash -n before it
replaces the old file. The old file is kept and put back on a rollback.
test-launch-template.sh: 8 new behavioural checks. test:ops passes.
Claude-Session: https://claude.ai/code/session_019MDtmvTCDbJAYNKQpNyKzz
Co-authored-by: Claude <noreply@anthropic.com>