Skip to content

Retry prim_file:rename on eacces error #546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025
Merged

Conversation

mkuratczyk
Copy link
Contributor

On Windows, when creating a snapshot (renaming a checkpoint), occasionally prim_file:rename failed with eacces. It's not clear why this happens, it appears that Windows may not release the file handle immediately after closing the file so a close->rename in a quick succession may sometimes return an error.
With this commit, we just retry after 20ms and so far, in our testing, the error has never occurred on the second attempt (with a 10ms delay, it still failed every now and then)

We could have separate macros for eagain and eaccess, but I went with a shared one. One retry seems reasonable in both cases.

On Windows, when creating a snapshot (renaming a checkpoint),
occasionally prim_file:rename failed with `eacces`. It's not clear
why this happens, it appears that Windows may not release the file
handle immediately after closing the file so a close->rename in
a quick succession may sometimes return an error.
With this commit, we just retry after 20ms and so far, in our testing,
the error has never occurred on the second attempt (with a 10ms
delay, it still failed every now and then)

We could have separate macros for eagain and eaccess, but I went with
a share one. One retry seems reasonable in both cases.
@kjnilsson kjnilsson merged commit d034303 into main Jun 10, 2025
4 checks passed
@michaelklishin michaelklishin deleted the retry-rename-on-eacces branch June 10, 2025 11:11
@michaelklishin michaelklishin added this to the 2.16.10 milestone Jun 10, 2025
@michaelklishin michaelklishin modified the milestones: 2.16.10, 2.16.11 Jun 23, 2025
michaelklishin added a commit to rabbitmq/rabbitmq-server that referenced this pull request Jun 24, 2025
mergify bot pushed a commit to rabbitmq/rabbitmq-server that referenced this pull request Jun 24, 2025
to include rabbitmq/ra#546.

(cherry picked from commit 4691a16)
michaelklishin added a commit to rabbitmq/rabbitmq-server that referenced this pull request Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants