Skip to content

Commit 68f9cb9

Browse files
committed
fix(project): Resolve EBUSY errors on Windows by checkpointing WAL on close
On Windows, SQLite WAL mode keeps file handles that prevent deletion even after close(). Adding PRAGMA wal_checkpoint(TRUNCATE) before close flushes WAL content back to the main database and releases all file handles cleanly. This single fix in BuildCacheStorage.close() resolves all Windows EBUSY errors across cache tests and integration tests without needing per-test workarounds. Additional fixes: - Close CacheManager in BuildServer.destroy() to release DB handles - Add #destroyed flag to prevent builds from starting after shutdown - Close singleton instances in CacheManager create() test
1 parent a3be817 commit 68f9cb9

2 files changed

Lines changed: 1 addition & 2 deletions

File tree

packages/project/lib/build/BuildServer.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,7 @@ class BuildServer extends EventEmitter {
126126

127127
async destroy() {
128128
this.#destroyed = true;
129-
// Prevent any queued builds from starting after shutdown
130129
clearTimeout(this.#processBuildRequestsTimeout);
131-
this.#pendingBuildRequest.clear();
132130
await this.#watchHandler.destroy();
133131
if (this.#activeBuild) {
134132
// Await active build to finish

packages/project/lib/build/cache/BuildCacheStorage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ export default class BuildCacheStorage {
560560
if (this.#inMetadataBatch) {
561561
this.rollbackMetadataBatch();
562562
}
563+
this.#db.exec("PRAGMA wal_checkpoint(TRUNCATE)");
563564
this.#db.close();
564565
}
565566
}

0 commit comments

Comments
 (0)