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

tests: handle ECONNREFUSED in uds_stream::epollhup #6778

Merged
merged 2 commits into from
Aug 16, 2024
Merged

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented Aug 15, 2024

Motivation

Currently, the test uds_stream::epollhup expects that a UdsStream::connect future to a Unix socket which is closed by the accept side to always fail with io::ErrorKind::ConnectionReset. On illumos, and potentially other systems, it instead fails with io::ErrorKind::ConnectionRefused.

This was discovered whilst adding an illumos CI job in PR #6769. See: #6769 (comment)

Solution

This commit changes the test to accept either ConenctionReset or ConnectionRefused. This way, we are more tolerant of different operating systems which may decide to return slightly different errnos here. Both ECONNREFUSED and ECONNRESET seem reasonable to expect in this situation, although arguably, ECONNREFUSED is actually more correct: the acceptor did not accept the connection at all, which seems like "refusing" it to me...

This commit was cherry-picked from PR #6769.

## Motivation

Currently, the test `uds_stream::epollhup` expects that a
`UdsStream::connect` future to a Unix socket which is closed by the
accept side to always fail with `io::ErrorKind::ConnectionReset`. On
illumos, and potentially other systems, it instead fails with
`io::ErrorKind::ConnectionRefused`.

This was discovered whilst adding an illumos CI job in PR #6769. See:
#6769 (comment)

## Solution

This commit changes the test to accept either `ConenctionReset` or
`ConnectionRefused`. This way, we are more tolerant of different
operating systems which may decide to return slightly different errnos
here. Both ECONNREFUSED and ECONNRESET seem reasonable to expect in this
situation, although arguably, ECONNREFUSED is actually more correct: the
acceptor did not accept the connection at all, which seems like
"refusing" it to me...

This commit was cherry-picked from PR #6769.
@hawkw hawkw requested a review from Darksonn August 15, 2024 16:03
@Darksonn Darksonn added A-tokio Area: The main tokio crate M-net Module: tokio/net labels Aug 16, 2024
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Thanks.

@Darksonn Darksonn merged commit 56f3f40 into master Aug 16, 2024
86 checks passed
@Darksonn Darksonn deleted the eliza/fix-epollhup branch August 16, 2024 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-net Module: tokio/net
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants