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

Detected blocking call to import_module with args ('homeassistant.components.google',) #142375

Closed
pleasantone opened this issue Apr 6, 2025 · 8 comments
Assignees

Comments

@pleasantone
Copy link
Contributor

pleasantone commented Apr 6, 2025

The problem

Logger: homeassistant.util.loop
Source: util/loop.py:77
First occurred: 5:26:03 PM (1 occurrences)
Last logged: 5:26:03 PM

Detected blocking call to import_module with args ('homeassistant.components.google',) in /usr/src/homeassistant/homeassistant/loader.py, line 1052: ComponentProtocol, importlib.import_module(self.pkg_path) inside the event loop; This is causing stability issues. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#import_module

What version of Home Assistant Core has the issue?

core-2025.04.01

What was the last working version of Home Assistant Core?

core-2025.03.04

What type of installation are you running?

Home Assistant OS

Integration causing the issue

homeassistant.components.google

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

Anything in the logs that might be useful for us?

Logger: homeassistant.setup
Source: setup.py:340
First occurred: 5:26:03 PM (1 occurrences)
Last logged: 5:26:03 PM

Setup failed for 'google': Unable to import component: Exception importing homeassistant.components.google
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1052, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 201, in protected_loop_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/src/homeassistant/homeassistant/components/google/__init__.py", line 35, in <module>
    from .api import ApiAuthImpl, get_feature_access
  File "/usr/src/homeassistant/homeassistant/components/google/api.py", line 11, in <module>
    from oauth2client.client import (
    ...<5 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/oauth2client/client.py", line 45, in <module>
    from oauth2client import crypt
  File "/usr/local/lib/python3.13/site-packages/oauth2client/crypt.py", line 23, in <module>
    from oauth2client import _pure_python_crypt
  File "/usr/local/lib/python3.13/site-packages/oauth2client/_pure_python_crypt.py", line 22, in <module>
    from pyasn1.codec.der import decoder
  File "/usr/local/lib/python3.13/site-packages/pyasn1/codec/der/decoder.py", line 7, in <module>
    from pyasn1.codec.cer import decoder
  File "/usr/local/lib/python3.13/site-packages/pyasn1/codec/cer/decoder.py", line 15, in <module>
    class BooleanDecoder(decoder.AbstractSimpleDecoder):
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pyasn1/codec/ber/decoder.py", line 2189, in __getattr__
AttributeError: AbstractSimpleDecoder. Did you mean: 'AbstractPayloadDecoder'?

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 992, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        self._get_component, True
        ^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1063, in _get_component
    raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing homeassistant.components.google

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1052, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 201, in protected_loop_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/src/homeassistant/homeassistant/components/google/__init__.py", line 35, in <module>
    from .api import ApiAuthImpl, get_feature_access
  File "/usr/src/homeassistant/homeassistant/components/google/api.py", line 11, in <module>
    from oauth2client.client import (
    ...<5 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/oauth2client/client.py", line 45, in <module>
    from oauth2client import crypt
  File "/usr/local/lib/python3.13/site-packages/oauth2client/crypt.py", line 23, in <module>
    from oauth2client import _pure_python_crypt
  File "/usr/local/lib/python3.13/site-packages/oauth2client/_pure_python_crypt.py", line 22, in <module>
    from pyasn1.codec.der import decoder
  File "/usr/local/lib/python3.13/site-packages/pyasn1/codec/der/decoder.py", line 7, in <module>
    from pyasn1.codec.cer import decoder
  File "/usr/local/lib/python3.13/site-packages/pyasn1/codec/cer/decoder.py", line 15, in <module>
    class BooleanDecoder(decoder.AbstractSimpleDecoder):
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pyasn1/codec/ber/decoder.py", line 2189, in __getattr__
AttributeError: AbstractSimpleDecoder. Did you mean: 'AbstractPayloadDecoder'?

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 340, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1012, in async_get_component
    self._component_future.result()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1004, in async_get_component
    comp = self._get_component()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1063, in _get_component
    raise ImportError(f"Exception importing {self.pkg_path}") from err
ImportError: Exception importing homeassistant.components.google

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Apr 6, 2025

Hey there @allenporter, mind taking a look at this issue as it has been labeled with an integration (google) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of google can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign google Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


google documentation
google source
(message by IssueLinks)

@mib1185
Copy link
Contributor

mib1185 commented Apr 6, 2025

@allenporter
Copy link
Contributor

Does this occur in safe mode? Wondering if a custom component is messing with python version pinning

@allenporter
Copy link
Contributor

Marking duplicate of #139405

@pleasantone
Copy link
Contributor Author

pleasantone commented Apr 6, 2025 via email

@pleasantone
Copy link
Contributor Author

pleasantone commented Apr 6, 2025 via email

@allenporter
Copy link
Contributor

The reason this is a duplicate is because of this error message from the stack trace with the root cause comes from the pyasn1 library that is used by Google's oauth library:

  File "/usr/src/homeassistant/homeassistant/components/google/__init__.py", line 35, in <module>
    from .api import ApiAuthImpl, get_feature_access
  File "/usr/src/homeassistant/homeassistant/components/google/api.py", line 11, in <module>
    from oauth2client.client import (
    ...<5 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/oauth2client/client.py", line 45, in <module>
    from oauth2client import crypt
  File "/usr/local/lib/python3.13/site-packages/oauth2client/crypt.py", line 23, in <module>
    from oauth2client import _pure_python_crypt
  File "/usr/local/lib/python3.13/site-packages/oauth2client/_pure_python_crypt.py", line 22, in <module>
    from pyasn1.codec.der import decoder
  File "/usr/local/lib/python3.13/site-packages/pyasn1/codec/der/decoder.py", line 7, in <module>
    from pyasn1.codec.cer import decoder
  File "/usr/local/lib/python3.13/site-packages/pyasn1/codec/cer/decoder.py", line 15, in <module>
    class BooleanDecoder(decoder.AbstractSimpleDecoder):
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/pyasn1/codec/ber/decoder.py", line 2189, in __getattr__
AttributeError: AbstractSimpleDecoder. Did you mean: 'AbstractPayloadDecoder'?

This library is used by both integrations.

@pleasantone
Copy link
Contributor Author

pleasantone commented Apr 6, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants