-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Problem
tapes deck loads every node's full content field into memory via loadSessionCandidates() in pkg/deck/query.go:105-111, regardless of the selected time period. With large databases (200MB+, 57K+ nodes), this causes the process to be OOM-killed.
The query has no WHERE clause on created_at, so even --since 1h loads the entire database first, then filters in memory.
I hit this this morning after a few weeks of consistent usage.
Root cause
Two issues in pkg/deck/query.go:
-
node.FieldContentis included in theSelect()(line 106) — the overview dashboard only needs token counts and metadata, not full message content. Some nodes have content fields >2MB (tool results with large file reads). -
No time-based filtering at the SQL level — the
Since/From/Tofilters fromFiltersare only applied after all nodes are loaded into memory.
Suggested fix
- Remove
node.FieldContentfrom theSelect()inloadSessionCandidates(). Content should only be loaded on-demand when drilling into a specific session. - Add a
WHERE created_at >= ?clause whenFilters.SinceorFilters.Fromis set, so the DB only returns relevant nodes.
Impact
Any user with a database over ~100MB will have tapes deck killed by the OS. This is easy to hit after a few weeks of active use.