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: fix big time panic issue #6612

Merged
merged 4 commits into from
Jun 4, 2024

Conversation

wathenjiang
Copy link
Contributor

Motivation

The #5710 tried to fix the panic issue when the instance is very big.

However, the instant_to_tick can still calculate a u64 which is bigger than MAX_SAFE_MILLIS_DURATION.

Solution

Even if a u128 successfully try_into a u64, we still check whether it is bigger than MAX_SAFE_MILLIS_DURATION. If it is greater, we will return MAX_SAFE_MILLIS_DURATION.

@github-actions github-actions bot added the R-loom-time-driver Run loom time driver tests on this PR label Jun 4, 2024
@mox692 mox692 added A-tokio Area: The main tokio crate M-time Module: tokio/time labels Jun 4, 2024
@wathenjiang wathenjiang changed the title fix: big time panic issue time: fix big time panic issue Jun 4, 2024
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Thanks.

@Darksonn Darksonn merged commit 75c953b into tokio-rs:master Jun 4, 2024
82 checks passed
@wathenjiang wathenjiang deleted the fix-deadline_to_tick branch June 4, 2024 07:53
This was referenced Jul 22, 2024
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 R-loom-time-driver Run loom time driver tests on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants