Misleading error message in grpc_channel_create
#37859
Description
I was reading the grpc core codebase to debug an issue that surfaced as Failed to create secure client channel
and then as part of the debugging I spent quite a bit of time to understand why the codebase was trying to establish a secure
channel when it shouldn't. Then I read through the codebase for core and I saw this:
grpc_channel* grpc_channel_create(const char* target,
grpc_channel_credentials* creds,
const grpc_channel_args* c_args) {
Mentions in the docs that it creates a secure channel and the error message is:
channel = grpc_lame_client_channel_create(
target, status, "Failed to create secure client channel");
but one of the callers is InsecureChannelCredentialsImpl
which calls with "dummy" / static credentials in:
grpc_channel_credentials* creds = grpc_insecure_credentials_create();
std::shared_ptr<Channel> channel = grpc::CreateChannelInternal(
"", grpc_channel_create(target.c_str(), creds, &channel_args),
std::move(interceptor_creators));
if I am reading the codebase correctly then it seems like the error message is a bit confusing because the caller intent is to create an insecure
channel but the error message is around a secure
channel which reflects the implementation not the user intent