Skip to content
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

address unbounded channel in signal client #70

Merged
merged 1 commit into from
Nov 20, 2023
Merged

address unbounded channel in signal client #70

merged 1 commit into from
Nov 20, 2023

Conversation

neonphog
Copy link
Collaborator

No description provided.

Copy link
Contributor

@ThetaSinner ThetaSinner left a comment

Choose a reason for hiding this comment

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

Looks good! A couple of questions about my favourite topic or error handling in non-production code but otherwise happy :)

@@ -903,11 +893,11 @@ async fn con_manage_connection(
let msg = msg.into_data();
match dbg_err!(wire::Wire::decode(&msg)) {
wire::Wire::DemoV1 { rem_pub } => {
recv_cb(SignalMsg::Demo { rem_pub });
let _ = msg_send.send(SignalMsg::Demo { rem_pub }).await;
Copy link
Contributor

Choose a reason for hiding this comment

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

The error is not expected to be important here?

@@ -982,13 +966,13 @@ async fn decode_fwd(

match msg {
wire::FwdInnerV1::Offer { offer, .. } => {
recv_cb(SignalMsg::Offer { rem_pub, offer });
let _ = msg_send.send(SignalMsg::Offer { rem_pub, offer }).await;
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question here, if these fail should the cli exit, report or swallow the error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ThetaSinner - This is one of those shutdown cases... i.e. the only time you'd get an error here is if the listener has been dropped, in which case I think it would just cause confusion if we were to report it into the tracing or something. BTW, this is actually production code, so not sure if that alters your impression of it, please let me know if you still think I should change something!

Copy link
Member

Choose a reason for hiding this comment

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

Shutdown is a very weak muscle for us. Our software tends to just fall into a cascade of errors when it's time to be done. We didn't add clean shutdown to Kitsune, and now it's hard to stop some networks while keeping others running. We still don't have a solution for that, because we don't have time to refactor it now.

Is it definitely the case that the signal server shutdown will always be all-or-nothing, where we never need to shut down some parts and leave others running? If so, maybe ignoring errors can be justified. I don't know enough about this program to make that call.

In my ideal world we would always handle shutdown properly, with a task manager that understands the proper shutdown order (task-motel can do this). In retrospect it would have been the right thing to do for Holochain/Kitsune. It allows a thing to grow beyond its initial design. Also I think there is some wisdom in understanding what it takes to properly dismantle something that was built (and actually embodying that in code instead of it just living in our heads), it tends to help us understand the building part better which might make the thing built better too.

Of course the relevance here is that if we had proper shutdown, then this error could be handled as an error and it wouldn't be confusing (even if in reality it never happened). Handling errors like this as actual errors proves that we have shutdown under control.

Not requiring a change if the signal server really is simple enough to warrant laissez-faire shutdown, just want to convey this principle and see if it sparks anything.

Copy link
Contributor

@ThetaSinner ThetaSinner left a comment

Choose a reason for hiding this comment

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

Looks good! A couple of questions about my favourite topic or error handling in non-production code but otherwise happy :)

@neonphog neonphog added this pull request to the merge queue Nov 16, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Nov 16, 2023
@neonphog neonphog added this pull request to the merge queue Nov 20, 2023
Merged via the queue into main with commit c7c61df Nov 20, 2023
5 of 6 checks passed
@neonphog neonphog deleted the async-sig-cli branch November 20, 2023 16:30
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.

None yet

3 participants