"The read session is not available for the input session token" for Java 14 with spring boot application

Varun Thadaka 1 Reputation point
2020-11-23T15:04:29.523+00:00

Hi Team,

We are facing an issue when connecting to cosmos DB. When application starts, cosmos DB connection is good but after some time we are getting below error. We are using java 14 and maven artifact "Azure Cosmos DB Spring Boot Starter” for spring boot application to connect to cosmos DB.

With Java 13, we didn’t facing any issue, after upgrading to java 14 we are see this issue. Because of dependency with other system, we definitely have to be on java 14 version. Could you please help us in finding the fix.

2020-11-23 19:20:55
level="ERROR", ts="2020-11-23 13:50:55,183", source="com.azure.data.cosmos.internal.query.DocumentProducer:183", msg="Unexpected failurencom.azure.data.cosmos.NotFoundException: Entity with the specified id does not exist in the system.: The read session is not available for the input session token., nRequestStartTime: "23 Nov 2020 13:50:55.171", RequestEndTime: "23 Nov 2020 13:50:55.182", Duration: 10 ms, NUMBER of regions attempted: 1nStoreResponseStatistics{requestResponseTime="23 Nov 2020 13:50:55.173", storeResult=storePhysicalAddress: null, lsn: -1, globalCommittedLsn: -1, partitionKeyRangeId: null, isValid: false, statusCode: 500, subStatusCode: 0, isGone: false, isNotFound: false, isInvalidPartition: false, requestCharge: 0.0, itemLSN: -1, sessionToken: null, exception: Unknown server error occurred when processing this request., requestResourceType=Document, requestOperationType=Query}nStoreResponseStatistics{requestResponseTime="23 Nov 2020 13:50:55.174", storeResult=storePhysicalAddress: null, lsn: -1, globalCommittedLsn: -1, partitionKeyRangeId: null, isValid: false, statusCode: 500, subStatusCode: 0, isGone: false, isNotFound: false, isInvalidPartition: false, requestCharge: 0.0, itemLSN: -1, sessionToken: null, exception: Unknown server error occurred when processing this request., requestResourceType=Document, requestOperationType=Query}nStoreResponseStatistics{requestResponseTime="23 Nov 2020 13:50:55.175", storeResult=storePhysicalAddress: null, lsn: -1, globalCommittedLsn: -1, partitionKeyRangeId: null, isValid: false, statusCode: 500, subStatusCode: 0, isGone: false, isNotFound: false, isInvalidPartition: false, requestCharge: 0.0, itemLSN: -1, sessionToken: null, exception: Unknown server error occurred when processing this request., requestResourceType=Document, requestOperationType=Query}nStoreResponseStatistics{requestResponseTime="23 Nov 2020 13:50:55.176", storeResult=storePhysicalAddress: null, lsn: -1, globalCommittedLsn: -1, partitionKeyRangeId: null, isValid: false, statusCode: 500, subStatusCode: 0, isGone: false, isNotFound: false, isInvalidPartition: false, requestCharge: 0.0, itemLSN: -1, sessionToken: null, exception: Unknown server error occurred when processing this request., requestResourceType=Document, requestOperationType=Query}nStoreResponseStatistics{requestResponseTime="23 Nov 2020 13:50:55.179", storeResult=storePhysicalAddress: null, lsn: -1, globalCommittedLsn: -1, partitionKeyRangeId: null, isValid: false, statusCode: 500, subStatusCode: 0, isGone: false, isNotFound: false, isInvalidPartition: false, requestCharge: 0.0, itemLSN: -1, sessionToken: null, exception: Unknown server error occurred when processing this request., requestResourceType=Document, requestOperationType=Query}nStoreResponseStatistics{requestResponseTime="23 Nov 2020 13:50:55.180", storeResult=storePhysicalAddress: null, lsn: -1, globalCommittedLsn: -1, partitionKeyRangeId: null, isValid: false, statusCode: 500, subStatusCode: 0, isGone: false, isNotFound: false, isInvalidPartition: false, requestCharge: 0.0, itemLSN: -1, sessionToken: null, exception: Unknown server error occurred when processing this request., requestResourceType=Document, requestOperationType=Query}nStoreResponseStatistics{requestResponseTime="23 Nov 2020 13:50:55.181", storeResult=storePhysicalAddress: null, lsn: -1, globalCommittedLsn: -1, partitionKeyRangeId: null, isValid: false, statusCode: 500, subStatusCode: 0, isGone: false, isNotFound: false, isInvalidPartition: false, requestCharge: 0.0, itemLSN: -1, sessionToken: null, exception: Unknown server error occurred when processing this request., requestResourceType=Document, requestOperationType=Query}nStoreResponseStatistics{requestResponseTime="23 Nov 2020 13:50:55.182", storeResult=storePhysicalAddress: null, lsn: -1, globalCommittedLsn: -1, partitionKeyRangeId: null, isValid: false, statusCode: 500, subStatusCode: 0, isGone: false, isNotFound: false, isInvalidPartition: false, requestCharge: 0.0, itemLSN: -1, sessionToken: null, exception: Unknown server error occurred when processing this request., requestResourceType=Document, requestOperationType=Query}n at com.azure.data.cosmos.internal.directconnectivity.ConsistencyReader.lambda$readSessionAsync$2(ConsistencyReader.java:330) ~[azure-cosmos-3.7.3.jar!/:na]n at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:118) ~[reactor-core-3.3.4.RELEASE.jar!/:3.3.4.RELEASE]n at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1712) ~[reactor-core-3.3.4.RELEASE.jar!/:3.3.4.RELEASE]n at reactor.core.publisher.MonoSingle$SingleSubscriber.onComplete(MonoSingle.java:171) ~[reactor-core-3.3.4.RELEASE.jar!/:3.3.4.RELEASE]n at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onComplete(FluxPeekFuseable.java:270) ~[reactor-core-3.3.4.RELEASE.jar!/:3.3.4.RELEASE]n at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1713) ~[reactor-core-3.3.4.RELEASE.jar!/:3.3.4.RELEASE]n"

Thanks,
Varun

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,632 questions
Azure Spring Apps
Azure Spring Apps
An Azure platform as a service for running Spring Boot applications at cloud scale. Previously known as Azure Spring Cloud.
124 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Krish G 2,331 Reputation points
    2020-12-01T06:07:43.317+00:00

    The following may or may not fix the issue you have as it's difficult for me to reproduce without the details of your application. Since you mentioned you recently upgraded to Java 14, make sure you also update the related maven packages (for example Azure Cosmos DB Spring Boot Starter) to latest version and try. Also, looking at the error "Entity with the specified id does not exist in the system." inside the stacktrace you shared, I suspect it also can be in a business logic scenario where you are trying to read an entity which is not written yet and suggest you to also have a look at the Consistency levels

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.