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

fix: don't use threads for gRPC AuthMetadataPlugin, reverts #390 #467

Merged
merged 1 commit into from
Mar 25, 2020

Conversation

busunkim96
Copy link
Contributor

@busunkim96 busunkim96 commented Mar 24, 2020

Reverts part of #390.

grpc's documentation states AuthMetadataPlugin's __call__ should be non-blocking. https://grpc.github.io/grpc/python/grpc.html#grpc.AuthMetadataPlugin.__call__. However, @lidiz of gRPC Python confirms that a separate thread is already spun up for the plugin callback so it will not block the gRPC call (see comment below).

The current implementation of downstream clients results in threads being leaked.

Clients create gRPC channels but do not explicitly close them. See googleapis/google-cloud-python#9457 and googleapis/google-cloud-python#9790. This means associated resources do not get cleaned up.

See googleapis/google-cloud-python#9894 for an example of the changes that need to be made to downstream libraries. Also see google-api-core's create_channel method for resources created with a channel. Googlers, there is a detailed design doc here.

Issues:

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 24, 2020
Copy link
Contributor

@lidizheng lidizheng left a comment

Choose a reason for hiding this comment

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

LGTM since gRPC Python already spawning a thread for plugin callbacks: https://github.com/grpc/grpc/blob/master/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi#L16

@busunkim96 busunkim96 merged commit ee373f8 into master Mar 25, 2020
gcf-merge-on-green bot pushed a commit that referenced this pull request Mar 25, 2020
🤖 I have created a release \*beep\* \*boop\* 
---
## [1.12.0](https://www.github.com/googleapis/google-auth-library-python/compare/v1.11.3...v1.12.0) (2020-03-25)


### Features

* add mTLS ADC support for HTTP ([#457](https://www.github.com/googleapis/google-auth-library-python/issues/457)) ([bb9215a](https://www.github.com/googleapis/google-auth-library-python/commit/bb9215ad6dee6c1dc7f255a2e4ed7011b85bd6cf))
* add SslCredentials class for mTLS ADC ([#448](https://www.github.com/googleapis/google-auth-library-python/issues/448)) ([dafb41f](https://www.github.com/googleapis/google-auth-library-python/commit/dafb41fae3f513ea9a4f93404f6148bee7dda202))
* fetch id token from GCE metadata server ([#462](https://www.github.com/googleapis/google-auth-library-python/issues/462)) ([97e7700](https://www.github.com/googleapis/google-auth-library-python/commit/97e7700da031bfd80b63b1a3d2abc29c500936ef))


### Bug Fixes

* don't use threads for gRPC AuthMetadataPlugin ([#467](https://www.github.com/googleapis/google-auth-library-python/issues/467)) ([ee373f8](https://www.github.com/googleapis/google-auth-library-python/commit/ee373f88b512a38e791a1c085452c6c6da501eb6))
* make ThreadPoolExecutor a class var ([#461](https://www.github.com/googleapis/google-auth-library-python/issues/461)) ([b526473](https://www.github.com/googleapis/google-auth-library-python/commit/b5264730603947295cc97ecff2f6aef84aa3d6e9))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please).
@tseaver tseaver deleted the make-call-blocking branch October 28, 2020 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants