Skip to content

address concurrent issue with sleep future #1171

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
Dec 13, 2022

Conversation

demoray
Copy link
Contributor

@demoray demoray commented Dec 9, 2022

As is, the Sleep future relies on the future not getting polled until the waker files, which isn't guaranteed.

This changes the implementation to check if the thread is done. The waker still triggers the polling to occur.

fixes #1170

Copy link
Member

@cataggar cataggar left a comment

Choose a reason for hiding this comment

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

I'm not super familiar, but looks good to me. May be @rylev or @yoshuawuyts can review.

@johnbatty
Copy link
Contributor

Looks good to me too.

You can see that in the original code that the sleep timer is started on the first poll, and if a second poll is made before the timer has completed it always returned Poll::Ready, which is incorrect. The fix correctly handles any polls after the timer has been started by checking for timer completion before returning Poll::Ready.

@demoray demoray merged commit 739a7f2 into Azure:main Dec 13, 2022
@demoray demoray deleted the address-sleep-bug branch December 13, 2022 22:59
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.

Managed Identity Timing Out
3 participants