-
Notifications
You must be signed in to change notification settings - Fork 927
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
X11: Retry Interrupted event polls once #1952
Conversation
I don't know, if such a bugfix should be noted in the changelog or documentation. If the answer is yes, I'd be happy to amend this PR. |
Thanks for the PR! Yeah add a changelog entry, but this seems to be good otherwise. |
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.
Thanks again!
@francesca64, two web related tests that don't exist anymore are still being required to pass; this prevents PRs from getting merged. The stable test that replaced these is
If I'm not mistaken you can change this under Settings / Branches / Rules / "Require status checks to pass before merging" |
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.
LGTM
I cancelled the most recent workflow, because it will stall on the non-existing checks anyways. |
Hi, is there anything missing (except for the CI run)? Or should only the CI be re-started? |
The PR is all good. We are just waiting for Francesca to update the repo settings, and then we can re-start the ci checks. |
This comment has been minimized.
This comment has been minimized.
I've updated the branch rules! You should be good to go. |
You may want to rebase, @jfrimmel, as |
As the description of `std::io::ErrorKind::Interrupted` states: > Interrupted operations can typically be retried. If there is a poll, which fails for being interrupted, it may succeed on a retry. Therefore this commit retries such an interrupted operation once. The background is, that entering sleep mode will cause interrupted events, which leads to panics on wake-up. This commit handles that case gracefully.
I've rebased onto the current |
Looping until the polling succeeds might be a better choice. I recently had an issue with the polling code as it is in v0.25 (and the current master) where debugging a multi-threaded application causes the code to panic due to an interrupt. This happens because the debugger stops all threads when a breakpoint is hit, even outside of the thread the event loop is running in. This seems to reliably interrupts syscalls. I tried my MCVE from #1972 with your changed code that re-polls once in case of an interrupt and was still able to get a panic due to an unwrapped interrupt error. Admittedly it was a lot harder and probably would happen rarely if ever in the wild, but I'd say it is better to rule it out entirely. Something like the following should work (I checked that with my example and couldn't get it to panic due to an interrupt, which makes sense): if !self.event_processor.poll() {
while let Err(e) = self.poll.poll(&mut events, timeout) {
match e.kind() {
std::io::ErrorKind::Interrupted => (), // retry polling
_ => Err(e).expect("polling failed irrecoverably"),
}
}
events.clear();
} Using a looping approach like above would fix #1972 for good (at least for this instance of unwrapping |
@hcsch convinced me that it would indeed be better to poll until it returns with something else than "Interrupted". I would also add a debug log message so that if somehow an application gets stuck in an endless polling loop, the developer would know why that happens. Like so: if !self.event_processor.poll() {
while let Err(e) = self.poll.poll(&mut events, timeout) {
match e.kind() {
// retry polling
std::io::ErrorKind::Interrupted => debug!("Poll returned 'Interrupted'. Retrying."),
_ => Err(e).expect("polling failed irrecoverably"),
}
}
events.clear();
} |
As the description of
std::io::ErrorKind::Interrupted
states:If there is a poll, which fails for being interrupted, it may succeed on a retry. Therefore this commit retries such an interrupted operation once. The background is, that entering sleep mode will cause interrupted events, which leads to panics on wake-up. This commit handles that case gracefully.
Fixes #1947.
cargo fmt
has been run on this branchcargo doc
builds successfullyCHANGELOG.md
if knowledge of this change could be valuable to users