Skip to content

Conversation

@ReactorScram
Copy link
Contributor

@ReactorScram ReactorScram commented Jul 8, 2024

Closes #5760, refs #5790

Also removes some redundant IPC-related code that was nearby.

If you stop the IPC service, e.g. due to an update on Linux, it will say "IPC connection closed". This isn't ideal but at least the Client does catch it now, instead of failing on the next IPC send.

This unblocks some issues that need the IPC connection to be up
@ReactorScram ReactorScram changed the title ux(gui-client): catch IPC connection dropouts as fatal errors fix(gui-client): catch IPC connection dropouts as fatal errors Jul 8, 2024
@ReactorScram ReactorScram marked this pull request as ready for review July 8, 2024 21:37
@ReactorScram ReactorScram requested a review from conectado July 8, 2024 21:37
@ReactorScram ReactorScram changed the base branch from main to refactor/gui-simplify-resource-updating July 10, 2024 15:11
Copy link
Contributor

@conectado conectado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work fixing this, just left a few question/comments but nothing major

Comment on lines 527 to 535
Req::Ipc(result) => match result {
Some(Ok(msg)) => if let Err(error) = self.handle_ipc(msg).await {
tracing::error!(?error, "`handle_ipc` failed");
}
Some(Err(error)) => {
tracing::error!(?error, "IPC read failure");
Err(Error::IpcRead)?
}
None => Err(Error::IpcClosed)?,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's clearer if you match directly over the result and reduce the indentation level, like:

Req::Ipc(Some(Ok(msg)) => {...}
Req::Ipc(Some(Err(Error)) => {...}
...

ctlr_tx.send(ControllerRequest::Ipc(msg)).await?;
loop {
let result = rx.next().await;
ctlr_tx.send(ControllerRequest::Ipc(result)).await?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're depending on ctlr_tx being closed here some time after the channel in the line above is closed? But I would rather we use the while let(...) and explicitly inform ctlrx_tx about the channel closing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and so we don't have to deal with deeply nested types like ControllerRequest<Result<Option<IpcServerMessage>>>

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Base automatically changed from refactor/gui-simplify-resource-updating to main July 10, 2024 21:49
Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Copy link
Contributor

@conectado conectado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ReactorScram ReactorScram added this pull request to the merge queue Jul 10, 2024
Merged via the queue into main with commit 7e04d62 Jul 10, 2024
@ReactorScram ReactorScram deleted the chore/catch-ipc-rx-error branch July 10, 2024 22:54
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.

fix(gui-client): crash the GUI if the IPC connection fails

3 participants