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

[State CosmosDB] SaveBulkStateAsync() throws context deadline exceeded exception #3399

Closed
koumdev opened this issue Apr 11, 2024 · 3 comments
Labels
kind/enhancement New feature or request stale
Milestone

Comments

@koumdev
Copy link

koumdev commented Apr 11, 2024

Ask your question here

Hello,

I'm using Azure Cosmos DB state store and the SaveBulkStateAsync() to save bulk records, but an exception (context deadline exceeded) is thrown when the call takes more than 20 seconds(ish).

From cosmosdb.go code, it looks like there is a default timeout of 20 seconds.

All of the functions (Get, Set, Delete, ...) except BulkGet are using defaultTimeout to set the context timeout.

  • Is that the reason why my call fails?
  • Does that mean all the Azure Cosmos DB state store calls timeout after 20 seconds?
  • Is there any way to change this timeout?
  • It looks like all the bulk calls except BulkGet are actually processed as single requests, so how come I am running into this timeout?

I'm using Dapr version 1.13.0.

Thank you!

@berndverst
Copy link
Member

Yes that would be why. It would need to be implemented as a new feature to make the timeout configurable.

The DotNet SDK making a single SaveStateRequest with multiple state items. The Dapr runtime notices whether this contains 1 or multiple items. If one item it calls the regular SaveState method, but if multiple - it calls the Multi method which is for batches.

Saving that batch times out of course.

FYI, CosmosDB has a limit of 100 operations per transactional batch - so you will not be able to save more than 100 items in a single SaveState operation.

https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/transactional-batch?tabs=dotnet

If you are saving no more than 100 items, then the only way to fix it will be by exposing a new feature that lets you control the timeout.

However, if you are attempting to save more than 100 items, then this cannot work anyway.

Hope this help. I'll tag this as a feature request for Dapr 1.14 so the configuration option can be exposed.

@berndverst berndverst added this to the v1.14 milestone Apr 12, 2024
Copy link

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label May 12, 2024
Copy link

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. Thank you for your contributions.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests

2 participants