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

time: panic in release when timer polled after completing #3681

Closed
wants to merge 2 commits into from

Conversation

davidpdrsn
Copy link
Member

While this debug_assert could only be triggered through UB
panicking in release mode and including a more helpful error message is
nice.

Fixes #3675

While this `debug_assert` could only be [triggered through UB][post]
panicking in release mode and including a more helpful error message is
nice.

Fixes #3675

[post]: https://fasterthanli.me/articles/pin-and-suffering
`compare_exchange_weak` is faster on some platforms but might fail
spuriously. That is fine here though since a failure will just mean
going through the loop one more time.

It was also used elsewhere in `StateCell`'s implementation.
@davidpdrsn davidpdrsn added A-tokio Area: The main tokio crate M-time Module: tokio/time labels Apr 6, 2021
@davidpdrsn davidpdrsn requested a review from Darksonn April 12, 2021 07:39
//
// In part also to improve the error message for things like
// https://github.com/tokio-rs/tokio/issues/3675
assert!(cur_state < STATE_MIN_VALUE, "timer polled after completing");
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the right error message here? Can it actually happen if it is polled after completion too, or does this require moving a pinned Sleep?

@Darksonn
Copy link
Contributor

Darksonn commented May 5, 2021

Ping

@Darksonn
Copy link
Contributor

Any updates on this?

@davidpdrsn
Copy link
Member Author

Ah damnit sorry. I totally forgot about this 😞 Sorry about this.

I'll just close this and let someone else fix it. That'll probably be quicker.

@davidpdrsn davidpdrsn closed this Sep 28, 2021
@davidpdrsn davidpdrsn deleted the david/poll-complete-sleep-future-error-msg branch September 28, 2021 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-time Module: tokio/time
Projects
None yet
Development

Successfully merging this pull request may close these issues.

time: polling sleep future after complete does not panic in release mode.
2 participants