Skip to content

Commit 3cd4a60

Browse files
committed
fix(core): tolerate eviction marker rename races
1 parent ddf5302 commit 3cd4a60

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/core/src/accounts.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1615,7 +1615,11 @@ export async function acquireRefreshFileLock(options: {
16151615
{ encoding: 'utf8', mode: 0o600, flag: 'wx' },
16161616
)
16171617
} catch (error) {
1618-
if ((error as NodeJS.ErrnoException).code === 'ENOENT') return false
1618+
const code = (error as NodeJS.ErrnoException).code
1619+
// Another contender can rename the marker directory between mkdir and
1620+
// this exclusive create. Darwin/Bun reports that lost-parent race as
1621+
// either ENOENT or EINVAL; both mean this contender lost the marker.
1622+
if (code === 'ENOENT' || code === 'EINVAL') return false
16191623
await releaseEvictionMarker()
16201624
throw error
16211625
}

0 commit comments

Comments
 (0)