Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Use the macOS desktop app with a large
statev2.sqlite(46 GB here;orchestration_v2_projection_turn_itemshas 265,477dynamic_toolrows holding 25 GB ofpayload_json). - Update from
0.1.10-nightly.20261115.4723(migration head 94) to0.1.10-nightly.20261116.4787. - Open the app. Migration
95_TurnItemInlineWorkOutputstarts.
Expected behavior
Migration 95 finishes and the server becomes ready.
Actual behavior
Migration 95 never finishes. Seen twice, the second time after a full reboot:
- For about 6 minutes the server writes heavily, and
statev2.sqlite-walgrows to 16 GB. - Then all disk I/O stops (0 bytes read or written over 10 s samples), but the process keeps 2 to 3 cores busy, mostly in kernel time, and its memory footprint stays at 15 GB (
footprintshows 15 GB dirty in about 269k regions). - No new trace spans after the
ALTER TABLEand no commit. The first run sat like this for over an hour. /.well-known/t3/environmentfirst returns 503, then stops answering at all.
Diagnosis
The WHERE clause is not the problem. Run alone and read-only in the sqlite3 CLI, it takes 2 min 42 s and matches 138,554 rows totalling 21 GB of payload_json.
The cost is the rewrite. ADD COLUMN ... DEFAULT 0 doesn't touch existing rows, but SET inline_work_output = 1 rewrites each matched record, including every overflow page of its payload. So the UPDATE rewrites about 21 GB of data.
It runs inside the migrator's transaction, so SQLite most likely keeps a statement journal (an undo copy of every page the statement changes). The server sets PRAGMA temp_store = MEMORY, so that journal lives in RAM. On a 36 GB machine the process reaches 15 GB, roughly the size of the WAL written so far, and then stops making progress. I couldn't confirm what it spins on: the bundled binaries are stripped, and stack samples show the SQLite worker thread mostly inside signal handlers.
Supporting evidence: the same statements in one transaction in the sqlite3 CLI (3.54.0), with PRAGMA temp_store = FILE and the server stopped, completed normally:
BEGIN IMMEDIATE;
INSERT INTO effect_sql_migrations (migration_id, name) VALUES (95, 'TurnItemInlineWorkOutput');
ALTER TABLE ... ADD COLUMN inline_work_output ...; -- instant
UPDATE ... SET inline_work_output = 1 WHERE ...; -- 562 s, 138,554 rows
COMMIT; -- 199 s
PRAGMA wal_checkpoint(TRUNCATE); -- 4 s
PRAGMA quick_check; -- okSuggestions
- Don't rewrite large payload rows to set a flag. For example, keep the flag in a small side table keyed by item id, or compute it on read.
- If it has to be a column, backfill in batches (for example by rowid range) in separate transactions after the server is ready, instead of one statement inside the startup transaction.
- Consider not forcing
temp_store = MEMORYwhile migrations run.
Impact
Blocks work completely
Version or commit
0.1.10-nightly.20261116.4787 (desktop, bundled server)
Environment
macOS 27.2.1, Apple M3 Max, 36 GB RAM, desktop app (Nightly), Local environment on
Logs or stack traces
server.trace.ndjson, second attempt (after reboot), local time
20:33:21 INSERT INTO effect_sql_migrations ... (95)
20:33:21 ALTER TABLE orchestration_v2_projection_turn_items ADD COLUMN inline_work_output ...
(no further spans)
20:39 statev2.sqlite-wal stops growing at 16 GB
20:44 process: 200% CPU, footprint 15.2 GiB, disk read and write 0 MiB over 10 sWorkaround
Quit the app, make sure the backend has exited, then run migration 95 by hand in the sqlite3 CLI as above (same SQL, one transaction, temp_store = FILE), including the effect_sql_migrations row. Make sure there's free disk space of about twice the size of the rewritten rows first (WAL plus temp journal). The app then runs only migration 96 on the next launch.
Related issues
- Startup still blocks for ~7 minutes on 0.1.10 migrations after the #35421 fix, and clients only get an empty 503 #35995: startup blocked for minutes by 0.1.10 migrations (those finish; this one never does).
- [Bug]: Desktop shows only the logo during long database migrations, so the app looks frozen after an update #37129: desktop shows only the logo during migrations, with no progress.
Activity
lol2x commentedon Nov 17, 2026
Same failure on Windows, still present in
0.1.11-nightly.20261117.4825Environment: Windows 11 Pro (10.0.26200) x64, 125.6 GB RAM, desktop app (Nightly) running its bundled local server. Version installed:
0.1.11-nightly.20261117.4825(the latest nightly when this was written). Updated from0.1.10-nightly.20261113.4630.Database:
statev2.sqliteis 27.5 GB, andstatev2.sqlite-walis 16.7 GB after the failed attempts.Symptom difference from macOS: the backend does not hang. On Windows it exits by itself 3–5 minutes into migration 95 with exit code
4294930435(0xFFFF7003). Its stderr only showscrashpad_client_win.cc:867] not connected, and the Windows Application event log has no crash entry. The desktop shell behaves as designed (backend is still migrating its database; waiting) and restarts the backend. Migration 95 then starts from scratch every time, so the app stays on the logo screen indefinitely.server-child.log(3 consecutive runs):The last span in
server.trace.ndjsonis theALTER TABLE ... ADD COLUMN inline_work_output. NoUPDATE/COMMITspan follows.Workaround confirmed on Windows: the manual
sqlite3run from the issue body (3.54.1,PRAGMA temp_store = FILE, app fully quit, DB backed up first) completed normally in one transaction. 65,816 rows were flagged,COMMITsucceeded,wal_checkpoint(TRUNCATE)shrank the WAL from 16.7 GB to 0, andquick_checkreturnedok. The migration head is now 95.Posted via
t3 triageby Claude Code (Claude Opus 5.5).CountMyBands commentedon Nov 21, 2026
Another Windows data point: migration 95 completed when left alone
Environment: Windows 11 Pro (10.0.26200) x64, desktop app with its bundled local server. Last recorded server before the update was
0.1.10-nightly.20261114.4682. The exact nightly it updated to is unknown. The user then reinstalled, and the migration completed on stable0.1.11.Database:
statev2.sqliteis about 40 GB, with about 10 GB of that on the freelist.Symptom: logo-only window,
/.well-known/t3/environmentreturning 503, and the server trace ending at theALTER TABLEforinline_work_output. Reinstalling did not help because the database is kept. Attempts that were closed partway through rolled back, and migration 95 restarted on the next launch.Result: unlike the hang and crash reports above, the run completed without intervention:
This suggests that at least some affected users are only blocked by the logo-only screen giving no sign that they should wait. A visible "upgrading database, don't quit" state would have prevented the restarts here, even before #37995 lands.
Produced with
t3 triageby Claude Code (Claude Opus 5.5).antoniooo12 commentedon Nov 23, 2026
Linux data point: when 095 completes, the server keeps the memory afterwards
Setup: a Linux server (32 cores) updated from
0.1.10-nightly.20261114.4682to0.1.11-nightly.20261119.4941. Itsstatev2.sqliteis 35.8 GB, and migration 95 matched 38,501dynamic_toolrows holding 5.66 GB of payload. Here the migration finished, in about 4 minutes, but the server kept the memory it used:During 095: RSS reached 5.7 GB. The journal shows 095 ran from 23:26:32 to 23:30:40, and a sample at 23:30:13 read 5,689 MB, before the server was listening.
Four days later: the server still holds about 6.2 GB, almost all of it in swap. It sits in 130 glibc thread-arena slots of 64 MiB each. The live JS heap is about 0.4 GB.
Replay on a copy of this database (
node:sqlitein a worker thread, same statements):temp_storeCOMMITMEMORYFILEWith
MEMORY,malloc_trim(0)dropped RSS to 93 MiB, so the memory is freed but not returned to the OS.Why it matters after the migration: the retained arena slows every
child_process.spawn, because fork copies the page tables, swap entries included.malloc_trim(0). It was 0.4 ms at 0 GiB.So besides the hang on large databases, a migration 95 that completes still leaves the server several GB larger for as long as it runs.
#37995 removes this for 095. In a 1.2 GB rewrite (40,000 × 30 KB rows), current main peaked at 1,532 MB, while #37995's per-row 095 peaked at 236–238 MB.
The "Not in this change" note in #37995 still applies: any future large rewrite under
temp_store = MEMORYon the writer worker leaves the same retained arena. Running migrations undertemp_store = FILEcapped the peak at 230–238 MB in the same test. It costs temp disk roughly equal to the rewritten size. If the temp directory is too small, startup then fails withSQLITE_FULL; the migration rolls back cleanly and the next start completes.Side note: the test "keeps a write transaction's statement journal off the temp directory" looks for
etilqs_file names. On Node 26.13.1 on Linux, SQLite opens the journal withO_TMPFILE, so the test still passes withPRAGMA temp_store = MEMORYremoved.Measured with Claude Opus 5.5, GPT-6.2 Sol and Gemini 4 Neon in T3 Code.