Cosmos DB read operation timeout after second try with Error Code 500

Jerry Cui 0 Reputation points
2024-06-19T20:30:20.2633333+00:00

I am having issues with Cosmos DB where the first read operation succeeds and returns result from DB as expected, but all subsequent reads fail with Error Code 500. The error message mentions a session token not being available. How can I resolve this issue? Here is the error message:

Error retrieving item: {"innerErrorMessage":"Entity with the specified id does not exist in the system. More info: https://aka.ms/cosmosdb-tsg-not-found-java: The read session is not available for the input session token.","cosmosDiagnostics":{"userAgent":"azsdk-java-cosmos/4.61.1 MacOSX/14.5 JRE/17.0.11","activityId":"129377c7-931a-4d0f-bac1-0e70a36b11ad","requestLatencyInMs":15326,"requestStartTimeUTC":"2024-06-19T20:23:59.622612Z","requestEndTimeUTC":"2024-06-19T20:24:14.949391Z","responseStatisticsList":[{"storeResult":{"storePhysicalAddress":"rntbd://cdb-ms-prod-westus3-be3.documents.azure.com:14015/apps/c23b7c9a-d4d4-461a-8749-a7b8c6f7b51d/services/0ea9b31e-f267-40fc-8675-355ae45ada03/partitions/3983a5a6-dc4b-48f3-ba19-4f55c4d54958/replicas/133633020071932528s/","lsn":-1,"globalCommittedLsn":-1,"partitionKeyRangeId":null,"isValid":false,"statusCode":500,"subStatusCode":20910,"isGone":false,"isNotFound":false,"isInvalidPartition":false,"isThroughputControlRequestRateTooLarge":false,"requestCharge":0.0,"itemLSN":-1,"sessionToken":null,"backendLatencyInMs":null,"retryAfterInMs":null,"exceptionMessage":"Unexpected exception RntbdTransportClient({"id":2,"isClosed":true,"configuration":]

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,533 questions
{count} votes

1 answer

Sort by: Most helpful
  1. GeethaThatipatri-MSFT 29,012 Reputation points Microsoft Employee
    2024-06-20T20:01:15+00:00

    @Jerry Cui Welcome to Microsoft Q&A thanks for posting your question.

    Please share more information on what version of SDK and what API you are using. also review the Cosmos DB SDK documentation for best practices on handling retries and managing session tokens.

    Sometimes, transient issues can cause temporary unavailability of the session token. Retrying the operation after a short delay may resolve the issue, if you're using an older version of the Cosmos DB SDK, consider updating to the latest version as it may contain fixes for issues related to session management.

    https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/troubleshoot-java-sdk-request-timeout

    you can also explore more on the post here https://learn.microsoft.com/en-us/answers/questions/172514/the-read-session-is-not-available-for-the-input-se

    Regards

    Geetha

    0 comments No comments