Repository navigation
Conversation
Two service contenders bootstrapping one fresh database raced on the WAL switch and on CREATE TABLE. Set busy_timeout before enabling WAL and run the emptiness check inside an immediate transaction so the second process waits and then reuses the first one's schema.
|
Something I hit while checking this against the repro in #53879, in case it is The Retrying the pragma while it returns |
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Service.ensurekeeps a spare CLI contender alive ("one candidate plus one lock probe"). The bootstrap lock indatabase.tsis an in-processSemaphore, so on a fresh database two processes can reach bootstrap together and one of them fails, is briefly registered asstate: failed, and the desktop shows "Background service failed to start".Dormant in practice: it needs an empty
opencode.dband a contender that takes >5 s to register. It surfaces every run inbench:devex(fresh profile, source CLI booting under Bun).Two doors, both closed:
sqlite.bun.ts/sqlite.node.ts:PRAGMA busy_timeout = 5000before the WAL switch (a fresh file's WAL switch takes an exclusive lock).migration.ts: the emptiness check moves inside aBEGIN IMMEDIATEtransaction, so the second process waits on the write lock and then finds the first one's tables and takes theapplyOnlypath.The new test stands in for two processes with two
SqlClients over one file (no shared per-process lock), parks the first at itsbegin, lets the second bootstrap everything, then releases the first. It fails on the previous code withtable … already exists.Observed while running the desktop benches for #50327; that PR's
bench:devexnumbers were gathered with this fix applied.