-
Notifications
You must be signed in to change notification settings - Fork 165
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
refactor(iroh): log inner errors #2423
Conversation
we currently abort the loop on outer errors (errors from spawn). But we do not look at inner errors (task returns properly but returns an error) at all. This logs the inner errors as debug! and coninues.
Don't exit the main loop just because an inner task is cancelled.
Some(Err(outer)) => { | ||
if outer.is_panic() { | ||
error!("Task panicked: {outer:?}"); | ||
break; | ||
} else if outer.is_cancelled() { | ||
debug!("Task cancelled: {outer:?}"); | ||
} else { | ||
error!("Task failed: {outer:?}"); | ||
break; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to print cancellations?
And IIUC, the third case is impossible. It's either a cancel or a panic: https://docs.rs/tokio/latest/src/tokio/runtime/task/error.rs.html#15-18
Some(Err(outer)) => { | |
if outer.is_panic() { | |
error!("Task panicked: {outer:?}"); | |
break; | |
} else if outer.is_cancelled() { | |
debug!("Task cancelled: {outer:?}"); | |
} else { | |
error!("Task failed: {outer:?}"); | |
break; | |
} | |
} | |
Some(Err(outer)) if outer.is_panic() => { | |
error!("Task panicked: {outer:?}"); | |
break; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to print cancellations? And IIUC, the third case is impossible. It's either a cancel or a panic: https://docs.rs/tokio/latest/src/tokio/runtime/task/error.rs.html#15-18
Yeah, I thought so as well, but then why don't they expose an enum? The way the JoinError API is written it seems that they want to keep the possibility open to have a third case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to print cancellations?
Not sure if they would ever happen at all. But if it happens, I would like to know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a minor nit, but I'd say this fixes something important and would also be fine as-is 👍
What do you think of renaming this PR |
Not sure. It does not change the behaviour of the program except for logging, so calling it a fix seems wrong. |
Description
we currently abort the loop on outer errors (errors from spawn). But we do not look at inner errors (task returns properly but returns an error) at all.
This logs the inner errors as debug! and coninues.
Also checks if the outer error is actually a panic, and continues the loop otherwise.
Breaking Changes
Notes & open questions
Change checklist