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

Work around panic in tokio::time::sleep() #196

Merged
merged 1 commit into from
Feb 12, 2022
Merged

Conversation

ecton
Copy link
Member

@ecton ecton commented Feb 12, 2022

A user showed a stack trace of a crash that resulted from the key-value
background task attempting to sleep forever by passing a large Duration.
The example the user was running doesn't use expiration at all, so the
loop is meant to sleep forever.

I'm uncertain what is causing this to panic on their machine and not on
any of the test environments I've run on except that they're on Windows.
The tokio code as far as I can tell has no platform-specific code in
that area, so I'm baffled. I reported tokio-rs/tokio#4494.

In the meantime, I've changed the logic to support a "Never" sleep
target which avoids calling sleep() when there's no expiration target.
This makes the code a little more complicated (the reason I went with
the original approach), but it should fix the panic the user was seeing.

A user showed a stack trace of a crash that resulted from the key-value
background task attempting to sleep forever by passing a large Duration.
The example the user was running doesn't use expiration at all, so the
loop is meant to sleep forever.

I'm uncertain what is causing this to panic on their machine and not on
any of the test environments I've run on except that they're on Windows.
The tokio code as far as I can tell has no platform-specific code in
that area, so I'm baffled. I reported tokio-rs/tokio#4494.

In the meantime, I've changed the logic to support a "Never" sleep
target which avoids calling sleep() when there's no expiration target.
This makes the code a little more complicated (the reason I went with
the original approach), but it should fix the panic the user was seeing.
@ecton ecton force-pushed the key-value-sleep-fix branch from 27ac3aa to 874dbe8 Compare February 12, 2022 15:55
@ecton ecton merged commit 874dbe8 into main Feb 12, 2022
@ecton ecton deleted the key-value-sleep-fix branch February 12, 2022 16:29
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.

1 participant