Skip to content

Comments

fix: add retry logic with exponential backoff to handle Windows EPERM errors in safeMoveFile#13264

Merged
czubocha merged 1 commit intomainfrom
fix-eperm-windows-test-issue
Jan 15, 2026
Merged

fix: add retry logic with exponential backoff to handle Windows EPERM errors in safeMoveFile#13264
czubocha merged 1 commit intomainfrom
fix-eperm-windows-test-issue

Conversation

@czubocha
Copy link
Contributor

Fix Windows CI EPERM error with retry logic

Problem

Windows CI runners fail intermittently with:

EPERM: operation not permitted, rename 
'C:\Users\RUNNER~1\AppData\Local\Temp\sls-ajvXXX\...' 
-> 'C:\Users\runneradmin\.serverless\artifacts\...'

This occurs even after fixing the temp directory location because Windows can throw EPERM transiently due to file handle timing issues.

Solution

Added EPERM retry logic in safe-move-file.js with exponential backoff:

  • Retry 1: 100ms delay
  • Retry 2: 200ms delay
  • Retry 3: 400ms delay

Total max wait: 700ms before throwing.

Safety Analysis

Verified all 3 usages of safeMoveFile are safe for retry:

  • resolve-ajv-validate.js: Content-addressed files (hash-based filenames)
  • generate-zip.js: Deterministic zip from static source files
  • log-deprecation.js: Idempotent text file write

Changes

  • packages/serverless/lib/utils/fs/safe-move-file.js: Add EPERM retry with exponential backoff

@Mmarzex
Copy link
Contributor

Mmarzex commented Jan 15, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@czubocha czubocha merged commit 9e83b10 into main Jan 15, 2026
10 checks passed
@czubocha czubocha deleted the fix-eperm-windows-test-issue branch January 15, 2026 13:18
@github-actions github-actions bot locked and limited conversation to collaborators Jan 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants