Don't panic if we cannot obtain connection attemp result#2880
Merged
tillrohrmann merged 1 commit intorestatedev:mainfrom Mar 12, 2025
Merged
Don't panic if we cannot obtain connection attemp result#2880tillrohrmann merged 1 commit intorestatedev:mainfrom
tillrohrmann merged 1 commit intorestatedev:mainfrom
Conversation
259c8c7 to
a38901f
Compare
| } else { | ||
| match task_handle.now_or_never().expect("should be finished") { | ||
| Ok(result) => match result { | ||
| match occupied.remove().now_or_never() { |
Contributor
There was a problem hiding this comment.
you can also use unconstrained() but it's always safer to not panic anyway.
Contributor
Author
There was a problem hiding this comment.
Good point. I'll remember it for the future :-)
AhmedSoliman
approved these changes
Mar 11, 2025
Contributor
AhmedSoliman
left a comment
There was a problem hiding this comment.
LGTM assuming that the failing test is unrelated
Contributor
Author
I think that the test failure is unrelated but I haven't found an explanation yet. I've created #2885 for investigating it. So far I can only say that somehow the system doesn't see a Logs version update which should happen and therefore the system is stuck at waiting for the reconfiguration. |
a38901f to
d5f366e
Compare
For logging purposes we try to obtain the result of the connection attempt in a synchronous function if the connection attempt task has finished. Unfortunately, we cannot rely on TaskHandle::is_finished for task_handle.now_or_never() to always return Some(...). The problem is that the underlying Tokio JoinHandle participates in the cooperative task scheduling and if we ran out of budget, then it would return Poll::Pending. That's why we ignore the result in this case and continue. This fixes restatedev#2879.
d5f366e to
38772b4
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For logging purposes we try to obtain the result of the connection attempt in a synchronous function if the connection attempt task has finished. Unfortunately, we cannot rely on TaskHandle::is_finished for task_handle.now_or_never() to always return Some(...). The problem is that the underlying Tokio JoinHandle participates in the cooperative task scheduling and if we ran out of budget, then it would return Poll::Pending. That's why we ignore the result in this case and continue.
This fixes #2879.