google-cloud-python icon indicating copy to clipboard operation
google-cloud-python copied to clipboard

Infinite loop in Dialogflow logic raises 429 resource exhausted error

Open federicocagnola opened this issue 3 years ago • 1 comments

Environment details

  • OS type and version: Ubuntu 20.04
  • Python version: python --version 3.8.10
  • pip version: pip --version 20.0.2
  • google-cloud-dialogflow-cx version: pip show google-cloud-dialogflow-cx 1.10.0
  • google-api-core version 2.7.2

Steps to reproduce

  1. Create an event in dialogflow which triggers an infinite loop reaction.
  2. Trigger that event from the API

Stack trace

Traceback (most recent call last):
  File "/home/.local/lib/python3.8/site-packages/google/api_core/grpc_helpers.py", line 57, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/home/.local/lib/python3.8/site-packages/grpc/_channel.py", line 946, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/home/.local/lib/python3.8/site-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
	status = StatusCode.RESOURCE_EXHAUSTED
	details = "received trailing metadata size exceeds limit"
	debug_error_string = "{"created":"@1650556702.916644982","description":"Error received from peer ipv4:142.251.209.10:443","file":"src/core/lib/surface/call.cc","file_line":1069,"grpc_message":"received trailing metadata size exceeds limit","grpc_status":8}"
>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/home/connector.py", line 87, in dialogflow_detect_intent_event
    response = self.client.detect_intent(request=request)
  File "/home/.local/lib/python3.8/site-packages/google/cloud/dialogflowcx_v3/services/sessions/client.py", line 627, in detect_intent
    response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
  File "/home/.local/lib/python3.8/site-packages/google/api_core/gapic_v1/method.py", line 154, in __call__
    return wrapped_func(*args, **kwargs)
  File "/home/.local/lib/python3.8/site-packages/google/api_core/retry.py", line 283, in retry_wrapped_func
    return retry_target(
  File "/home/.local/lib/python3.8/site-packages/google/api_core/retry.py", line 190, in retry_target
    return target()
  File "/home/.local/lib/python3.8/site-packages/google/api_core/grpc_helpers.py", line 59, in error_remapped_callable
    raise exceptions.from_grpc_error(exc) from exc
google.api_core.exceptions.ResourceExhausted: 429 received trailing metadata size exceeds limit

Explanation

As per issue title, if I have an infinite loop in Dialogflow-CX's state machine and accidentally trigger it via the Python API bindings i receive this weird 429 HTTP status code with a mysterious message, probably due to the underlying API. Some months ago a similar situation occurred, and I received a very helpful error code telling me I had an infinite loop, so something has probably been changed: moreover, if I test the same thing from the console (dialogflow website) i receive said error, stating i exceeded the maximum recursive steps of the state machine. For some reason, the API returns this weird status code (429 is used for when one makes too many requests and exhausts the server) leading to a very long debugging process.

Thanks!

federicocagnola avatar Apr 21 '22 16:04 federicocagnola

I'm going to transfer this issue to the google-cloud-python repository as we are preparing to move the code for google-cloud-dialogflow-cx to that repository in the next 1-2 weeks.

parthea avatar Apr 17 '23 15:04 parthea