Repository navigation
Description
Summary
supermemory-server (local / lite) grows its memory without bound on a small, mostly idle dataset and gets OOM-killed by its cgroup limit every 4–22 hours. Once (after one such OOM restart) the embedded database got stuck returning cannot drop active portal "" on every query, so /v3/search answered 500 for ~2 days until a manual restart.
Environment
- supermemory-server v0.0.8 (upgraded from v0.0.3 via
supermemory-server upgrade), lite license - Ubuntu 24.04.4 LTS, kernel 6.8.0, x86_64, 4 vCPU, 8 GB RAM, 2.5 GB swap
- Runs as a systemd user unit on 127.0.0.1:6767, single client (Hermes agent memory plugin: auto recall + auto capture, hybrid search)
- Embeddings: local
Xenova/bge-base-en-v1.5(768d) - Data dir ~600 MB on disk; 616 documents total, one container tag
- Env:
SUPERMEMORY_EMBEDDING_RAM_LIMIT=512mb,SUPERMEMORY_INGEST_CONCURRENCY=1,SUPERMEMORY_LOCAL_EMBEDDING_POOL_SIZE=1,SUPERMEMORY_LOCAL_EMBEDDING_WASM_THREADS=1,SUPERMEMORY_LOCAL_EMBEDDING_BATCH_SIZE=4,SUPERMEMORY_LOCAL_EMBEDDING_MAX_BATCHES_BEFORE_RECYCLE=4 - cgroup limits:
MemoryMax=3500M,MemorySwapMax=512M, noMemoryHigh
1. Unbounded memory growth → OOM kill
- Startup peak ≈ 3.4 GB, then settles at ~2.0–2.25 GB (anon ≈ 1.6–1.8 GB, rest page cache). Startup log:
[ingest] memory limit 0.5 GB above baseline (1.7 GB). - After that anon memory keeps growing while the document count barely changes (511 → 616 docs over 9 days), until the cgroup limit (3.5 GB + 512 MB swap) is hit and the kernel OOM-kills the process.
- OOM kills on v0.0.8: Oct 10, Oct 12, Oct 13, Oct 15, Oct 16 (×3) – intervals between 4 h and ~2 days, typically under 1 day.
- Two more crashes ended in core dumps:
status=4/ILL(Oct 11) andstatus=5/TRAP(Oct 13). - v0.0.3 showed the same pattern: after 2.7 days uptime it had 1.7 GB RSS + 2.1 GB swapped out (it was capped at 1800M and ended up thrashing in swap, not accepting connections on 6767).
616 small documents needing 2 GB at baseline and growing past 4 GB looks like a leak rather than a sizing problem.
2. DB stuck in cannot drop active portal "" after an OOM restart
After the OOM restart on Oct 13 15:13, every DB query failed until a manual restart on Oct 15:
error: cannot drop active portal ""
severity: "ERROR",
query: "select \"id\", \"status\", \"processing_metadata\" from \"document\" where ((\"document\".\"status\" in ($1, $2, $3, $4) ...
[Cron] Starting stuck/failed dreaming job retry
error: Failed query: select "dreaming_job"."batch_id", "dreaming_job"."org_id", "dreaming_job"."container_tag", min("dreaming_job"."processing_started_ ...
Search error: (FiberFailure) VectorDBError: Failed to search chunks (namespace: <org>_chunks_<tag>)
[cause]: Error: Failed query: select "id" from "document" where ("document"."org_id" = $1 and "document"."container_tags" @> ARRAY[$2]::text[])
[cause]: error: cannot drop active portal ""
error: Search failed: Failed to search chunks (namespace: <org>_chunks_<tag>)
POST /v3/search → 500 {"error":"Invalid search parameters or database error","code":"SEARCH_ERROR"}. 6–60 such errors per hour for ~44 h. A plain systemctl restart fixed it (search 200 in ~0.1 s, all documents present); it has not reappeared after the 4 OOM restarts since.
3. Minor (v0.0.3, before upgrade)
Hourly retry cron marked 342 jobs Permanently failed (no retry params key); those documents were never re-processed after upgrading.
Expected
Stable memory for a small dataset (or a documented way to cap it), and the server recovering by itself (or exiting so the supervisor restarts it) when the DB connection gets into the cannot drop active portal state.
Happy to collect more data (heap snapshot, specific env flags) if you tell me what would help.
Activity
linear-code commentedon Oct 17, 2026
ENG-1318
brenthorn commentedon Oct 24, 2026
Same crash class on server-v0.0.8 (linux-x64; corrected from 0.0.9: the boot line reads
update available: v0.0.8 → v0.0.9, 8 GB box): 5 core-dumps 2026-10-22..24 (status=4/ILL, "oh no: Bun has crashed").The root cause looks like the embedded runtime: every server build we checked (0.0.5, 0.0.7, 0.0.8, 0.0.9-rc.3, 0.0.9) embeds
Bun v1.3.4 (5eb2145b), including 0.0.7, whose notes for #1456 said it shipped "a newer Bun runtime". Bun 1.4.0 removed libpas (thepas panicsource) and 1.4.4 has more GC fixes on Linux.Latest decoded trace (https://bun.report/1.3.4/la15eb2145mgEuhooCkyo8vE+ypRmi9yuEs9y4jF+2sjkFy8+ikFymnvjF2g0ujF4wz2jF632hkFyry2jF6932jF0l30tFm7h7hEq7n63Euo4g3E___0rztgEA2AA): segfault at 0x0 in
pas_system_heap_allocate←MarkedSpace::forEachWeakInParallel← GC triggered bynew Uint8Array(n). It was preceded byTypeError: Invalid header name: 'access-control-expose-headers<garbage bytes containing /tmp/pglite/... paths>', so the heap was already corrupted.BUN_JSC_useConcurrentGC=0andMalloc=1did not help.Could you publish a server build on Bun >= 1.4.4? Happy to test an rc. And if that isn't planned soon: is repacking the shipped bundle on a newer Bun permitted under the lite licence?
Update: the crashes are phase-locked to the whole-DB snapshot. With the snapshot interval at 300 s (byte-patched from the hardcoded 10 s, since there's no knob for it), 12 of 14 core-dumps hit 5–83 s after a multiple of 300 s of process uptime (p ≈ 5e-6). Three decoded stacks die in the snapshot path's
new Uint8Array(n). A configurable snapshot interval, or incremental persistence instead of a fulldumpDataDireach tick, would help a lot alongside the Bun bump.Malloc=1made things worse for us (rate about 4x), so others shouldn't try it.brenthorn commentedon Oct 24, 2026
Following up on my comment above with what we've found since, and three concrete asks.
1. A server build on Bun >= 1.4.4. We checked both the v0.0.8 and v0.0.9 linux-x64 assets: each embeds
Bun v1.3.4 (5eb2145b). Bun 1.4.4 (announced 2026-10-24) fixes three security advisories affecting 1.4.3 and earlier: compromised eMudhra certs, a brotli decoder bug, and HTTP/3 header handling. Bun recommends rebuildingbun build --compileexecutables. Bun 1.4 also drops libpas, which shows up in our earlier traces.2. A snapshot-interval setting. 14 core-dumps since 2026-10-13. 12 of them landed 5–83 s after a snapshot tick (interval byte-patched to 300 s; p ≈ 5e-6). Three decoded stacks end in the gzip step's
new Uint8Array(n), insidedumpTar→ CompressionStream. Trimmed frames:pas_system_heap_allocate ← WTF::fastMalloc ← MarkedSpace::forEachWeakInParallel ← Heap::addCoreConstraints ← … collectIfNecessaryOrDefer ← reportExtraMemoryAllocatedSlowCase ← JSGenericTypedArrayView<Uint8Adaptor>::createUninitialized ← operationNewUint8ArrayWithOneArgument3. Is
WORKFLOW_ENGINE=directsupported long term? EveryInvalid header name: 'access-control-expose-headers<garbage>'error was thrown at rivetkit'sRegistry.handler(new Response(…, {headers: f.headers})), where the headers come from the napi addon. Our inference: memory corruption is involved there. The v0.0.8 doctor suggestsdirect. Is it safe to run in production?If a rebuild isn't planned soon, the licence question above stands: may self-hosters repack the shipped bundle on a newer Bun for single-host use? We won't do it without your OK.
Happy to test an rc on Linux x64 and share logs.
cameronmichaelharper-ai commentedon Oct 25, 2026
Adding a pinned-release observation and recovery questions to this existing thread rather than opening a duplicate. Our Docker state reported OOMKilled=false; we have not established that our crash shares the OOM, snapshot or allocator mechanism discussed here. Related earlier threads: #1320 and #1456.
Additional observation: server-v0.0.9 Linux x64 segmentation panic and recovery questions
We evaluated the supplied self-hosted server-v0.0.9 Linux-x64 binary in an isolated local Docker benchmark with local OpenAI-compatible inference. The native process terminated with a Bun 1.3.4 segmentation panic; Docker reported exit code 132, OOMKilled=false and restart count 0. We have not established the underlying runtime defect or mapped the panic to a specific source operation.
Release provenance:
The API accepted 1,828 document submissions, but logs established only 13 completed full workflows before failure. We do not equate acceptance, intermediate workflow folders or process existence with completed ingestion. The stopped container, volume, manifest and captures are preserved; we have not restarted it, resubmitted the documents or submitted the binary's crash-report link.
Please clarify for this exact release:
We can prepare a small synthetic reproduction once the supported diagnostic/recovery procedure is known. No corpus, credentials, private captures, native database or binary sample is attached to this comment. We would prefer a supported private diagnostic channel before sharing potentially sensitive logs. This is not a claim of data corruption or malicious behavior.
Snapshot every 300 s and give the server 10.5 GiB so the 1.36 GB stor…
nattiini45 commentedon Oct 30, 2026
Another data point, this time from native Windows (server-v0.0.8
supermemory-server-windows-x64.exe, sha256d8fb2ac0…71c47, embeds Bun 1.3.4+5eb2145b), lite license, 64 GB Windows 11 box.datafile on disk, local embeddingsXenova/bge-base-en-v1.5(768d), extractor on an OpenAI-compatible endpoint, Hermes agent memory plugin with auto recall + auto capture from about 20 agent profiles.SUPERMEMORY_EMBEDDING_RAM_LIMIT=512mb,SUPERMEMORY_INGEST_CONCURRENCY=1,SUPERMEMORY_LOCAL_EMBEDDING_POOL_SIZE=1,SUPERMEMORY_LOCAL_EMBEDDING_WASM_THREADS=1,SUPERMEMORY_LOCAL_EMBEDDING_BATCH_SIZE=4,SUPERMEMORY_LOCAL_EMBEDDING_MAX_BATCHES_BEFORE_RECYCLE=4). After restart it peaked at ~5 GB and settled at ~2.6 GB, flat over the first 6+ minutes under the same load. I'll report back if it creeps.+1 to the ask for a server build on Bun >= 1.4.4, and for a native Windows 0.0.9 (or later) build once that lands. The 0.0.9 notes say Windows stays on 0.0.8, so Windows users currently have no upgrade path.
hieuvp commentedon Nov 30, 2026
Another data point on server-v0.0.9 (official
supermemory/supermemory:0.0.9image, linux-x64, embedsBun v1.3.4 (5eb2145b)), Kubernetes, 20 GiB memory limit, local embeddingsXenova/bge-m3(1024d),SUPERMEMORY_EMBEDDING_RAM_LIMIT=4gb,SUPERMEMORY_LOCAL_EMBEDDING_WASM_THREADS=8. Data file: 1.3 GB.Three restarts in about 19 hours (2026-11-29/30), one of each class from this thread:
trap int3Bun crashanon-rss18.4 GB)panic: Segmentation fault, exit 132,OOMKilled=false; the crash banner reportedPeak: 19.91GBwhile the working set had read about 9 GiB a minute earlierWhat a 5-second cgroup sample shows (
memory.currentandmemory.peak):memory.peakreached 20,479 MiB (the limit) once, without a killA fourth restart was caught at 5 s resolution: a steady sawtooth (about +0.25 GiB per 5 s, dropping back roughly every 30 s, which matches the snapshot cadence we see on disk: a full 1.35 GB rewrite about every 30 s), then a single cycle jumped from 12.7 to 19.1 GiB in under 5 s and hit the limit. The kernel reported
anon-rss18.2 GB plusshmem-rss1.32 GB, about one copy of the data file. The last log line had come 3 min 40 s earlier, with no work in flight.That fits the silent whole-DB snapshot as the source. The memory cost seems to grow with DB size: ours is two to three times the 480–600 MB reported above, and the bursts are correspondingly larger.
+1 to the asks above: a server build on Bun ≥ 1.4.4, and a setting for the snapshot interval.