Open
Labels
hostHost daemon, process lifecycle, memory, event looppartial-reproBug partially reproduced; some claims unverified; see linked reportperfthreadsTurns, timeline, messaging, forks
Description
On a single-user Mac Studio running bb 0.48.1 (server protocol 258), the server stopped logging for 15-18 s three times in one night (23:05:48-23:06:06, 02:01:48-02:02:03 and 04:30:16-04:30:32 UTC). Connected host daemons' event posts failed with fetch failed during exactly those gaps.
What the logs show:
select "type" from "events" where thread_id = ? and turn_id = ?took 7-17.5 s with only 0.4-0.8 s CPU (waiting on I/O).TRANSACTION IMMEDIATEtook 5-11 s. There were 56 such slow selects in 8.5 h of uptime.- 29 of the 40 selects of 5 s or more ran within 30 s of "Slow thread event pruning". Pruning itself takes up to 3.4 s to remove 32 events (381 pruning warnings in 8.5 h).
- bb.db is 6.45 GB and grows about 0.35 GB a day (WAL 79 MB). Under memory pressure the page cache cannot hold it, so these queries read from disk.
Two requests:
- Keep SQLite work off the server's event loop (a worker thread, or async batching for event reads and pruning), so slow disk I/O cannot freeze the whole server.
- Add an index that covers
events(thread_id, turn_id)(or the query's access path), and make event pruning incremental and bounded so it does not hold long write transactions.
Environment: macOS 27 on Apple silicon, bb-app 0.48.1, about 40 concurrent agent threads. Logs are available on request.
Metadata
Metadata
Assignees
Labels
hostHost daemon, process lifecycle, memory, event looppartial-reproBug partially reproduced; some claims unverified; see linked reportperfthreadsTurns, timeline, messaging, forks
Activity
bb-slop-cop commentedon Nov 2, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotClassification: Bug · Priority: High · Effort: High · Labels:
host,threads,perf,partial-repro.Reproduction and root-cause report — PARTIALLY REPRODUCED. Confidence: high for synchronous event-loop blocking; the reported cold-read I/O cause remains unverified.
On trusted
main(93411e8e6a), a controlled SQLite writer lock made the real daemon-event persistence transaction delay a 20 ms timer to approximately 739 ms in both clean-checkout runs. The root cause is synchronous SQLite transaction execution on the server thread. The covering thread/turn index and incremental, bounded pruning already exist; the original 15–18 second read stalls were not reproduced.The report includes the complete regression test: its heartbeat assertion fails as expected in both runs, while the index/pruning checks and 187 existing database tests pass.
No pull request: guaranteeing off-thread database execution requires an architecture decision, outside the simple-fix criteria.
Move archived threads to cold storage from Storage & retention, with …