Skip to content

Commit b229520

Browse files
authored
Increase SQLite busy_timeout from 1ms to 500ms (zed-industries#49039)
When two Zed instances share the same data directory (e.g. a release build and a dev build running simultaneously), SQLite operations can fail with "database is locked" (error code 5), surfacing as a "Failed to Launch" error in the agent panel. The root cause is `PRAGMA busy_timeout=1` in `crates/db/src/db.rs`, which gives SQLite only 1ms to wait for a write lock before giving up. With WAL mode, the actual lock hold times are microseconds — the problem isn't long-held locks, it's that we give up before even trying to wait. During startup, both instances hit the DB heavily for workspace restoration, so even tiny overlaps fail. This changes `busy_timeout` from 1ms to 500ms, giving SQLite more room to retry without (hopefully) any perceptible delay to the user. Closes AI-20 Release Notes: - N/A
1 parent 99db990 commit b229520

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎crates/db/src/db.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const CONNECTION_INITIALIZE_QUERY: &str = sql!(
2828

2929
const DB_INITIALIZE_QUERY: &str = sql!(
3030
PRAGMA journal_mode=WAL;
31-
PRAGMA busy_timeout=1;
31+
PRAGMA busy_timeout=500;
3232
PRAGMA case_sensitive_like=TRUE;
3333
PRAGMA synchronous=NORMAL;
3434
);

0 commit comments

Comments
 (0)