GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: don't use threads for gRPC AuthMetadataPlugin, reverts #390 by busunkim96 · Pull Request #467 · googleapis/google-auth-library-python

This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Conversation

@busunkim96

@busunkim96 busunkim96 commented Mar 24, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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:

  • [GAE python 2.7] query().filter().fetch() sometimes spawns threads preventing webapp2 requests finish within a deadline python-ndb#336
  • Possible thread leak python-ndb#343

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chmoder reacted with hooray emoji
All reactions
  • 🎉 1 reaction
@busunkim96
fix: don't use threads for gRPC AuthMetadataPlugin
5eb6080
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Mar 24, 2020
lidizheng
lidizheng approved these changes Mar 24, 2020
View reviewed changes

@lidizheng lidizheng left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this 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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

busunkim96 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@lidizheng lidizheng mentioned this pull request Mar 24, 2020
Correct the docstring and implementation of AuthMetadataPlugin grpc/grpc#22471
Merged
@busunkim96 busunkim96 mentioned this pull request Mar 24, 2020
fix: call gc.collect() when exiting the NDB runtime context googleapis/python-ndb#373
Closed
@busunkim96
busunkim96 requested a review from arithmetic1728 March 25, 2020 17:14
arithmetic1728
arithmetic1728 approved these changes Mar 25, 2020
View reviewed changes
@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
@release-please
chore: release 1.12.0 (#463)
f79cf9a
🤖 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).
@chrisrossi chrisrossi mentioned this pull request Apr 9, 2020
[GAE python 2.7] query().filter().fetch() sometimes spawns threads preventing webapp2 requests finish within a deadline googleapis/python-ndb#336
Closed
@tseaver
tseaver deleted the make-call-blocking branch October 28, 2020 18:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@lidizheng lidizheng lidizheng approved these changes
@arithmetic1728 arithmetic1728 arithmetic1728 approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@busunkim96 @lidizheng @arithmetic1728 @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.