azure-cosmos-db-emulator-docker icon indicating copy to clipboard operation
azure-cosmos-db-emulator-docker copied to clipboard

CosmosAccessException: Failed to get count value

Open kmandalas opened this issue 11 months ago • 7 comments

Spring Data queries like the following:

boolean existsByPrincipalAndType(String principal, String auditType);

fail with error:

com.azure.spring.data.cosmos.exception.CosmosAccessException: Failed to get count value

Integration test here: https://github.com/kmandalas/cosmosdb-vnext/blob/2791f59618583e719d2645064899b251ef738cc4/src/test/java/com/example/demo/audits/DemoAuditRepositoryIntegrationTest.java#L62

kmandalas avatar Dec 09 '24 22:12 kmandalas

We believe this is due to a query functionality that's still a WIP, but the error message is not clear. We should first address the error message being more clear so we can determine that.

christopheranderson avatar Dec 10 '24 19:12 christopheranderson

@christopheranderson Full stacktrace below:

2024-12-10T23:52:01.781+02:00 DEBUG 62483 --- [           main] c.a.c.implementation.SqlQuerySpecLogger  : SELECT VALUE COUNT(1) FROM r WHERE (r.principal = @principal0 AND r.type = @type1) 
2024-12-10T23:52:05.271+02:00 ERROR 62483 --- [ctor-http-nio-1] c.a.c.i.query.DocumentProducer           : Unexpected failure, Context: n/a

com.azure.cosmos.CosmosException: {"innerErrorMessage":"Exception while reading from stream, StatusCode: InternalServerError","cosmosDiagnostics":{"userAgent":"azsdk-java-cosmos/4.54.0 MacOSX/14.6.1 JRE/21.0.2 az-sd-cos/5.9.1az-sp-cos/5.9.1","activityId":"05d43ebc-4005-4ff3-9937-04fb9d416aec","requestLatencyInMs":3446,"requestStartTimeUTC":"2024-12-10T21:52:01.824416Z","requestEndTimeUTC":"2024-12-10T21:52:05.271090Z","responseStatisticsList":[],"supplementalResponseStatisticsList":[],"addressResolutionStatistics":{},"regionsContacted":["primary"],"retryContext":{"statusAndSubStatusCodes":null,"retryLatency":0,"retryCount":0},"metadataDiagnosticsContext":{"metadataDiagnosticList":null},"serializationDiagnosticsContext":{"serializationDiagnosticsList":null},"gatewayStatisticsList":[{"sessionToken":"0:-1#1","operationType":"Query","resourceType":"Document","statusCode":500,"subStatusCode":0,"requestCharge":0.0,"requestTimeline":[{"eventName":"connectionAcquired","startTimeUTC":"2024-12-10T21:52:01.825341Z","durationInMilliSecs":0.162},{"eventName":"connectionConfigured","startTimeUTC":"2024-12-10T21:52:01.825503Z","durationInMilliSecs":0.033},{"eventName":"requestSent","startTimeUTC":"2024-12-10T21:52:01.825536Z","durationInMilliSecs":0.362},{"eventName":"transitTime","startTimeUTC":"2024-12-10T21:52:01.825898Z","durationInMilliSecs":3444.377},{"eventName":"received","startTimeUTC":"2024-12-10T21:52:05.270275Z","durationInMilliSecs":0.425}],"partitionKeyRangeId":"0","responsePayloadSizeInBytes":0,"exceptionMessage":"Exception while reading from stream, StatusCode: InternalServerError","exceptionResponseHeaders":"{Transfer-Encoding=chunked, Server=PGSQL, x-ms-session-token=0:-1#1, x-ms-documentdb-partitionkeyrangeid=0, x-ms-interopandsdk-time-ms=3441, x-ms-gatewayversion=2.0.0, Date=Tue, 10 Dec 2024 21:52:04 GMT, x-ms-activity-id=05d43ebc-4005-4ff3-9937-04fb9d416aec, Content-Type=application/json}"}],"samplingRateSnapshot":1.0,"systemInformation":{"usedMemory":"120183 KB","availableMemory":"9317001 KB","systemCpuLoad":"empty","availableProcessors":11},"clientCfgs":{"id":1,"machineId":"uuid:08fac955-bee0-41c5-a07f-106cd2dedcac","connectionMode":"GATEWAY","numberOfClients":3,"excrgns":"[]","clientEndpoints":{"https://localhost:56872":3},"connCfg":{"rntbd":null,"gw":"(cps:1000, nrto:PT1M, icto:PT1M, p:false)","other":"(ed: false, cs: false, rv: true)"},"consistencyCfg":"(consistency: null, mm: true, prgns: [])","proactiveInitCfg":"","e2ePolicyCfg":"","sessionRetryCfg":""}}}
	at com.azure.cosmos.BridgeInternal.createCosmosException(BridgeInternal.java:478) ~[azure-cosmos-4.54.0.jar:4.54.0]
	at com.azure.cosmos.implementation.RxGatewayStoreModel.validateOrThrow(RxGatewayStoreModel.java:504) ~[azure-cosmos-4.54.0.jar:4.54.0]
	at com.azure.cosmos.implementation.RxGatewayStoreModel.lambda$toDocumentServiceResponse$1(RxGatewayStoreModel.java:365) ~[azure-cosmos-4.54.0.jar:4.54.0]
	at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:74) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:200) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onNext(FluxDoFinally.java:113) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:194) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty(Operators.java:2097) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.MonoCollectList$MonoCollectListSubscriber.onComplete(MonoCollectList.java:118) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:415) ~[reactor-netty-core-1.1.15.jar:1.1.15]
	at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:446) ~[reactor-netty-core-1.1.15.jar:1.1.15]
	at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:500) ~[reactor-netty-core-1.1.15.jar:1.1.15]
	at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:782) ~[reactor-netty-http-1.1.15.jar:1.1.15]
	at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:114) ~[reactor-netty-core-1.1.15.jar:1.1.15]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) ~[netty-handler-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) ~[netty-codec-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318) ~[netty-codec-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1475) ~[netty-handler-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible(SslHandler.java:1349) ~[netty-handler-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1389) ~[netty-handler-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529) ~[netty-codec-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468) ~[netty-codec-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290) ~[netty-codec-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.105.Final.jar:4.1.105.Final]
	at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]


com.azure.spring.data.cosmos.exception.CosmosAccessException: Failed to get count value

	at com.azure.spring.data.cosmos.exception.CosmosExceptionUtils.exceptionHandler(CosmosExceptionUtils.java:44)
	at com.azure.spring.data.cosmos.core.CosmosTemplate.lambda$getCountValue$36(CosmosTemplate.java:1135)
	at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94)
	at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.doError(FluxPublishOn.java:517)
	at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.checkTerminated(FluxPublishOn.java:555)
	at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.runAsync(FluxPublishOn.java:438)
	at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.run(FluxPublishOn.java:533)
	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84)
	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
	Suppressed: {"ClassName":"CosmosException","userAgent":"azsdk-java-cosmos/4.54.0 MacOSX/14.6.1 JRE/21.0.2","statusCode":500,"resourceAddress":"https://localhost:56872/dbs/vnext-demo-test/colls/audits/docs","error":"{\"code\":\"InternalServerError\",\"message\":\"Exception while reading from stream, StatusCode: InternalServerError\",\"additionalErrorInfo\":null}","innerErrorMessage":"Exception while reading from stream, StatusCode: InternalServerError","causeInfo":null,"responseHeaders":"{Transfer-Encoding=chunked, Server=PGSQL, x-ms-session-token=0:-1#1, x-ms-documentdb-partitionkeyrangeid=0, x-ms-interopandsdk-time-ms=3441, x-ms-gatewayversion=2.0.0, Date=Tue, 10 Dec 2024 21:52:04 GMT, x-ms-activity-id=05d43ebc-4005-4ff3-9937-04fb9d416aec, Content-Type=application/json}","requestHeaders":"[x-ms-cosmos-sdk-supportedcapabilities=1, x-ms-cosmos-intended-collection-rid=MDAwMQ==, Accept=application/json, x-ms-cosmos-correlated-activityid=92f471f5-4a51-4875-a8c1-b8e381324ff3, x-ms-date=Tue, 10 Dec 2024 21:52:01 GMT, x-ms-documentdb-partitionkeyrangeid=0, x-ms-documentdb-isquery=true, x-ms-max-item-count=100, x-ms-continuation=null, Content-Type=application/query+json]","cosmosDiagnostics":{"userAgent":"azsdk-java-cosmos/4.54.0 MacOSX/14.6.1 JRE/21.0.2 az-sd-cos/5.9.1az-sp-cos/5.9.1","activityId":"05d43ebc-4005-4ff3-9937-04fb9d416aec","requestLatencyInMs":3446,"requestStartTimeUTC":"2024-12-10T21:52:01.824416Z","requestEndTimeUTC":"2024-12-10T21:52:05.271090Z","responseStatisticsList":[],"supplementalResponseStatisticsList":[],"addressResolutionStatistics":{},"regionsContacted":["primary"],"retryContext":{"statusAndSubStatusCodes":null,"retryLatency":0,"retryCount":0},"metadataDiagnosticsContext":{"metadataDiagnosticList":null},"serializationDiagnosticsContext":{"serializationDiagnosticsList":null},"gatewayStatisticsList":[{"sessionToken":"0:-1#1","operationType":"Query","resourceType":"Document","statusCode":500,"subStatusCode":0,"requestCharge":0.0,"requestTimeline":[{"eventName":"connectionAcquired","startTimeUTC":"2024-12-10T21:52:01.825341Z","durationInMilliSecs":0.162},{"eventName":"connectionConfigured","startTimeUTC":"2024-12-10T21:52:01.825503Z","durationInMilliSecs":0.033},{"eventName":"requestSent","startTimeUTC":"2024-12-10T21:52:01.825536Z","durationInMilliSecs":0.362},{"eventName":"transitTime","startTimeUTC":"2024-12-10T21:52:01.825898Z","durationInMilliSecs":3444.377},{"eventName":"received","startTimeUTC":"2024-12-10T21:52:05.270275Z","durationInMilliSecs":0.425}],"partitionKeyRangeId":"0","responsePayloadSizeInBytes":0,"exceptionMessage":"Exception while reading from stream, StatusCode: InternalServerError","exceptionResponseHeaders":"{Transfer-Encoding=chunked, Server=PGSQL, x-ms-session-token=0:-1#1, x-ms-documentdb-partitionkeyrangeid=0, x-ms-interopandsdk-time-ms=3441, x-ms-gatewayversion=2.0.0, Date=Tue, 10 Dec 2024 21:52:04 GMT, x-ms-activity-id=05d43ebc-4005-4ff3-9937-04fb9d416aec, Content-Type=application/json}"}],"samplingRateSnapshot":1.0,"systemInformation":{"usedMemory":"121187 KB","availableMemory":"9315997 KB","systemCpuLoad":"empty","availableProcessors":11},"clientCfgs":{"id":1,"machineId":"uuid:08fac955-bee0-41c5-a07f-106cd2dedcac","connectionMode":"GATEWAY","numberOfClients":3,"excrgns":"[]","clientEndpoints":{"https://localhost:56872":3},"connCfg":{"rntbd":null,"gw":"(cps:1000, nrto:PT1M, icto:PT1M, p:false)","other":"(ed: false, cs: false, rv: true)"},"consistencyCfg":"(consistency: null, mm: true, prgns: [])","proactiveInitCfg":"","e2ePolicyCfg":"","sessionRetryCfg":""}}}
		at com.azure.cosmos.BridgeInternal.createCosmosException(BridgeInternal.java:478)
		at com.azure.cosmos.implementation.RxGatewayStoreModel.validateOrThrow(RxGatewayStoreModel.java:504)
		at com.azure.cosmos.implementation.RxGatewayStoreModel.lambda$toDocumentServiceResponse$1(RxGatewayStoreModel.java:365)
		at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106)
		at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:74)
		at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:200)
		at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122)
		at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onNext(FluxDoFinally.java:113)
		at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:194)
		at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107)
		at reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty(Operators.java:2097)
		at reactor.core.publisher.MonoCollectList$MonoCollectListSubscriber.onComplete(MonoCollectList.java:118)
		at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260)
		at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)
		at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:415)
		at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:446)
		at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:500)
		at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:782)
		at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:114)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
		at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
		at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
		at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
		at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
		at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
		at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1475)
		at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible(SslHandler.java:1349)
		at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1389)
		at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)
		at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)
		at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
		at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
		at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
		at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
		at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
		at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
		at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
		at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
		at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
		at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
		at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
		... 1 more
	Suppressed: java.lang.Exception: #block terminated with an error
		at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:103)
		at reactor.core.publisher.Mono.block(Mono.java:1728)
		at com.azure.spring.data.cosmos.core.CosmosTemplate.getCountValue(CosmosTemplate.java:1141)
		at com.azure.spring.data.cosmos.core.CosmosTemplate.getCountValue(CosmosTemplate.java:1121)
		at com.azure.spring.data.cosmos.core.CosmosTemplate.count(CosmosTemplate.java:1079)
		at com.azure.spring.data.cosmos.core.CosmosTemplate.exists(CosmosTemplate.java:849)
		at com.azure.spring.data.cosmos.repository.query.CosmosQueryExecution$ExistsExecution.execute(CosmosQueryExecution.java:138)
		at com.azure.spring.data.cosmos.repository.query.AbstractCosmosQuery.execute(AbstractCosmosQuery.java:50)
		at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:170)
		at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:158)
		at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:164)
		at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:143)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
		at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:70)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
		at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
		at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:220)
		at jdk.proxy2/jdk.proxy2.$Proxy102.existsByPrincipalAndType(Unknown Source)
		at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
		at java.base/java.lang.reflect.Method.invoke(Method.java:580)
		at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:351)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
		at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
		at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:220)
		at jdk.proxy2/jdk.proxy2.$Proxy102.existsByPrincipalAndType(Unknown Source)
		at com.example.demo.audits.DemoAuditRepositoryIntegrationTest.testFindWithExistsUsingCount(DemoAuditRepositoryIntegrationTest.java:65)
		at java.base/java.lang.reflect.Method.invoke(Method.java:580)
		at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
		at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: [CIRCULAR REFERENCE: {"ClassName":"CosmosException","userAgent":"azsdk-java-cosmos/4.54.0 MacOSX/14.6.1 JRE/21.0.2","statusCode":500,"resourceAddress":"https://localhost:56872/dbs/vnext-demo-test/colls/audits/docs","error":"{\"code\":\"InternalServerError\",\"message\":\"Exception while reading from stream, StatusCode: InternalServerError\",\"additionalErrorInfo\":null}","innerErrorMessage":"Exception while reading from stream, StatusCode: InternalServerError","causeInfo":null,"responseHeaders":"{Transfer-Encoding=chunked, Server=PGSQL, x-ms-session-token=0:-1#1, x-ms-documentdb-partitionkeyrangeid=0, x-ms-interopandsdk-time-ms=3441, x-ms-gatewayversion=2.0.0, Date=Tue, 10 Dec 2024 21:52:04 GMT, x-ms-activity-id=05d43ebc-4005-4ff3-9937-04fb9d416aec, Content-Type=application/json}","requestHeaders":"[x-ms-cosmos-sdk-supportedcapabilities=1, x-ms-cosmos-intended-collection-rid=MDAwMQ==, Accept=application/json, x-ms-cosmos-correlated-activityid=92f471f5-4a51-4875-a8c1-b8e381324ff3, x-ms-date=Tue, 10 Dec 2024 21:52:01 GMT, x-ms-documentdb-partitionkeyrangeid=0, x-ms-documentdb-isquery=true, x-ms-max-item-count=100, x-ms-continuation=null, Content-Type=application/query+json]","cosmosDiagnostics":{"userAgent":"azsdk-java-cosmos/4.54.0 MacOSX/14.6.1 JRE/21.0.2 az-sd-cos/5.9.1az-sp-cos/5.9.1","activityId":"05d43ebc-4005-4ff3-9937-04fb9d416aec","requestLatencyInMs":3446,"requestStartTimeUTC":"2024-12-10T21:52:01.824416Z","requestEndTimeUTC":"2024-12-10T21:52:05.271090Z","responseStatisticsList":[],"supplementalResponseStatisticsList":[],"addressResolutionStatistics":{},"regionsContacted":["primary"],"retryContext":{"statusAndSubStatusCodes":null,"retryLatency":0,"retryCount":0},"metadataDiagnosticsContext":{"metadataDiagnosticList":null},"serializationDiagnosticsContext":{"serializationDiagnosticsList":null},"gatewayStatisticsList":[{"sessionToken":"0:-1#1","operationType":"Query","resourceType":"Document","statusCode":500,"subStatusCode":0,"requestCharge":0.0,"requestTimeline":[{"eventName":"connectionAcquired","startTimeUTC":"2024-12-10T21:52:01.825341Z","durationInMilliSecs":0.162},{"eventName":"connectionConfigured","startTimeUTC":"2024-12-10T21:52:01.825503Z","durationInMilliSecs":0.033},{"eventName":"requestSent","startTimeUTC":"2024-12-10T21:52:01.825536Z","durationInMilliSecs":0.362},{"eventName":"transitTime","startTimeUTC":"2024-12-10T21:52:01.825898Z","durationInMilliSecs":3444.377},{"eventName":"received","startTimeUTC":"2024-12-10T21:52:05.270275Z","durationInMilliSecs":0.425}],"partitionKeyRangeId":"0","responsePayloadSizeInBytes":0,"exceptionMessage":"Exception while reading from stream, StatusCode: InternalServerError","exceptionResponseHeaders":"{Transfer-Encoding=chunked, Server=PGSQL, x-ms-session-token=0:-1#1, x-ms-documentdb-partitionkeyrangeid=0, x-ms-interopandsdk-time-ms=3441, x-ms-gatewayversion=2.0.0, Date=Tue, 10 Dec 2024 21:52:04 GMT, x-ms-activity-id=05d43ebc-4005-4ff3-9937-04fb9d416aec, Content-Type=application/json}"}],"samplingRateSnapshot":1.0,"systemInformation":{"usedMemory":"121187 KB","availableMemory":"9315997 KB","systemCpuLoad":"empty","availableProcessors":11},"clientCfgs":{"id":1,"machineId":"uuid:08fac955-bee0-41c5-a07f-106cd2dedcac","connectionMode":"GATEWAY","numberOfClients":3,"excrgns":"[]","clientEndpoints":{"https://localhost:56872":3},"connCfg":{"rntbd":null,"gw":"(cps:1000, nrto:PT1M, icto:PT1M, p:false)","other":"(ed: false, cs: false, rv: true)"},"consistencyCfg":"(consistency: null, mm: true, prgns: [])","proactiveInitCfg":"","e2ePolicyCfg":"","sessionRetryCfg":""}}}]

kmandalas avatar Dec 10 '24 21:12 kmandalas

@kmandalas can you please take latest version of the emulator and try again? This time exception should include more information for us to understand the issue

DmitriMelnikov avatar Dec 12 '24 20:12 DmitriMelnikov

@DmitriMelnikov I pulled latest image (btw I struggle to find the image at the Microsoft Artifact Registry) and I simply do a "Pull" from my Docker Desktop for Mac..., is there a release page somewhere?)

2024-12-13T11:23:22.133+02:00 DEBUG 73608 --- [           main] c.a.c.implementation.SqlQuerySpecLogger  : SELECT VALUE COUNT(1) FROM r WHERE (r.principal = @principal0 AND r.type = @type1) 
2024-12-13T11:23:22.258+02:00 ERROR 73608 --- [ctor-http-nio-1] c.a.c.i.query.DocumentProducer           : Unexpected failure, Context: n/a

com.azure.cosmos.CosmosException: {"innerErrorMessage":"Aggref found in non-Agg plan node, StatusCode: InternalServerError","cosmosDiagnostics":{"userAgent":"azsdk-java-cosmos/4.54.0 MacOSX/14.6.1 JRE/21.0.2 az-sd-cos/5.9.1az-sp-cos/5.9.1","activityId":"06902d04-1956-4a2c-910c-f8b42149bacd","requestLatencyInMs":86,"requestStartTimeUTC":"2024-12-13T09:23:22.172050Z","requestEndTimeUTC":"2024-12-13T09:23:22.258511Z","responseStatisticsList":[],"supplementalResponseStatisticsList":[],"addressResolutionStatistics":{},"regionsContacted":["primary"],"retryContext":{"statusAndSubStatusCodes":null,"retryLatency":0,"retryCount":0},"metadataDiagnosticsContext":{"metadataDiagnosticList":null},"serializationDiagnosticsContext":{"serializationDiagnosticsList":null},"gatewayStatisticsList":[{"sessionToken":"0:-1#1","operationType":"Query","resourceType":"Document","statusCode":500,"subStatusCode":0,"requestCharge":0.0,"requestTimeline":[{"eventName":"connectionAcquired","startTimeUTC":"2024-12-13T09:23:22.173061Z","durationInMilliSecs":0.188},{"eventName":"connectionConfigured","startTimeUTC":"2024-12-13T09:23:22.173249Z","durationInMilliSecs":0.035},{"eventName":"requestSent","startTimeUTC":"2024-12-13T09:23:22.173284Z","durationInMilliSecs":0.431},{"eventName":"transitTime","startTimeUTC":"2024-12-13T09:23:22.173715Z","durationInMilliSecs":84.405},{"eventName":"received","startTimeUTC":"2024-12-13T09:23:22.258120Z","durationInMilliSecs":0.19}],"partitionKeyRangeId":"0","responsePayloadSizeInBytes":0,"exceptionMessage":"Aggref found in non-Agg plan node, StatusCode: InternalServerError","exceptionResponseHeaders":"{Transfer-Encoding=chunked, Server=PGSQL, x-ms-session-token=0:-1#1, x-ms-documentdb-partitionkeyrangeid=0, x-ms-interopandsdk-time-ms=82, x-ms-gatewayversion=2.0.0, Date=Fri, 13 Dec 2024 09:23:21 GMT, x-ms-activity-id=06902d04-1956-4a2c-910c-f8b42149bacd, Content-Type=application/json}"}],"samplingRateSnapshot":1.0,"systemInformation":{"usedMemory":"118902 KB","availableMemory":"9318282 KB","systemCpuLoad":"empty","availableProcessors":11},"clientCfgs":{"id":1,"machineId":"uuid:606c2ac1-e3bd-4510-afad-30f3b3972b9b","connectionMode":"GATEWAY","numberOfClients":3,"excrgns":"[]","clientEndpoints":{"https://localhost:57604":3},"connCfg":{"rntbd":null,"gw":"(cps:1000, nrto:PT1M, icto:PT1M, p:false)","other":"(ed: false, cs: false, rv: true)"},"consistencyCfg":"(consistency: null, mm: true, prgns: [])","proactiveInitCfg":"","e2ePolicyCfg":"","sessionRetryCfg":""}}}
	at com.azure.cosmos.BridgeInternal.createCosmosException(BridgeInternal.java:478) ~[azure-cosmos-4.54.0.jar:4.54.0]
	at com.azure.cosmos.implementation.RxGatewayStoreModel.validateOrThrow(RxGatewayStoreModel.java:504) ~[azure-cosmos-4.54.0.jar:4.54.0]
	at com.azure.cosmos.implementation.RxGatewayStoreModel.lambda$toDocumentServiceResponse$1(RxGatewayStoreModel.java:365) ~[azure-cosmos-4.54.0.jar:4.54.0]
	at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:74) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:200) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onNext(FluxDoFinally.java:113) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:194) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty(Operators.java:2097) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.MonoCollectList$MonoCollectListSubscriber.onComplete(MonoCollectList.java:118) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:415) ~[reactor-netty-core-1.1.15.jar:1.1.15]
	at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:446) ~[reactor-netty-core-1.1.15.jar:1.1.15]
	at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:500) ~[reactor-netty-core-1.1.15.jar:1.1.15]
	at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:782) ~[reactor-netty-http-1.1.15.jar:1.1.15]
	at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:114) ~[reactor-netty-core-1.1.15.jar:1.1.15]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) ~[netty-handler-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) ~[netty-codec-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318) ~[netty-codec-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1475) ~[netty-handler-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible(SslHandler.java:1349) ~[netty-handler-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1389) ~[netty-handler-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529) ~[netty-codec-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468) ~[netty-codec-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290) ~[netty-codec-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.105.Final.jar:4.1.105.Final]
	at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]


com.azure.spring.data.cosmos.exception.CosmosAccessException: Failed to get count value

	at com.azure.spring.data.cosmos.exception.CosmosExceptionUtils.exceptionHandler(CosmosExceptionUtils.java:44)
	at com.azure.spring.data.cosmos.core.CosmosTemplate.lambda$getCountValue$36(CosmosTemplate.java:1135)
	at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94)
	at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.doError(FluxPublishOn.java:517)
	at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.checkTerminated(FluxPublishOn.java:555)
	at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.runAsync(FluxPublishOn.java:438)
	at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.run(FluxPublishOn.java:533)
	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84)
	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
	Suppressed: {"ClassName":"CosmosException","userAgent":"azsdk-java-cosmos/4.54.0 MacOSX/14.6.1 JRE/21.0.2","statusCode":500,"resourceAddress":"https://localhost:57604/dbs/vnext-demo-test/colls/audits/docs","error":"{\"code\":\"InternalServerError\",\"message\":\"Aggref found in non-Agg plan node, StatusCode: InternalServerError\",\"additionalErrorInfo\":null}","innerErrorMessage":"Aggref found in non-Agg plan node, StatusCode: InternalServerError","causeInfo":null,"responseHeaders":"{Transfer-Encoding=chunked, Server=PGSQL, x-ms-session-token=0:-1#1, x-ms-documentdb-partitionkeyrangeid=0, x-ms-interopandsdk-time-ms=82, x-ms-gatewayversion=2.0.0, Date=Fri, 13 Dec 2024 09:23:21 GMT, x-ms-activity-id=06902d04-1956-4a2c-910c-f8b42149bacd, Content-Type=application/json}","requestHeaders":"[x-ms-cosmos-sdk-supportedcapabilities=1, x-ms-cosmos-intended-collection-rid=MDAwMQ==, Accept=application/json, x-ms-cosmos-correlated-activityid=f2e4bb90-3368-4f74-8a3e-ead0c3bb91b7, x-ms-date=Fri, 13 Dec 2024 09:23:22 GMT, x-ms-documentdb-partitionkeyrangeid=0, x-ms-documentdb-isquery=true, x-ms-max-item-count=100, x-ms-continuation=null, Content-Type=application/query+json]","cosmosDiagnostics":{"userAgent":"azsdk-java-cosmos/4.54.0 MacOSX/14.6.1 JRE/21.0.2 az-sd-cos/5.9.1az-sp-cos/5.9.1","activityId":"06902d04-1956-4a2c-910c-f8b42149bacd","requestLatencyInMs":86,"requestStartTimeUTC":"2024-12-13T09:23:22.172050Z","requestEndTimeUTC":"2024-12-13T09:23:22.258511Z","responseStatisticsList":[],"supplementalResponseStatisticsList":[],"addressResolutionStatistics":{},"regionsContacted":["primary"],"retryContext":{"statusAndSubStatusCodes":null,"retryLatency":0,"retryCount":0},"metadataDiagnosticsContext":{"metadataDiagnosticList":null},"serializationDiagnosticsContext":{"serializationDiagnosticsList":null},"gatewayStatisticsList":[{"sessionToken":"0:-1#1","operationType":"Query","resourceType":"Document","statusCode":500,"subStatusCode":0,"requestCharge":0.0,"requestTimeline":[{"eventName":"connectionAcquired","startTimeUTC":"2024-12-13T09:23:22.173061Z","durationInMilliSecs":0.188},{"eventName":"connectionConfigured","startTimeUTC":"2024-12-13T09:23:22.173249Z","durationInMilliSecs":0.035},{"eventName":"requestSent","startTimeUTC":"2024-12-13T09:23:22.173284Z","durationInMilliSecs":0.431},{"eventName":"transitTime","startTimeUTC":"2024-12-13T09:23:22.173715Z","durationInMilliSecs":84.405},{"eventName":"received","startTimeUTC":"2024-12-13T09:23:22.258120Z","durationInMilliSecs":0.19}],"partitionKeyRangeId":"0","responsePayloadSizeInBytes":0,"exceptionMessage":"Aggref found in non-Agg plan node, StatusCode: InternalServerError","exceptionResponseHeaders":"{Transfer-Encoding=chunked, Server=PGSQL, x-ms-session-token=0:-1#1, x-ms-documentdb-partitionkeyrangeid=0, x-ms-interopandsdk-time-ms=82, x-ms-gatewayversion=2.0.0, Date=Fri, 13 Dec 2024 09:23:21 GMT, x-ms-activity-id=06902d04-1956-4a2c-910c-f8b42149bacd, Content-Type=application/json}"}],"samplingRateSnapshot":1.0,"systemInformation":{"usedMemory":"119794 KB","availableMemory":"9317390 KB","systemCpuLoad":"empty","availableProcessors":11},"clientCfgs":{"id":1,"machineId":"uuid:606c2ac1-e3bd-4510-afad-30f3b3972b9b","connectionMode":"GATEWAY","numberOfClients":3,"excrgns":"[]","clientEndpoints":{"https://localhost:57604":3},"connCfg":{"rntbd":null,"gw":"(cps:1000, nrto:PT1M, icto:PT1M, p:false)","other":"(ed: false, cs: false, rv: true)"},"consistencyCfg":"(consistency: null, mm: true, prgns: [])","proactiveInitCfg":"","e2ePolicyCfg":"","sessionRetryCfg":""}}}
		at com.azure.cosmos.BridgeInternal.createCosmosException(BridgeInternal.java:478)
		at com.azure.cosmos.implementation.RxGatewayStoreModel.validateOrThrow(RxGatewayStoreModel.java:504)
		at com.azure.cosmos.implementation.RxGatewayStoreModel.lambda$toDocumentServiceResponse$1(RxGatewayStoreModel.java:365)
		at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106)
		at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:74)
		at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:200)
		at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122)
		at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onNext(FluxDoFinally.java:113)
		at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:194)
		at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107)
		at reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty(Operators.java:2097)
		at reactor.core.publisher.MonoCollectList$MonoCollectListSubscriber.onComplete(MonoCollectList.java:118)
		at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260)
		at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)
		at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:415)
		at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:446)
		at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:500)
		at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:782)
		at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:114)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
		at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
		at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
		at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
		at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
		at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
		at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1475)
		at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible(SslHandler.java:1349)
		at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1389)
		at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)
		at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)
		at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
		at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
		at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
		at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
		at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
		at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
		at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
		at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
		at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
		at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
		at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
		... 1 more
	Suppressed: java.lang.Exception: #block terminated with an error
		at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:103)
		at reactor.core.publisher.Mono.block(Mono.java:1728)
		at com.azure.spring.data.cosmos.core.CosmosTemplate.getCountValue(CosmosTemplate.java:1141)
		at com.azure.spring.data.cosmos.core.CosmosTemplate.getCountValue(CosmosTemplate.java:1121)
		at com.azure.spring.data.cosmos.core.CosmosTemplate.count(CosmosTemplate.java:1079)
		at com.azure.spring.data.cosmos.core.CosmosTemplate.exists(CosmosTemplate.java:849)
		at com.azure.spring.data.cosmos.repository.query.CosmosQueryExecution$ExistsExecution.execute(CosmosQueryExecution.java:138)
		at com.azure.spring.data.cosmos.repository.query.AbstractCosmosQuery.execute(AbstractCosmosQuery.java:50)
		at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:170)
		at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:158)
		at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:164)
		at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:143)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
		at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:70)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
		at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
		at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:220)
		at jdk.proxy2/jdk.proxy2.$Proxy102.existsByPrincipalAndType(Unknown Source)
		at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
		at java.base/java.lang.reflect.Method.invoke(Method.java:580)
		at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:351)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
		at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
		at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:220)
		at jdk.proxy2/jdk.proxy2.$Proxy102.existsByPrincipalAndType(Unknown Source)
		at com.example.demo.audits.DemoAuditRepositoryIntegrationTest.testFindWithExistsUsingCount(DemoAuditRepositoryIntegrationTest.java:64)
		at java.base/java.lang.reflect.Method.invoke(Method.java:580)
		at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
		at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: [CIRCULAR REFERENCE: {"ClassName":"CosmosException","userAgent":"azsdk-java-cosmos/4.54.0 MacOSX/14.6.1 JRE/21.0.2","statusCode":500,"resourceAddress":"https://localhost:57604/dbs/vnext-demo-test/colls/audits/docs","error":"{\"code\":\"InternalServerError\",\"message\":\"Aggref found in non-Agg plan node, StatusCode: InternalServerError\",\"additionalErrorInfo\":null}","innerErrorMessage":"Aggref found in non-Agg plan node, StatusCode: InternalServerError","causeInfo":null,"responseHeaders":"{Transfer-Encoding=chunked, Server=PGSQL, x-ms-session-token=0:-1#1, x-ms-documentdb-partitionkeyrangeid=0, x-ms-interopandsdk-time-ms=82, x-ms-gatewayversion=2.0.0, Date=Fri, 13 Dec 2024 09:23:21 GMT, x-ms-activity-id=06902d04-1956-4a2c-910c-f8b42149bacd, Content-Type=application/json}","requestHeaders":"[x-ms-cosmos-sdk-supportedcapabilities=1, x-ms-cosmos-intended-collection-rid=MDAwMQ==, Accept=application/json, x-ms-cosmos-correlated-activityid=f2e4bb90-3368-4f74-8a3e-ead0c3bb91b7, x-ms-date=Fri, 13 Dec 2024 09:23:22 GMT, x-ms-documentdb-partitionkeyrangeid=0, x-ms-documentdb-isquery=true, x-ms-max-item-count=100, x-ms-continuation=null, Content-Type=application/query+json]","cosmosDiagnostics":{"userAgent":"azsdk-java-cosmos/4.54.0 MacOSX/14.6.1 JRE/21.0.2 az-sd-cos/5.9.1az-sp-cos/5.9.1","activityId":"06902d04-1956-4a2c-910c-f8b42149bacd","requestLatencyInMs":86,"requestStartTimeUTC":"2024-12-13T09:23:22.172050Z","requestEndTimeUTC":"2024-12-13T09:23:22.258511Z","responseStatisticsList":[],"supplementalResponseStatisticsList":[],"addressResolutionStatistics":{},"regionsContacted":["primary"],"retryContext":{"statusAndSubStatusCodes":null,"retryLatency":0,"retryCount":0},"metadataDiagnosticsContext":{"metadataDiagnosticList":null},"serializationDiagnosticsContext":{"serializationDiagnosticsList":null},"gatewayStatisticsList":[{"sessionToken":"0:-1#1","operationType":"Query","resourceType":"Document","statusCode":500,"subStatusCode":0,"requestCharge":0.0,"requestTimeline":[{"eventName":"connectionAcquired","startTimeUTC":"2024-12-13T09:23:22.173061Z","durationInMilliSecs":0.188},{"eventName":"connectionConfigured","startTimeUTC":"2024-12-13T09:23:22.173249Z","durationInMilliSecs":0.035},{"eventName":"requestSent","startTimeUTC":"2024-12-13T09:23:22.173284Z","durationInMilliSecs":0.431},{"eventName":"transitTime","startTimeUTC":"2024-12-13T09:23:22.173715Z","durationInMilliSecs":84.405},{"eventName":"received","startTimeUTC":"2024-12-13T09:23:22.258120Z","durationInMilliSecs":0.19}],"partitionKeyRangeId":"0","responsePayloadSizeInBytes":0,"exceptionMessage":"Aggref found in non-Agg plan node, StatusCode: InternalServerError","exceptionResponseHeaders":"{Transfer-Encoding=chunked, Server=PGSQL, x-ms-session-token=0:-1#1, x-ms-documentdb-partitionkeyrangeid=0, x-ms-interopandsdk-time-ms=82, x-ms-gatewayversion=2.0.0, Date=Fri, 13 Dec 2024 09:23:21 GMT, x-ms-activity-id=06902d04-1956-4a2c-910c-f8b42149bacd, Content-Type=application/json}"}],"samplingRateSnapshot":1.0,"systemInformation":{"usedMemory":"119794 KB","availableMemory":"9317390 KB","systemCpuLoad":"empty","availableProcessors":11},"clientCfgs":{"id":1,"machineId":"uuid:606c2ac1-e3bd-4510-afad-30f3b3972b9b","connectionMode":"GATEWAY","numberOfClients":3,"excrgns":"[]","clientEndpoints":{"https://localhost:57604":3},"connCfg":{"rntbd":null,"gw":"(cps:1000, nrto:PT1M, icto:PT1M, p:false)","other":"(ed: false, cs: false, rv: true)"},"consistencyCfg":"(consistency: null, mm: true, prgns: [])","proactiveInitCfg":"","e2ePolicyCfg":"","sessionRetryCfg":""}}}]

kmandalas avatar Dec 13 '24 09:12 kmandalas

@kmandalas wonder if you can run again and post the result. We had a mishap pushing out the version with the better logging. Thanks again for helping us get to the bottom of that.

xgerman avatar Dec 16 '24 22:12 xgerman

Hello @xgerman happy to assist, we thank you for this new feature. Here is the update stacktrace:

2024-12-17T13:37:20.574+02:00 DEBUG 84922 --- [           main] c.a.c.implementation.SqlQuerySpecLogger  : SELECT VALUE COUNT(1) FROM r WHERE (r.principal = @principal0 AND r.type = @type1) 
2024-12-17T13:37:23.943+02:00 ERROR 84922 --- [ctor-http-nio-1] c.a.c.i.query.DocumentProducer           : Unexpected failure, Context: n/a

com.azure.cosmos.CosmosException: {"innerErrorMessage":"Exception while reading from stream Cosmos query text: SELECT VALUE COUNT(1) FROM r WHERE (r.principal = @principal0 AND r.type = @type1)  -> SELECT COUNT(1) FROM %s AS r WHERE (cosmos_catalog.cosmos_eq(r.document, $1 ) AND cosmos_catalog.cosmos_eq(r.document, $2 )), StatusCode: InternalServerError","cosmosDiagnostics":{"userAgent":"azsdk-java-cosmos/4.54.0 MacOSX/14.6.1 JRE/21.0.2 az-sd-cos/5.9.1az-sp-cos/5.9.1","activityId":"3441a79e-826d-4cff-af97-34755b419b5e","requestLatencyInMs":3323,"requestStartTimeUTC":"2024-12-17T11:37:20.619316Z","requestEndTimeUTC":"2024-12-17T11:37:23.942716Z","responseStatisticsList":[],"supplementalResponseStatisticsList":[],"addressResolutionStatistics":{},"regionsContacted":["primary"],"retryContext":{"statusAndSubStatusCodes":null,"retryCount":0,"retryLatency":0},"metadataDiagnosticsContext":{"metadataDiagnosticList":null},"serializationDiagnosticsContext":{"serializationDiagnosticsList":null},"gatewayStatisticsList":[{"sessionToken":"0:-1#1","operationType":"Query","resourceType":"Document","statusCode":500,"subStatusCode":0,"requestCharge":0.0,"requestTimeline":[{"eventName":"connectionAcquired","startTimeUTC":"2024-12-17T11:37:20.620335Z","durationInMilliSecs":0.172},{"eventName":"connectionConfigured","startTimeUTC":"2024-12-17T11:37:20.620507Z","durationInMilliSecs":0.029},{"eventName":"requestSent","startTimeUTC":"2024-12-17T11:37:20.620536Z","durationInMilliSecs":0.36},{"eventName":"transitTime","startTimeUTC":"2024-12-17T11:37:20.620896Z","durationInMilliSecs":3320.88},{"eventName":"received","startTimeUTC":"2024-12-17T11:37:23.941776Z","durationInMilliSecs":0.461}],"partitionKeyRangeId":"0","responsePayloadSizeInBytes":0,"exceptionMessage":"Exception while reading from stream Cosmos query text: SELECT VALUE COUNT(1) FROM r WHERE (r.principal = @principal0 AND r.type = @type1)  -> SELECT COUNT(1) FROM %s AS r WHERE (cosmos_catalog.cosmos_eq(r.document, $1 ) AND cosmos_catalog.cosmos_eq(r.document, $2 )), StatusCode: InternalServerError","exceptionResponseHeaders":"{Transfer-Encoding=chunked, Server=PGSQL, x-ms-session-token=0:-1#1, x-ms-documentdb-partitionkeyrangeid=0, x-ms-interopandsdk-time-ms=3317, x-ms-gatewayversion=2.0.0, Date=Tue, 17 Dec 2024 11:37:23 GMT, x-ms-activity-id=3441a79e-826d-4cff-af97-34755b419b5e, Content-Type=application/json}"}],"samplingRateSnapshot":1.0,"systemInformation":{"usedMemory":"117060 KB","availableMemory":"9320124 KB","systemCpuLoad":"empty","availableProcessors":11},"clientCfgs":{"id":1,"machineId":"uuid:30b1d709-1638-4eb6-b386-d51216435750","connectionMode":"GATEWAY","numberOfClients":3,"excrgns":"[]","clientEndpoints":{"https://localhost:63047":3},"connCfg":{"rntbd":null,"gw":"(cps:1000, nrto:PT1M, icto:PT1M, p:false)","other":"(ed: false, cs: false, rv: true)"},"consistencyCfg":"(consistency: null, mm: true, prgns: [])","proactiveInitCfg":"","e2ePolicyCfg":"","sessionRetryCfg":""}}}
	at com.azure.cosmos.BridgeInternal.createCosmosException(BridgeInternal.java:478) ~[azure-cosmos-4.54.0.jar:4.54.0]
	at com.azure.cosmos.implementation.RxGatewayStoreModel.validateOrThrow(RxGatewayStoreModel.java:504) ~[azure-cosmos-4.54.0.jar:4.54.0]
	at com.azure.cosmos.implementation.RxGatewayStoreModel.lambda$toDocumentServiceResponse$1(RxGatewayStoreModel.java:365) ~[azure-cosmos-4.54.0.jar:4.54.0]
	at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:74) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:200) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onNext(FluxDoFinally.java:113) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:194) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty(Operators.java:2097) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.MonoCollectList$MonoCollectListSubscriber.onComplete(MonoCollectList.java:118) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144) ~[reactor-core-3.6.2.jar:3.6.2]
	at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:415) ~[reactor-netty-core-1.1.15.jar:1.1.15]
	at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:446) ~[reactor-netty-core-1.1.15.jar:1.1.15]
	at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:500) ~[reactor-netty-core-1.1.15.jar:1.1.15]
	at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:782) ~[reactor-netty-http-1.1.15.jar:1.1.15]
	at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:114) ~[reactor-netty-core-1.1.15.jar:1.1.15]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) ~[netty-handler-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) ~[netty-codec-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318) ~[netty-codec-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1475) ~[netty-handler-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible(SslHandler.java:1349) ~[netty-handler-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1389) ~[netty-handler-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529) ~[netty-codec-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468) ~[netty-codec-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290) ~[netty-codec-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[netty-transport-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.105.Final.jar:4.1.105.Final]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.105.Final.jar:4.1.105.Final]
	at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]


com.azure.spring.data.cosmos.exception.CosmosAccessException: Failed to get count value

	at com.azure.spring.data.cosmos.exception.CosmosExceptionUtils.exceptionHandler(CosmosExceptionUtils.java:44)
	at com.azure.spring.data.cosmos.core.CosmosTemplate.lambda$getCountValue$36(CosmosTemplate.java:1135)
	at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94)
	at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.doError(FluxPublishOn.java:517)
	at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.checkTerminated(FluxPublishOn.java:555)
	at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.runAsync(FluxPublishOn.java:438)
	at reactor.core.publisher.FluxPublishOn$PublishOnSubscriber.run(FluxPublishOn.java:533)
	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84)
	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
	Suppressed: {"ClassName":"CosmosException","userAgent":"azsdk-java-cosmos/4.54.0 MacOSX/14.6.1 JRE/21.0.2","statusCode":500,"resourceAddress":"https://localhost:63047/dbs/vnext-demo-test/colls/audits/docs","error":"{\"code\":\"InternalServerError\",\"message\":\"Exception while reading from stream Cosmos query text: SELECT VALUE COUNT(1) FROM r WHERE (r.principal = @principal0 AND r.type = @type1)  -> SELECT COUNT(1) FROM %s AS r WHERE (cosmos_catalog.cosmos_eq(r.document, $1 ) AND cosmos_catalog.cosmos_eq(r.document, $2 )), StatusCode: InternalServerError\",\"additionalErrorInfo\":null}","innerErrorMessage":"Exception while reading from stream Cosmos query text: SELECT VALUE COUNT(1) FROM r WHERE (r.principal = @principal0 AND r.type = @type1)  -> SELECT COUNT(1) FROM %s AS r WHERE (cosmos_catalog.cosmos_eq(r.document, $1 ) AND cosmos_catalog.cosmos_eq(r.document, $2 )), StatusCode: InternalServerError","causeInfo":null,"responseHeaders":"{Transfer-Encoding=chunked, Server=PGSQL, x-ms-session-token=0:-1#1, x-ms-documentdb-partitionkeyrangeid=0, x-ms-interopandsdk-time-ms=3317, x-ms-gatewayversion=2.0.0, Date=Tue, 17 Dec 2024 11:37:23 GMT, x-ms-activity-id=3441a79e-826d-4cff-af97-34755b419b5e, Content-Type=application/json}","requestHeaders":"[x-ms-cosmos-sdk-supportedcapabilities=1, x-ms-cosmos-intended-collection-rid=MDAwMQ==, Accept=application/json, x-ms-cosmos-correlated-activityid=d969830e-aa9f-4949-a831-80bace1d4963, x-ms-date=Tue, 17 Dec 2024 11:37:20 GMT, x-ms-documentdb-partitionkeyrangeid=0, x-ms-documentdb-isquery=true, x-ms-max-item-count=100, x-ms-continuation=null, Content-Type=application/query+json]","cosmosDiagnostics":{"userAgent":"azsdk-java-cosmos/4.54.0 MacOSX/14.6.1 JRE/21.0.2 az-sd-cos/5.9.1az-sp-cos/5.9.1","activityId":"3441a79e-826d-4cff-af97-34755b419b5e","requestLatencyInMs":3323,"requestStartTimeUTC":"2024-12-17T11:37:20.619316Z","requestEndTimeUTC":"2024-12-17T11:37:23.942716Z","responseStatisticsList":[],"supplementalResponseStatisticsList":[],"addressResolutionStatistics":{},"regionsContacted":["primary"],"retryContext":{"statusAndSubStatusCodes":null,"retryCount":0,"retryLatency":0},"metadataDiagnosticsContext":{"metadataDiagnosticList":null},"serializationDiagnosticsContext":{"serializationDiagnosticsList":null},"gatewayStatisticsList":[{"sessionToken":"0:-1#1","operationType":"Query","resourceType":"Document","statusCode":500,"subStatusCode":0,"requestCharge":0.0,"requestTimeline":[{"eventName":"connectionAcquired","startTimeUTC":"2024-12-17T11:37:20.620335Z","durationInMilliSecs":0.172},{"eventName":"connectionConfigured","startTimeUTC":"2024-12-17T11:37:20.620507Z","durationInMilliSecs":0.029},{"eventName":"requestSent","startTimeUTC":"2024-12-17T11:37:20.620536Z","durationInMilliSecs":0.36},{"eventName":"transitTime","startTimeUTC":"2024-12-17T11:37:20.620896Z","durationInMilliSecs":3320.88},{"eventName":"received","startTimeUTC":"2024-12-17T11:37:23.941776Z","durationInMilliSecs":0.461}],"partitionKeyRangeId":"0","responsePayloadSizeInBytes":0,"exceptionMessage":"Exception while reading from stream Cosmos query text: SELECT VALUE COUNT(1) FROM r WHERE (r.principal = @principal0 AND r.type = @type1)  -> SELECT COUNT(1) FROM %s AS r WHERE (cosmos_catalog.cosmos_eq(r.document, $1 ) AND cosmos_catalog.cosmos_eq(r.document, $2 )), StatusCode: InternalServerError","exceptionResponseHeaders":"{Transfer-Encoding=chunked, Server=PGSQL, x-ms-session-token=0:-1#1, x-ms-documentdb-partitionkeyrangeid=0, x-ms-interopandsdk-time-ms=3317, x-ms-gatewayversion=2.0.0, Date=Tue, 17 Dec 2024 11:37:23 GMT, x-ms-activity-id=3441a79e-826d-4cff-af97-34755b419b5e, Content-Type=application/json}"}],"samplingRateSnapshot":1.0,"systemInformation":{"usedMemory":"118184 KB","availableMemory":"9319000 KB","systemCpuLoad":"empty","availableProcessors":11},"clientCfgs":{"id":1,"machineId":"uuid:30b1d709-1638-4eb6-b386-d51216435750","connectionMode":"GATEWAY","numberOfClients":3,"excrgns":"[]","clientEndpoints":{"https://localhost:63047":3},"connCfg":{"rntbd":null,"gw":"(cps:1000, nrto:PT1M, icto:PT1M, p:false)","other":"(ed: false, cs: false, rv: true)"},"consistencyCfg":"(consistency: null, mm: true, prgns: [])","proactiveInitCfg":"","e2ePolicyCfg":"","sessionRetryCfg":""}}}
		at com.azure.cosmos.BridgeInternal.createCosmosException(BridgeInternal.java:478)
		at com.azure.cosmos.implementation.RxGatewayStoreModel.validateOrThrow(RxGatewayStoreModel.java:504)
		at com.azure.cosmos.implementation.RxGatewayStoreModel.lambda$toDocumentServiceResponse$1(RxGatewayStoreModel.java:365)
		at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106)
		at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:74)
		at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:200)
		at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122)
		at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onNext(FluxDoFinally.java:113)
		at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:194)
		at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107)
		at reactor.core.publisher.Operators$BaseFluxToMonoOperator.completePossiblyEmpty(Operators.java:2097)
		at reactor.core.publisher.MonoCollectList$MonoCollectListSubscriber.onComplete(MonoCollectList.java:118)
		at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260)
		at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)
		at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:415)
		at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:446)
		at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:500)
		at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:782)
		at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:114)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
		at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
		at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
		at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
		at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
		at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
		at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1475)
		at io.netty.handler.ssl.SslHandler.decodeNonJdkCompatible(SslHandler.java:1349)
		at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1389)
		at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)
		at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)
		at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
		at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
		at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
		at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
		at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
		at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
		at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
		at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
		at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
		at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
		at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
		... 1 more
	Suppressed: java.lang.Exception: #block terminated with an error
		at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:103)
		at reactor.core.publisher.Mono.block(Mono.java:1728)
		at com.azure.spring.data.cosmos.core.CosmosTemplate.getCountValue(CosmosTemplate.java:1141)
		at com.azure.spring.data.cosmos.core.CosmosTemplate.getCountValue(CosmosTemplate.java:1121)
		at com.azure.spring.data.cosmos.core.CosmosTemplate.count(CosmosTemplate.java:1079)
		at com.azure.spring.data.cosmos.core.CosmosTemplate.exists(CosmosTemplate.java:849)
		at com.azure.spring.data.cosmos.repository.query.CosmosQueryExecution$ExistsExecution.execute(CosmosQueryExecution.java:138)
		at com.azure.spring.data.cosmos.repository.query.AbstractCosmosQuery.execute(AbstractCosmosQuery.java:50)
		at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:170)
		at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:158)
		at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:164)
		at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:143)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
		at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:70)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
		at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
		at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:220)
		at jdk.proxy2/jdk.proxy2.$Proxy102.existsByPrincipalAndType(Unknown Source)
		at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
		at java.base/java.lang.reflect.Method.invoke(Method.java:580)
		at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:351)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
		at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
		at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:220)
		at jdk.proxy2/jdk.proxy2.$Proxy102.existsByPrincipalAndType(Unknown Source)
		at com.example.demo.audits.DemoAuditRepositoryIntegrationTest.testFindWithExistsUsingCount(DemoAuditRepositoryIntegrationTest.java:64)
		at java.base/java.lang.reflect.Method.invoke(Method.java:580)
		at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
		at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: [CIRCULAR REFERENCE: {"ClassName":"CosmosException","userAgent":"azsdk-java-cosmos/4.54.0 MacOSX/14.6.1 JRE/21.0.2","statusCode":500,"resourceAddress":"https://localhost:63047/dbs/vnext-demo-test/colls/audits/docs","error":"{\"code\":\"InternalServerError\",\"message\":\"Exception while reading from stream Cosmos query text: SELECT VALUE COUNT(1) FROM r WHERE (r.principal = @principal0 AND r.type = @type1)  -> SELECT COUNT(1) FROM %s AS r WHERE (cosmos_catalog.cosmos_eq(r.document, $1 ) AND cosmos_catalog.cosmos_eq(r.document, $2 )), StatusCode: InternalServerError\",\"additionalErrorInfo\":null}","innerErrorMessage":"Exception while reading from stream Cosmos query text: SELECT VALUE COUNT(1) FROM r WHERE (r.principal = @principal0 AND r.type = @type1)  -> SELECT COUNT(1) FROM %s AS r WHERE (cosmos_catalog.cosmos_eq(r.document, $1 ) AND cosmos_catalog.cosmos_eq(r.document, $2 )), StatusCode: InternalServerError","causeInfo":null,"responseHeaders":"{Transfer-Encoding=chunked, Server=PGSQL, x-ms-session-token=0:-1#1, x-ms-documentdb-partitionkeyrangeid=0, x-ms-interopandsdk-time-ms=3317, x-ms-gatewayversion=2.0.0, Date=Tue, 17 Dec 2024 11:37:23 GMT, x-ms-activity-id=3441a79e-826d-4cff-af97-34755b419b5e, Content-Type=application/json}","requestHeaders":"[x-ms-cosmos-sdk-supportedcapabilities=1, x-ms-cosmos-intended-collection-rid=MDAwMQ==, Accept=application/json, x-ms-cosmos-correlated-activityid=d969830e-aa9f-4949-a831-80bace1d4963, x-ms-date=Tue, 17 Dec 2024 11:37:20 GMT, x-ms-documentdb-partitionkeyrangeid=0, x-ms-documentdb-isquery=true, x-ms-max-item-count=100, x-ms-continuation=null, Content-Type=application/query+json]","cosmosDiagnostics":{"userAgent":"azsdk-java-cosmos/4.54.0 MacOSX/14.6.1 JRE/21.0.2 az-sd-cos/5.9.1az-sp-cos/5.9.1","activityId":"3441a79e-826d-4cff-af97-34755b419b5e","requestLatencyInMs":3323,"requestStartTimeUTC":"2024-12-17T11:37:20.619316Z","requestEndTimeUTC":"2024-12-17T11:37:23.942716Z","responseStatisticsList":[],"supplementalResponseStatisticsList":[],"addressResolutionStatistics":{},"regionsContacted":["primary"],"retryContext":{"statusAndSubStatusCodes":null,"retryCount":0,"retryLatency":0},"metadataDiagnosticsContext":{"metadataDiagnosticList":null},"serializationDiagnosticsContext":{"serializationDiagnosticsList":null},"gatewayStatisticsList":[{"sessionToken":"0:-1#1","operationType":"Query","resourceType":"Document","statusCode":500,"subStatusCode":0,"requestCharge":0.0,"requestTimeline":[{"eventName":"connectionAcquired","startTimeUTC":"2024-12-17T11:37:20.620335Z","durationInMilliSecs":0.172},{"eventName":"connectionConfigured","startTimeUTC":"2024-12-17T11:37:20.620507Z","durationInMilliSecs":0.029},{"eventName":"requestSent","startTimeUTC":"2024-12-17T11:37:20.620536Z","durationInMilliSecs":0.36},{"eventName":"transitTime","startTimeUTC":"2024-12-17T11:37:20.620896Z","durationInMilliSecs":3320.88},{"eventName":"received","startTimeUTC":"2024-12-17T11:37:23.941776Z","durationInMilliSecs":0.461}],"partitionKeyRangeId":"0","responsePayloadSizeInBytes":0,"exceptionMessage":"Exception while reading from stream Cosmos query text: SELECT VALUE COUNT(1) FROM r WHERE (r.principal = @principal0 AND r.type = @type1)  -> SELECT COUNT(1) FROM %s AS r WHERE (cosmos_catalog.cosmos_eq(r.document, $1 ) AND cosmos_catalog.cosmos_eq(r.document, $2 )), StatusCode: InternalServerError","exceptionResponseHeaders":"{Transfer-Encoding=chunked, Server=PGSQL, x-ms-session-token=0:-1#1, x-ms-documentdb-partitionkeyrangeid=0, x-ms-interopandsdk-time-ms=3317, x-ms-gatewayversion=2.0.0, Date=Tue, 17 Dec 2024 11:37:23 GMT, x-ms-activity-id=3441a79e-826d-4cff-af97-34755b419b5e, Content-Type=application/json}"}],"samplingRateSnapshot":1.0,"systemInformation":{"usedMemory":"118184 KB","availableMemory":"9319000 KB","systemCpuLoad":"empty","availableProcessors":11},"clientCfgs":{"id":1,"machineId":"uuid:30b1d709-1638-4eb6-b386-d51216435750","connectionMode":"GATEWAY","numberOfClients":3,"excrgns":"[]","clientEndpoints":{"https://localhost:63047":3},"connCfg":{"rntbd":null,"gw":"(cps:1000, nrto:PT1M, icto:PT1M, p:false)","other":"(ed: false, cs: false, rv: true)"},"consistencyCfg":"(consistency: null, mm: true, prgns: [])","proactiveInitCfg":"","e2ePolicyCfg":"","sessionRetryCfg":""}}}]

kmandalas avatar Dec 17 '24 11:12 kmandalas

Thanks we now have what we need.

xgerman avatar Dec 17 '24 20:12 xgerman