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

fix: handle IPC unreadable socket #167

Merged
merged 2 commits into from
Jan 31, 2024
Merged

fix: handle IPC unreadable socket #167

merged 2 commits into from
Jan 31, 2024

Conversation

mattsse
Copy link
Member

@mattsse mattsse commented Jan 31, 2024

This handles the case when the ipc socket is no longer readable and poll read returns Ready(0), in which case we can terminate the stream.

This happens when the node is terminated.

Copy link
Contributor

@Evalir Evalir left a comment

Choose a reason for hiding this comment

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

🙏 this makes sense—we should just be able to drop the stream if we have no more data indicated by Ready(0).

@@ -196,6 +196,14 @@ where
Ok(data_len) => {
debug!(%data_len, "Read data from IPC socket");

if data_len == 0 {
Copy link
Member

Choose a reason for hiding this comment

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

mild preference to make this an Ok(0) match arm

Copy link
Member Author

Choose a reason for hiding this comment

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

done

// stream is no longer readable and we're also unable to decode any more
// data. This happens if the IPC socket is closed by the other end.
// so we can return `None` here.
debug!("IPC socket EOF, stream is closed");
Copy link
Member

Choose a reason for hiding this comment

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

would consider making these traces

Copy link
Member Author

Choose a reason for hiding this comment

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

can do eventually, but for now this is useful on debug

@mattsse mattsse merged commit 347fb50 into main Jan 31, 2024
14 checks passed
@mattsse mattsse deleted the matt/handle-ipc-eof branch January 31, 2024 16:13
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.

4 participants