8000 [3.8] bpo-39847: EnterNonRecursiveMutex() uses GetTickCount64() (GH-18780) by miss-islington · Pull Request #18945 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.8] bpo-39847: EnterNonRecursiveMutex() uses GetTickCount64() (GH-18780) #18945

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
Mar 11, 2020

Conversation

miss-islington
Copy link
Contributor
@miss-islington miss-islington commented Mar 11, 2020

The 32-bit (49-day) TickCount relied on in EnterNonRecursiveMutex can overflow
in the gap between the 'target' time and the 'now' time WaitForSingleObjectEx
returns, causing the loop to think it needs to wait another 49 days. This is
most likely to happen when the machine is hibernated during
WaitForSingleObjectEx.

This makes acquiring a lock/event/etc from the _thread or threading module
appear to never timeout.

Replace with GetTickCount64 - this is OK now Python no longer supports XP which
lacks it, and is in use for time.monotonic().

Co-authored-by: And Clover and.clover@bromium.com
(cherry picked from commit 64838ce)

Co-authored-by: bobince and+github@doxdesk.com

https://bugs.python.org/issue39847

…8780)

The 32-bit (49-day) TickCount relied on in EnterNonRecursiveMutex can overflow
in the gap between the 'target' time and the 'now' time WaitForSingleObjectEx
returns, causing the loop to think it needs to wait another 49 days. This is
most likely to happen when the machine is hibernated during
WaitForSingleObjectEx.

This makes acquiring a lock/event/etc from the _thread or threading module
appear to never timeout.

Replace with GetTickCount64 - this is OK now Python no longer supports XP which
lacks it, and is in use for time.monotonic().

Co-authored-by: And Clover <and.clover@bromium.com>
(cherry picked from commit 64838ce)

Co-authored-by: bobince <and+github@doxdesk.com>
Copy link
Member
@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM, good bot.

@miss-islington
Copy link
Contributor Author

@bobince and @vstinner: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 60b1b5a into python:3.8 Mar 11, 2020
@miss-islington miss-islington deleted the backport-64838ce-3.8 branch March 11, 2020 23:57
@miss-islington
Copy link
Contributor Author

@bobince and @vstinner: Status check is done, and it's a success ✅ .

1 similar comment
@miss-islington
Copy link
Contributor Author

@bobince and @vstinner: Status check is done, and it's a success ✅ .

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.

5 participants
0