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

when too many request error happens, cosmos client returns empty result for pagination query #38984

Open
NagitoTerada opened this issue Dec 24, 2024 · 1 comment
Labels
Client This issue points to a problem in the data-plane of the library. Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@NagitoTerada
Copy link

  • Package Name: azure-cosmos
  • Package Version: 4.9.0
  • Operating System: linux
  • Python Version: 3.10

Describe the bug
A clear and concise description of what the bug is.
When a "Too Many Requests (429)" error occurs in Cosmos DB, executing query_items may sometimes return an empty list.

To Reproduce
Steps to reproduce the behavior:

  1. send any no QueryItems query with expected non empty result concurrently
  2. until hitting 429
  3. some of the query start returning empty result

For example:

from azure.cosmos import CosmosClient
from azure.cosmos.database import ContainerProxy


cosmos_client = CosmosClient(
    url=COSMOS_URL,
    credential=COSMOS_CREDENTIAL,
    connection_timeout=60,
    retry_total=3,
    retry_backoff_max=3
)
client = cosmos_client.get_database_client(COSMOS_DATABASE)
container = ContainerProxy(cosmos_client.client_connection, client.database_link, "container_name")

for i in range(100):
    result = list(container.query_items(
        query="SELECT * FROM c WHERE c.pk_name = @pk_name ",
        parameters=[{"name": "@pk_name", "value": "xxx"}],
    ))
    print(len(result), result)
    # Output
    # 2 [{'id': 'xxxxx-1', 'pk_name': 'xxx'}, {'id': 'xxxxx-2', 'pk_name': 'xxx'}]
    # 2 [{'id': 'xxxxx-1', 'pk_name': 'xxx'}, {'id': 'xxxxx-2', 'pk_name': 'xxx'}]
    # 2 [{'id': 'xxxxx-1', 'pk_name': 'xxx'}, {'id': 'xxxxx-2', 'pk_name': 'xxx'}]
    # 0 [] ## Returns an empty list.

Expected behavior
A clear and concise description of what you expected to happen.
the query should either fail or return correct result

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.
I believe this might be a similar issue to #35021.

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. labels Dec 24, 2024
Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @AbhinavTrips @bambriz @Pilchie @pjohari-ms @simorenoh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Cosmos customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team.
Projects
Status: No status
Development

No branches or pull requests

1 participant