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

TypeError: catching classes that do not inherit from BaseException is not allowed #1016

Closed
SuryaSrikanthsml opened this issue Apr 12, 2022 · 4 comments
Labels
🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@SuryaSrikanthsml
Copy link

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • OS:
  • Python version: 3.7
  • pip version:
  • google-auth version: 2.6.3

Steps to reproduce

  1. python Google app Engine standard environment, have google-auth in requirements.txt.
  2. Occurs when an instance is terminated.

"Traceback (most recent call last):
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/google/auth/transport/requests.py", line 154, in del
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/requests/sessions.py", line 737, in close
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/requests/adapters.py", line 326, in close
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/urllib3/poolmanager.py", line 223, in clear
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/urllib3/_collections.py", line 100, in clear
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/urllib3/poolmanager.py", line 174, in
File "/layers/google.python.pip/pip/lib/python3.7/site-packages/urllib3/connectionpool.py", line 498, in close
TypeError: catching classes that do not inherit from BaseException is not allowed"

Unable to figure out if the error is in urllib3 or google-auth, was working fine with version 2.6.2

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Apr 12, 2022
@arithmetic1728
Copy link
Contributor

@lidizheng Could you take a look at it? It seems related to your #1007

@lidizheng
Copy link
Contributor

Based on the exception message, this looks like an issue in CPython (similar to https://bugs.python.org/issue40097).

Step 1: The urllib3 trying to catch an exception named queue.Empty:

https://github.com/urllib3/urllib3/blob/e16beb210c03c6f5ce4e0908bddb6556442b6a37/src/urllib3/connectionpool.py#L506

Step 2: The built-in queue trying to determine if a faster (C extension) version of queue is available, if not it will use normal exception, hence no error; if there is a C extension, it will use that _queue.Empty:

https://github.com/python/cpython/blob/ac6c3de03c5bb06a9a463701fb297148f5a5746f/Lib/queue.py#L16

Step 3: The C extension building the exception, but didn't provide a base class:

https://github.com/python/cpython/blob/ac6c3de03c5bb06a9a463701fb297148f5a5746f/Modules/_queuemodule.c#L409


As a workaround, we can silence this exception, make it non-fatal.

@lidizheng
Copy link
Contributor

Mitigation fix is posted at #1027, PTAL.

@arithmetic1728
Copy link
Contributor

Fix is released in 2.6.6. Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

4 participants