mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #5838] [Issue]: Marinara Engine exits randomly during interaction without console errors #3220
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#3220
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Originally created by @SpicyMarinara on GitHub (Sep 4, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5838
Originally assigned to: @kolacheee on GitHub.
Summary
Marinara Engine 2.4.4 intermittently stops while being used from a phone browser. The process disappears from the Linux console without an error, while the host computer remains running.
Expected behavior
Marinara Engine should continue running during interaction. If it terminates, the console should record a useful error or termination reason.
Actual behavior
At an inconsistent time, interaction from the phone browser fails with "failed to fetch" and Marinara Engine is no longer running. The console remains open with no error output, as if Ctrl+C had been pressed; restarting Marinara Engine succeeds immediately.
Steps to reproduce
Environment
1a299369ac)Logs, screenshots, or video
No logs, screenshots, or video provided. The user reports no error in the console; the phone browser displayed "failed to fetch".
Additional context
The issue reportedly does not occur when Marinara Engine is left running overnight and appears limited to periods of interaction. It has occurred with and without YouTube running; the computer and console remain otherwise functional. Support diagnostics reported server memory heap 1124.9 / 4288 MiB and RSS 1841.9 MiB, with Aion active through openrouter using aion-labs/aion-3.0-mini.
Discord thread: ME keeps randomly closing or crashing?
Discord thread link: https://discord.com/channels/1417099416812392641/1545373718941794344
Requested by: kolache (k0lache, Discord ID 220320261780668416)
Discord thread transcript (4 messages)
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
Root cause and fix (maintainer call, 2026-09-04)
The triage comment below fingerprinted the death as an external SIGKILL (every internal exit path on 2.4.4 logs before dying; only SIGKILL is silent), and the memory profile makes the killer clear: 2.4.4 predates the lazy chat-unit loading (#5597) and LRU eviction (#5603), so the server kept every chat ever opened resident — RSS ratchets upward during active use on a device whose 16 GiB is shared with the GPU and the running game, until the system kills the biggest non-game process. That also explains the timing signature exactly: overnight nothing new loads and it survives; active use grows the resident set and it dies. Maintainer decision: treat this as confirmed and fix it, rather than continuing per-user diagnosis.
This issue now tracks the fix: an engine-side platform default for the eviction cap. When
MARINARA_MAX_RESIDENT_CHATSis unset (or invalid) and/etc/os-releaseidentifies SteamOS, the server defaults the resident-chat cap to8— the same value the Termux launcher already exports for phones. An explicit value always wins: raise it, or set0to disable eviction entirely.Engine-side rather than a launcher export, deliberately: the initial
.envload never overrides inherited shell variables while hot reloads do, so astart.shexport would make a user's.envopt-out flap between boots and reloads. The engine-side default has no competing writer, covers every launch method (start.sh, systemd units, directnode dist/index.js), and is testable in the regression lane. Detection keys onID=steamos(OS-wide, not Deck DMI sniffing — the failure profile is the OS's gaming workload, not the board), read once and cached.For the reporter: once this merges, updating to the latest staging is the entire fix — no
.envediting needed. Until then, updating to current staging and addingMARINARA_MAX_RESIDENT_CHATS=8to the.envnext tostart.shachieves the same thing manually.@kolacheee commented on GitHub (Sep 4, 2026):
Triage from the diagnostics and the 2.4.4 source. Three findings narrow this a lot, and there is a two-minute test that should settle it.
1. This is a Steam Deck
6.18.38-valve1-1-neptuneis Valve's Neptune kernel — the server is running on a Steam Deck (SteamOS). That matters because the Deck has 16 GB of RAM shared with the GPU, and the engine is already sitting at RSS 1841.9 MiB at the moment the diagnostics were captured (heap 1124.9 MiB, so ~700 MiB of that is off-heap: the embeddings model, buffers). Memory pressure is a first-class suspect on this hardware in a way it would not be on a desktop tower.2. The silence is itself the fingerprint
On 2.4.4 (
1a299369ac70), every way the process can die from the inside prints something first, verified inpackages/server/src/index.tsat that commit:process.exit(1)Received SIGTERM; shutting down Marinara Engineand thenShutdown completeShutdown failedThe reporter saw nothing — no error, no shutdown line, console intact. The only termination that produces zero output from the app is SIGKILL, which cannot be caught or logged. So something outside the process killed it. On Linux, an interactive-load-correlated SIGKILL is nearly always the kernel OOM killer or
systemd-oomdresponding to memory pressure — and "only when interacting, never overnight" matches that exactly, since pressure only spikes while the engine is actually generating (prompt assembly, vectorization, streaming).One nuance: when a foreground process is SIGKILLed, bash normally prints a lone
Killedline. It is one dull line under colourful engine logs, checked minutes later from another room — easy to miss, so its reported absence is weak evidence either way. The test below removes the ambiguity entirely.3. The decisive test (runs on 2.4.4 as-is, no update needed)
The Linux launcher ends in
exec node dist/index.js, so the exit status of./start.shis the server's exit status. Ask the reporter to:a) Launch it like this from now on:
When it next dies, that line prints no matter how it died:
b) Right after a death, ask the kernel who did it:
A kernel OOM kill logs the victim, its RSS, and the whole memory situation. If this prints permission errors or nothing at all, put
sudoin front (on a Steam Deck,sudoneeds a password set once viapasswd).c) Check whether systemd-oomd is running, and if so, its log:
systemd-oomdkills earlier and more quietly than the kernel and does not show up injournalctl -k.d) Catch native crashes, just in case:
e) Context worth having: Desktop Mode or Gaming Mode, and whether a game was running when it died (a game claims a large slab of the shared 16 GB and makes the engine the biggest remaining target).
On updating to staging (#5797)
Not required for the above — Linux gives us better witnesses (journalctl, exit status, coredumpctl) than the postmortem does; that tooling exists precisely because Termux offers none of them. But updating is still worthwhile as a persistent witness: staging's diagnostics now report
Previous session/Sessions ended without shutdown, and the 30-second heartbeat records RSS, so after a death the next boot shows the last-known memory from within 30 s of the kill — direct evidence for or against a memory spike even if journal logs rotate or the reporter forgets to check in time.If it is confirmed OOM
Then the engine-side question becomes why RSS is at 1.8 GiB and what interaction spikes it (the file-backed store's known memory appetite under large data is the standing suspect — see #4730's family), and the user-side mitigations are the usual Deck ones (don't run it beside a heavy game, or add swap). But naming the killer comes first.
@kolacheee commented on GitHub (Sep 5, 2026):
Field results after the merge, and the killer now has a name. Closing the loop on this issue's record even though it is closed:
The killer is Valve's
holo-earlyoomThe reporter's
sudo journalctlfinally caught it in the act:That resolves every earlier anomaly: earlyoom is a userspace daemon (so
journalctl -kwas rightly empty — the kernel OOM killer never fired), and it kills a single process by oom_score (so the launching shell survived while node died). TheSteamAppIdnoise in the log is cosmetic: Valve's kill-logger fails to attribute the kill to a Steam title because our process has noSteamAppIdenv var. It does not affect the kill decision at all — nothing about not being a Steam app caused this.The hardware reframes the memory math
The reporter clarified they are not on a Steam Deck — this is SteamOS on an AMD BC-250 (PS5-family APU board), where most of the 16 GB GDDR6 is carved out as VRAM and the OS keeps roughly 5 GB. earlyoom's own measurement puts node at 2922 MiB RSS — 58% of system RAM — with 270 MiB left when it acted. (The reporter's system-monitor impression that "it can't be memory, there was no spike" is answered by the same log line: earlyoom triggers on the available-memory floor, not on a spike, and the steady growth was node.)
Worth noting: the
ID=steamosdetection from #5839 covers this box too — OS-wide detection rather than Deck DMI-sniffing was the right call.The resident-chat cap was active and did not bound them
This session ran the merged build (
ed324d7d6183) and still grew ~1.9 GB in 24 minutes. So for this user's data shape the memory bulk is not resident-chat count — the cap is necessary for the Deck-class case but not sufficient here. Interim mitigation relayed (same move the Termux profile makes with its 1024 MiB heap):in the
.envnext tostart.sh. If it still OOMs with that set, it fails loudly with a JS heap trace instead of vanishing — either outcome is informative. The deeper "where do the gigabytes live" investigation is deliberately not being opened for this platform.One genuine engine bug fell out of the log
earlyoom sent SIGTERM at 16:24:35; the reporter's shell wrapper recorded exit 0 at 16:25:14 — our graceful shutdown took 39 seconds, because
shutdown()awaitsapp.close()without any bound and close waits on open connections (a phone browser holding an SSE stream). earlyoom's grace window is ~10 s; systemd and Docker have their own stop timeouts. On any of those, a slow close turns an orderly stop into a SIGKILL that drops debounced writes. Fix incoming as a small separate PR: a shutdown deadline that force-exits if close overruns, on every close path (signal shutdown + both update/admin restart routes).