Skip to content
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

Cache class: Fix crash on data race on Windows. #12579

Merged
merged 2 commits into from
Jul 6, 2024

Conversation

criemen
Copy link
Contributor

@criemen criemen commented Jul 5, 2024

On Windows, the error gets mapped to a different
errno when a race happens, see
https://github.com/python/cpython/blob/cecd6012b0ed5dca3916ae341e705ae44172991d/PC/errmap.h#L107. Therefore, we were observing crashes from that
code path, as the error wasn't being handled,
but bubbled up.

Fixes #12580.

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jul 5, 2024
On Windows, the error gets mapped to a different
errno when a race happens, see
https://github.com/python/cpython/blob/cecd6012b0ed5dca3916ae341e705ae44172991d/PC/errmap.h#L107.
Therefore, we were observing crashes from that
code path, as the error wasn't being handled,
but bubbled up.
Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Cornelius! Clean fix with a great comment (and writeup in the issue 🤩)

@Zac-HD Zac-HD merged commit 9de29bf into pytest-dev:main Jul 6, 2024
29 checks passed
@criemen criemen deleted the criemen/cache-windows branch July 6, 2024 22:25
Copy link

patchback bot commented Jul 10, 2024

Backport to 8.2.x: 💚 backport PR created

✅ Backport PR branch: patchback/backports/8.2.x/9de29bfe1b02e5b9924dac06ed24ecbaa7b192a5/pr-12579

Backported as #12595

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Jul 10, 2024
* Cache class: Fix crash on data race on Windows.

On Windows, the error gets mapped to a different
errno when a race happens, see
https://github.com/python/cpython/blob/cecd6012b0ed5dca3916ae341e705ae44172991d/PC/errmap.h#L107.
Therefore, we were observing crashes from that
code path, as the error wasn't being handled,
but bubbled up.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
(cherry picked from commit 9de29bf)
nicoddemus pushed a commit that referenced this pull request Jul 10, 2024
* Cache class: Fix crash on data race on Windows.

On Windows, the error gets mapped to a different
errno when a race happens, see
https://github.com/python/cpython/blob/cecd6012b0ed5dca3916ae341e705ae44172991d/PC/errmap.h#L107.
Therefore, we were observing crashes from that
code path, as the error wasn't being handled,
but bubbled up.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
(cherry picked from commit 9de29bf)

Co-authored-by: Cornelius Riemenschneider <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided (automation) changelog entry is part of PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cache: Crash on Windows when data race occurs
3 participants