mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #8895] [Issue]: [Bug] JavaScript heap OOM and full-table residency despite chat memory cap (v2.5.1) #8542
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#8542
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 @tlsiddl on GitHub (Nov 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/8895
Summary
Marinara Engine v2.5.1 repeatedly crashes with JavaScript heap out-of-memory errors during roleplay generation, causing HTTP 502 errors and automatic Docker restarts.
Logs also show that 21 lazy-loaded storage tables repeatedly become fully resident, potentially defeating
MARINARA_MAX_RESIDENT_CHATS=8.Expected behavior
Actual behavior
During normal roleplay generation, the server intermittently returns HTTP 502 and the Docker container automatically restarts.
Observed results:
134.Reached heap limit.MARINARA_MAX_RESIDENT_CHATS=8did not prevent subsequent crashes.Affected tables include
messages,message_swipes,memory_chunks,advanced_memory_records,agent_runs,chat_images, and several game-state tables.Steps to reproduce
The following describes the environment and observed sequence. The issue has not yet been reproduced on a clean installation.
MARINARA_MAX_RESIDENT_CHATS=8.Lazy table ... is now fully resident (unbounded access)messages.Environment
Logs, screenshots, or video
V8 heap errors
Full-table residency log counts
Automatic backup failure
Disk usage was subsequently reduced from 97% to 46%, but the heap OOM crashes continued.
Additional context
Possible cause: unscoped reads during automatic backup
In v2.5.1,
buildProfileArchiveSources()inpackages/server/src/routes/backup.routes.tsiterates overFILE_BACKED_TABLESand performs an unscoped read:In
file-backed-store.ts, an unscoped query may callensureTableLoaded(), causing a lazy table to become fully resident for the lifetime of the process.The automatic backup path invokes
buildProfileArchiveSources(). This appears to be a plausible explanation for the repeated full-table residency messages.However, the causal relationship between automatic backups, full-table residency, and the OOM crashes has not yet been conclusively established. Other unscoped queries, extensions, or memory-intensive generation operations may also contribute.
It may be worth investigating whether profile backup/export operations can read table data in bounded batches or use a streaming approach without permanently leasing every lazy table.
Related issue
Request
Could the maintainers investigate whether automatic backup operations or other unscoped queries are causing excessive table residency and heap exhaustion?
Sanitized diagnostics can be provided if needed. Full logs may contain private roleplay content and API configuration details.
Template check
@SpicyMarinara commented on GitHub (Nov 5, 2026):
After the new release.