Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Immediate timeout on ListInsights calls #46

Closed
whoamnick opened this issue Oct 21, 2020 · 3 comments
Closed

Immediate timeout on ListInsights calls #46

whoamnick opened this issue Oct 21, 2020 · 3 comments
Assignees
Labels
api: recommender Issues related to the googleapis/python-recommender API. type: process A process-related concern. May include testing, release, or the like.

Comments

@whoamnick
Copy link

Environment details

  • OS type and version: macos 10.15.6
  • Python version: 3.6.8
  • pip version: 20.1
  • google-cloud-recommender version: 1.1.0

Steps to reproduce

  1. Call list_insights without a timeout param
  2. See the following error: google.api_core.exceptions.DeadlineExceeded: 504 Deadline Exceeded

Code example

from google.oauth2 import service_account
from google.cloud import recommender_v1
serviceaccount=service_account.Credentials.from_service_account_file(".....json")
client=recommender_v1.RecommenderClient(credentials=serviceaccount)
parent_1 = client.insight_type_path('${PROJECT_ID}','global','google.iam.serviceAccount.Insight')
for element in client.list_insights(parent_1):
    print(element)

Stack trace

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py", line 57, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/grpc/_channel.py", line 826, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/grpc/_channel.py", line 729, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.DEADLINE_EXCEEDED
        details = "Deadline Exceeded"
        debug_error_string = "{"created":"@1603293336.314798000","description":"Deadline Exceeded","file":"src/core/ext/filters/deadline/deadline_filter.cc","file_line":69,"grpc_status":4}"
>

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

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/api_core/retry.py", line 184, in retry_target
    return target()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/api_core/timeout.py", line 214, in func_with_timeout
    return func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/api_core/grpc_helpers.py", line 59, in error_remapped_callable
    six.raise_from(exceptions.from_grpc_error(exc), exc)
  File "<string>", line 3, in raise_from
google.api_core.exceptions.DeadlineExceeded: 504 Deadline Exceeded

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

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/nzar/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module>
    cli.main()
  File "/Users/nzar/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 430, in main
    run()
  File "/Users/nzar/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 267, in run_file
    runpy.run_path(options.target, run_name=compat.force_str("__main__"))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/nzar/Fun/repro/list-insights/main.py", line 6, in <module>
    for element in client.list_insights(parent_1):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/api_core/page_iterator.py", line 212, in _items_iter
    for page in self._page_iter(increment=False):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/api_core/page_iterator.py", line 243, in _page_iter
    page = self._next_page()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/api_core/page_iterator.py", line 534, in _next_page
    response = self._method(self._request)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/api_core/gapic_v1/method.py", line 145, in __call__
    return wrapped_func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/api_core/retry.py", line 286, in retry_wrapped_func
    on_error=on_error,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/api_core/retry.py", line 206, in retry_target
    last_exc,
  File "<string>", line 3, in raise_from
google.api_core.exceptions.RetryError: Deadline of 0.0s exceeded while calling functools.partial(<function _wrap_unary_errors.<locals>.error_remapped_callable at 0x7ff8d0bab0d0>, parent: "projects/${PROJECT_ID}/locations/global/insightTypes/google.iam.serviceAccount.Insight"
, metadata=[('x-goog-request-params', 'parent=projects/${PROJECT_ID}/locations/global/insightTypes/google.iam.serviceAccount.Insight'), ('x-goog-api-client', 'gl-python/3.6.8 grpc/1.32.0 gax/1.23.0 gapic/1.1.0')]), last exception: 504 Deadline Exceeded

Clearly at the end of the stacktrace "Deadline of 0.0s exceeded" seems to clearly point to an issue. And adding a timeout param to the list_insights call fixes the problem.

@product-auto-label product-auto-label bot added the api: recommender Issues related to the googleapis/python-recommender API. label Oct 21, 2020
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Oct 22, 2020
@munkhuushmgl munkhuushmgl self-assigned this Oct 26, 2020
@munkhuushmgl munkhuushmgl added type: process A process-related concern. May include testing, release, or the like. and removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Oct 26, 2020
@munkhuushmgl
Copy link

@NicholasAzar I will reach out the team to look at the PR.

@busunkim96
Copy link
Contributor

Should be fixed by config changes in #49

@munkhuushmgl
Copy link

Fixed by #49

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: recommender Issues related to the googleapis/python-recommender API. type: process A process-related concern. May include testing, release, or the like.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants