authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2026-09-26 20:11:45-07:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2026-09-26 20:11:45-07:00
log36a308ce42b8dc8c33c733b587152ee533b4bbd4
treebb1f67a088d3a4ceac6817829e1448495abf1f7b
parent738fb7835f366dab6bc15ddbaecc0b334f2bb1f9

Threaded: Reduce the number of Windows rename ACCESS_DENIED retries to 3


1 files changed, 6 insertions(+), 2 deletions(-)

lib/std/Io/Threaded.zig+6-2
...@@ -1569,6 +1569,10 @@ const poll_buffer_len = 64;...@@ -1569,6 +1569,10 @@ const poll_buffer_len = 64;
1569pub const default_PATH = "/usr/local/bin:/bin:/usr/bin";1569pub const default_PATH = "/usr/local/bin:/bin:/usr/bin";
1570/// There are multiple kernel bugs being worked around with retries.1570/// There are multiple kernel bugs being worked around with retries.
1571const max_windows_kernel_bug_retries = 13;1571const max_windows_kernel_bug_retries = 13;
1572/// Similar in nature to `max_windows_kernel_bug_retries`, but much more likely to
1573/// be a real error that won't go away after a retry, so the number of retries
1574/// is lower.
1575const max_windows_rename_retries = 3;
15721576
1573comptime {1577comptime {
1574 if (@TypeOf(posix.IOV_MAX) != void) assert(max_iovecs_len <= posix.IOV_MAX);1578 if (@TypeOf(posix.IOV_MAX) != void) assert(max_iovecs_len <= posix.IOV_MAX);
...@@ -7738,7 +7742,7 @@ fn dirRenameWindowsInner(...@@ -7738,7 +7742,7 @@ fn dirRenameWindowsInner(
7738 },7742 },
7739 .ACCESS_DENIED => {7743 .ACCESS_DENIED => {
7740 syscall.finish();7744 syscall.finish();
7741 if (max_windows_kernel_bug_retries - attempt == 0) break :need_fallback false;7745 if (max_windows_rename_retries - attempt == 0) break :need_fallback false;
7742 try parking_sleep.sleep(.{ .duration = .{7746 try parking_sleep.sleep(.{ .duration = .{
7743 .raw = .fromMilliseconds((@as(u32, 1) << attempt) >> 1),7747 .raw = .fromMilliseconds((@as(u32, 1) << attempt) >> 1),
7744 .clock = .awake,7748 .clock = .awake,
...@@ -7775,7 +7779,7 @@ fn dirRenameWindowsInner(...@@ -7775,7 +7779,7 @@ fn dirRenameWindowsInner(
7775 .CANCELLED => try syscall.checkCancel(),7779 .CANCELLED => try syscall.checkCancel(),
7776 .ACCESS_DENIED => {7780 .ACCESS_DENIED => {
7777 syscall.finish();7781 syscall.finish();
7778 if (max_windows_kernel_bug_retries - attempt == 0) break;7782 if (max_windows_rename_retries - attempt == 0) break;
7779 try parking_sleep.sleep(.{ .duration = .{7783 try parking_sleep.sleep(.{ .duration = .{
7780 .raw = .fromMilliseconds((@as(u32, 1) << attempt) >> 1),7784 .raw = .fromMilliseconds((@as(u32, 1) << attempt) >> 1),
7781 .clock = .awake,7785 .clock = .awake,