Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

Timeout parameter doesn't work when retry is configured #71

Closed
geigerj opened this issue Jun 2, 2017 · 13 comments
Closed

Timeout parameter doesn't work when retry is configured #71

geigerj opened this issue Jun 2, 2017 · 13 comments
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@geigerj
Copy link
Contributor

geigerj commented Jun 2, 2017

Originally reported by @frankyn

What

Setting CallOptions timeout does nothing when the RPC is configured to retry.

To reproduce

video_service_client = Google::Cloud::VideoIntelligence::V1beta1::VideoIntelligenceServiceClient.new
features             = [Google::Cloud::Videointelligence::V1beta1::Feature::LABEL_DETECTION]                                                                                           
options = Google::Gax::CallOptions.new(timeout: 60)
path = "gs://cloudmleap/video/next/volleyball_court.mp4"
                                                                                                                  
operation = video_service_client.annotate_video(path, features, options: options) do |op|
  ...
end

Expected behavior

The call retries with an initial timeout of 60s.

Observed behavior

The call fails with "INVALID_ARGUMENT" due to an initial timeout of 19s; the configured timeout is ignored. It is possible to change the timeout only by manually configuring the full backoff settings.

@evaogbe
Copy link
Contributor

evaogbe commented Aug 10, 2017

I'm getting a different error:

GaxError Exception occurred in retry method that was not classified as transient, caused by
7:Google Cloud Video Intelligence API has not been used in project usable-auth-library before or it is
disabled. Enable it by visiting
https://console.developers.google.com/apis/api/videointelligence.googleapis.com/overview?project=usable-auth-library
then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our
systems and retry. (Google::Gax::RetryError)

@geigerj
Copy link
Contributor Author

geigerj commented Aug 10, 2017

@eoogbe Try using the project gapic-test, which should have the API enabled already.

@geigerj geigerj closed this as completed Aug 10, 2017
@geigerj geigerj reopened this Aug 10, 2017
@evaogbe
Copy link
Contributor

evaogbe commented Aug 10, 2017

It's maxxed on keys. I can't create a new one.

@evaogbe
Copy link
Contributor

evaogbe commented Aug 10, 2017

Thank you for your bug report. Based on its current description, we are unable to reproduce it. If you are still experiencing this issue and are reasonably certain that it is a bug, please feel free to re-open this issue with additional information to help us reproduce it.

@evaogbe evaogbe closed this as completed Aug 10, 2017
@geigerj
Copy link
Contributor Author

geigerj commented Aug 10, 2017

@eoogbe we've updated the timeout configuration since the original bug report; are you sure you're not just seeing that? I'd be surprised if the root cause was fixed in GAX because AFAIK no work has been done there. Happy to sync offline in more detail.

@geigerj geigerj reopened this Aug 10, 2017
@geigerj
Copy link
Contributor Author

geigerj commented Aug 10, 2017

I've confirmed the bug still exists with a print debug geigerj@248eab9, even though the configuration has changed for the specific video-intelligence case. I am fairly certain the retry settings are overriding the timeout parameter, even though the expect behavior is for the method parameters to override the configuration.

@eoogbe PTAL.

@evaogbe
Copy link
Contributor

evaogbe commented Aug 10, 2017

The docs say:

# @param timeout [Numeric] The client-side timeout for API calls. This
#   parameter is ignored for retrying calls.

I don't think the timeout parameter is supposed to affect retry. I was able to test setting the retry_options keyword, which does change the timeout for retry.

Closing as works as intended.

@evaogbe evaogbe closed this as completed Aug 10, 2017
@geigerj geigerj reopened this Aug 10, 2017
@geigerj
Copy link
Contributor Author

geigerj commented Aug 10, 2017

This is a pretty big usability issue as is -- I don't think we can reasonably expect anyone to pass a full retry configuration as a parameter to a retrying call just to change the initial timeout parameter, and this is not an advanced use case. Let's change the behavior so that the timeout param is not ignored for retrying calls, but instead overrides the initial_rpc_timeout (and the max_rpc_timeout/total_timeout if either of those values is less than the explicitly specified timeout param).

@geigerj
Copy link
Contributor Author

geigerj commented Aug 10, 2017

Also, FWIW, the type of the options parameter is CallOptions, not CallSettings, which does not have the documentation you quoted. I am less concerned about CallSettings, because we don't expect most users to interact with it directly.

@jiren
Copy link
Member

jiren commented Apr 30, 2018

This is an issue with retry_codes with empty array. If retry_codes is empty array and timeout param is passed using call option then it is executing retry instead of timeout

i.e here non_idempotent codes is empty so it should try with timeout options not using retryable.

def retry_codes?
@retry_options && @retry_options.retry_codes
end

api_call = if settings.retry_codes?

def retry_codes?
@retry_options && @retry_options.retry_codes
end

Need to check empty

def retry_codes?
   @retry_options && @retry_options.retry_codes && !@retry_options.retry_codes.empty?
end

@jbolinger jbolinger added P2+ priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed P2+ labels Jun 7, 2018
@JustinBeckwith JustinBeckwith added the 🚨 This issue needs some love. label Jun 8, 2018
@lukesneeringer
Copy link

This still seems to be in progress.
(Replying here to bring the issue back into compliance.)

@lukesneeringer lukesneeringer added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Oct 8, 2018
@JustinBeckwith JustinBeckwith added the 🚨 This issue needs some love. label Oct 8, 2018
@jbolinger jbolinger self-assigned this Dec 10, 2018
@alex-lange
Copy link

Hi, Has there been any updates to this issue re: retry_codes being an empty array? The comments specifically say that the RetryOptions#retry_codes is an Array, so I believe this is an actual bug that is treating an empty array like nil (!!nil is false but !![] is true).

I think something like this should fix it:

def retry_codes?
   @retry_options && @retry_options.retry_codes.any?
end

Not sure how this repository works -- I am happy to open a PR for this!

@jbolinger
Copy link
Contributor

Hi @alex-lange we'd be happy to review a PR if you'd like to take a shot a fixing this. Let us know if we can help.

blowmage added a commit that referenced this issue Apr 10, 2019
This fixes an issue where timeout wasn't being used.

[fixes #71]
@yoshi-automation yoshi-automation removed the 🚨 This issue needs some love. label Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

10 participants