Skip to content

Test(lib/sync): Fix test_rwlock_max_readers for x86 Win7#154967

Open
PaulDance wants to merge 1 commit intorust-lang:mainfrom
PaulDance:patches/fix-x86-win7-rwlock-max-test
Open

Test(lib/sync): Fix test_rwlock_max_readers for x86 Win7#154967
PaulDance wants to merge 1 commit intorust-lang:mainfrom
PaulDance:patches/fix-x86-win7-rwlock-max-test

Conversation

@PaulDance
Copy link
Copy Markdown
Contributor

@PaulDance PaulDance commented Apr 7, 2026

The test recently added in #153555 currently systematically deadlocks when running it under i686 Windows 7, but not x86_64 that passes it fine. This therefore fixes the test for the target.

Empirically, the correct value for MAX_READERS seems to be 2^28 - 1: removing the - 1 re-introduces the deadlock, at least under our testing environment. This fix thus uses this value. However, I have no real justification to support that, because I find myself a bit at a loss when comparing the implementation details, the comment added above the test and what the current value is; some help would therefore be nice in this aspect. Also, the value change is restricted to 32-bit Win7 as there is no evidence to support it should be done for other targets.

cc @roblabla

@rustbot label O-windows-msvc O-windows-7 O-x86_32 A-atomic T-libs

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Apr 7, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 7, 2026

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 8 candidates
  • Random selection from Mark-Simulacrum, jhpratt

@rustbot rustbot added A-atomic Area: Atomics, barriers, and sync primitives O-windows-7 OS: Windows 7 or Windows Server 2008 R2 or etc. O-windows-msvc Toolchain: MSVC, Operating system: Windows O-x86_32 Target: x86 processors, 32 bit (like i686-*) (also known as IA-32, i386, i586, i686) labels Apr 7, 2026
@Mark-Simulacrum
Copy link
Copy Markdown
Member

I think unless we have evidence we should do something different, keeping the modification to just windows for now would make sense to me. I'm happy we're uncovering these differences though!

I'm not in practice too worried about the deadlock (though a panic feels probably better), especially on 32-bit Windows, on this high a value.

The recently-added test currently systematically deadlocks when running
it under i686 Windows 7, but not x86_64 that passes it fine. This
therefore fixes the test for the target.

Empirically, the correct value for `MAX_READERS` seems to be `2^28 - 1`:
removing the `- 1` re-introduces the deadlock, at least under our
testing environment. This fix thus uses this value. However, I have no
real justification to support that, because I find myself a bit at a
loss when comparing the implementation details, the comment added above
the test and what the current value is; some help would therefore be
nice in this aspect. Also, the value change is restricted to 32-bit Win7
as there is no evidence to support it should be done for other targets.

Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
@PaulDance PaulDance force-pushed the patches/fix-x86-win7-rwlock-max-test branch from ecebc8f to 962e9e2 Compare April 8, 2026 08:52
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 8, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@PaulDance
Copy link
Copy Markdown
Contributor Author

I think unless we have evidence we should do something different, keeping the modification to just windows for now would make sense to me.

Indeed, done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-atomic Area: Atomics, barriers, and sync primitives O-windows-7 OS: Windows 7 or Windows Server 2008 R2 or etc. O-windows-msvc Toolchain: MSVC, Operating system: Windows O-x86_32 Target: x86 processors, 32 bit (like i686-*) (also known as IA-32, i386, i586, i686) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants