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

[network]Add ip address family info to error details upon socket connect failure #34286

Merged
merged 3 commits into from
Jun 4, 2024

Conversation

RenjieTang
Copy link
Contributor

Commit Message: Add ip address family info to error details upon socket connect failure
Additional Description: This helps reveal more info on why the socket connection fails immediately
Risk Level: low
Testing: n/a
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a

Signed-off-by: Renjie Tang <[email protected]>
@@ -1037,7 +1037,11 @@ void ClientConnectionImpl::connect() {
} else {
immediate_error_event_ = ConnectionEvent::RemoteClose;
connecting_ = false;
setFailureReason(absl::StrCat("immediate connect error: ", errorDetails(result.errno_)));
setFailureReason(absl::StrCat(
"immediate connect error: ", errorDetails(result.errno_), "remote address family:",
Copy link
Member

Choose a reason for hiding this comment

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

Probably want a space or some other delimiter at the start of "remote address family:" or it and the remote error will run together.

Copy link
Member

@zuercher zuercher left a comment

Choose a reason for hiding this comment

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

Can you give an example where this clarifies an error?

Signed-off-by: Renjie Tang <[email protected]>
@RenjieTang
Copy link
Contributor Author

Can you give an example where this clarifies an error?

Recently we've seen a lot of socket errors of NO_ROUTE_TO_HOST emitted here. It took us quite some time to hypothesize that the socket is trying ipv6 connection when the network doesn't support it. With the addr family logged here, it'd be very clear that this is a ipv4/v6 connectivity issue.

@zuercher
Copy link
Member

I recommend switching this to log the result of socket_->connectionInfoProvider().remoteAddress()->asString() like the other log messages in this file. Using socket_->connectionInfoProvider().remoteAddress()->ip() assumes all address instances are IP addresses, which is not true. That's why the tests are failing.

Signed-off-by: Renjie Tang <[email protected]>
@RenjieTang
Copy link
Contributor Author

I recommend switching this to log the result of socket_->connectionInfoProvider().remoteAddress()->asString() like the other log messages in this file. Using socket_->connectionInfoProvider().remoteAddress()->ip() assumes all address instances are IP addresses, which is not true. That's why the tests are failing.

Thanks for catching that. Done using string instead.

@adisuissa
Copy link
Contributor

Approved by @zuercher, merging.

@adisuissa adisuissa merged commit fd3930f into envoyproxy:main Jun 4, 2024
53 checks passed
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