-
Notifications
You must be signed in to change notification settings - Fork 32
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
Context deadline exceeded errors when calling API #302
Comments
Hi @abezzub You can perfectly pass in a context with a deadline to the chained API surface and the SDK should respect the new deadline. |
🤔 I verified our code does not set timeout on context before it is passed into SDK's functions. We call SDK functions in backend jobs, I see an example where timeout happened 37 seconds after the job started:
Based on the presence of Do you have any ideas on what I can try to debug this further? It does look like the timeout is not applied or handled correctly by the SDK. This is the code that is looping through the pages of the calendar view,
|
First, the sdk offers a page iterator which iterates across the pages for you so you don't have to implement it yourself. Then, is it possible that the code is running on a box which can have intermittent network latency? this seems like the connection time out is being reached here. |
Thanks, I will update the code to use the iterator and I will add retries around the API calls. When digging in the logs I found a similar looking error, but it says
Do you think this is a different issue? |
I'm not sure what's happening networking wise with this application. But it is possible that the http client cancels the requests when it's been waiting for the response for too long, so the server knows nobody is expecting an answer anymore and can free up resources. |
I switched the code to use page iterator and retry when timeout error happens, but now it is failing with It looks like page iterator does not return the original error, so I'll have to roll back the code to the previous version, where paging was done manually and it was possible to see the actual error that was happening. Is it possible to update the page iterator to include the original error? |
@rkodev do you think it'd be possible to include the inner error here? https://github.com/microsoftgraph/msgraph-sdk-go-core/blob/f0ae2b652111c67dbeb0c400a975353dfb39c934/page_iterator.go#L155 |
Regarding the original issue, I can confirm adding retries reduced the number of |
I am getting occasional
context deadline exceeded (Client.Timeout exceeded while awaiting headers)
when calling Graph API using the SDK. This happens on different resources (events, todo tasks, calendar view, etc). I am using default context without timeout set. Is it possible to configure the timeout used by the SDK?The text was updated successfully, but these errors were encountered: