Fix crash when sockaddr cannot be converted to string (#29482)

grpc_sockaddr_to_uri() does not support binder transport URI scheme
(which uses an invalid sa_family (AF_MAX) to avoid misuse) at
this moment. Fallback to a string represent unknown address type here.
pull/29491/head
Ming-Chuan 3 years ago committed by GitHub
parent c462bb8d48
commit 65d005c6a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/core/ext/filters/client_channel/subchannel.cc

@ -676,7 +676,8 @@ Subchannel::Subchannel(SubchannelKey key,
{GRPC_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE_DEFAULT, 0,
INT_MAX}));
channelz_node_ = MakeRefCounted<channelz::SubchannelNode>(
grpc_sockaddr_to_uri(&key_.address()).value(),
grpc_sockaddr_to_uri(&key_.address())
.value_or("<unknown address type>"),
channel_tracer_max_memory);
channelz_node_->AddTraceEvent(
channelz::ChannelTrace::Severity::Info,

Loading…
Cancel
Save