fix(tests): retry EBUSY when removing test DB dirs on Windows - #515
Merged
DavidBabinec merged 1 commit intoSep 11, 2026
Merged
Conversation
On Windows the OS keeps the SQLite WAL/SHM siblings locked for a while after the last handle closes (asynchronous release, sometimes extended by real-time antivirus scans of freshly written files). fs.rm then fails with EBUSY and flaky teardown failures appear across the server test suite. Retrying with exponential backoff (15s budget) is safe — every handle in the process is already closed — and on POSIX the first attempt always succeeds, so CI is unaffected.
tahayusab
force-pushed
the
fix/windows-test-teardown-retry
branch
from
September 10, 2026 09:36
178f1a9 to
3ecd87e
Compare
DavidBabinec
marked this pull request as ready for review
September 11, 2026 11:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #284 (the EBUSY half that remained after
DbClient.close()landed in #327).What changed
createTestDb() cleanup now retries fs.rm with exponential backoff (15s budget) when it hits EBUSY.
Why
On Windows the OS keeps the SQLite WAL/SHM siblings locked for a while after the last handle closes (asynchronous release, sometimes extended by real-time antivirus scans of freshly written files). fs.rm then fails with EBUSY and server test files (accountSecurity, authStepUp, collabRelay, chatImageHandler, ...) show teardown failures even though every assertion passed. Measured locally: the lock can be held 15s+ after db.close().
Retrying is safe because every handle in the process is already closed; on POSIX the first attempt always succeeds so Linux CI is unaffected.
Verification (local, Windows, bun 1.3.14)