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

call grpc_init for GoogleDefaultCredentials #2879

Merged
merged 2 commits into from
Aug 11, 2015

Conversation

yang-g
Copy link
Member

@yang-g yang-g commented Aug 10, 2015

The grpc_google_default_credentials_create call assumes grpc_init has been called, or it will crash if hit the gce detection part. Our C++ wrapper call grpc_init when a Credentials object is created and thus is too late.

I think default credentials is the only one with the problems as all others have trivial create() calls.

@yang-g
Copy link
Member Author

yang-g commented Aug 10, 2015

Fixes #2290

@@ -61,6 +62,7 @@ std::shared_ptr<Credentials> WrapCredentials(grpc_credentials* creds) {
} // namespace

std::shared_ptr<Credentials> GoogleDefaultCredentials() {
GrpcLibrary init; // To call grpc_init().
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we do that in grpc_google_default_credentials_create instead? What happens if we just use the C API?

Copy link
Member Author

Choose a reason for hiding this comment

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

From https://github.com/grpc/grpc/blob/master/include/grpc/grpc.h#L378, it seems we should do it in the C++ layer. Maybe even add it to all the XXCredentials() functions just to be safe?

Copy link
Contributor

Choose a reason for hiding this comment

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

oh I see. you're right because C callers have to already call grpc_init explicitly. Sorry about that.
Now I agree with you that every entry point in the Cpp layer where this is not called should be fixed.

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 for all secure credentials.

@jboeuf
Copy link
Contributor

jboeuf commented Aug 10, 2015

LGTM. Will merge when jenkins is greenish.

jboeuf added a commit that referenced this pull request Aug 11, 2015
call grpc_init for GoogleDefaultCredentials
@jboeuf jboeuf merged commit 2046954 into grpc:master Aug 11, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Jan 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants