-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work around panic in tokio::time::sleep()
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.
- Loading branch information
Showing
2 changed files
with
45 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters