Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.36k stars 2k forks source link

Azure Cosmos SDK connection fails intermittently #42782

Open shweta5595 opened 3 weeks ago

shweta5595 commented 3 weeks ago

I am using azure cosmos sdk version 4.42.0 . Its been running for quite sometime in my application, but quite lately I am observing intermittent connection failure issue.

Exception or Stack Trace Exception while executing function: Functions.auto-purge Result: Failure Exception: RuntimeException: Client initialization failed. Check if the endpoint is reachable and if your auth token is valid. More info: https://aka.ms/cosmosdb-tsg-service-unavailable-java Stack: java.lang.IllegalStateException: Failed to initialize at org.springframework.cloud.function.adapter.azure.FunctionInvoker.(FunctionInvoker.java:89) at org.springframework.cloud.function.adapter.azure.FunctionInvoker.(FunctionInvoker.java:94) at function.AutoPurgeFunctionHandler.(AutoPurgeFunctionHandler.java:8) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at java.lang.Class.newInstance(Class.java:442) at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker$1.getInstance(JavaFunctionBroker.java:45) at com.microsoft.azure.functions.worker.binding.ExecutionContextDataSource.getFunctionInstance(ExecutionContextDataSource.java:103) at com.microsoft.azure.functions.worker.broker.JavaMethodInvokeInfo.invoke(JavaMethodInvokeInfo.java:20) at com.microsoft.azure.functions.worker.broker.JavaMethodExecutorImpl.execute(JavaMethodExecutorImpl.java:22) at com.microsoft.azure.functions.worker.chain.FunctionExecutionMiddleware.invoke(FunctionExecutionMiddleware.java:19) at com.microsoft.azure.functions.worker.chain.InvocationChain.doNext(InvocationChain.java:21) at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:125) at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:34) at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10) at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:44) at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:94) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750)

To Reproduce Steps to reproduce the behavior:

Code Snippet Add the code snippet that causes the issue.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots Image

Setup (please complete the following information):

Additional context Dependency tree of application


mvn dependency:tree -Dverbose
[INFO] Scanning for projects...
[INFO] 
[INFO] ---------------< com.sams.membership:auto-purge-starter >---------------
[INFO] Building auto-purge-starter 0.0.11-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- dependency:3.1.2:tree (default-cli) @ auto-purge-starter ---
[INFO] Verbose not supported since maven-dependency-plugin 3.0
[INFO] com.sams.membership:auto-purge-starter:jar:0.0.11-SNAPSHOT
[INFO] +- org.junit.jupiter:junit-jupiter:jar:5.4.2:test
[INFO] |  +- org.junit.jupiter:junit-jupiter-api:jar:5.7.2:test
[INFO] |  |  +- org.apiguardian:apiguardian-api:jar:1.1.0:test
[INFO] |  |  +- org.opentest4j:opentest4j:jar:1.2.0:test
[INFO] |  |  \- org.junit.platform:junit-platform-commons:jar:1.7.2:test
[INFO] |  +- org.junit.jupiter:junit-jupiter-params:jar:5.7.2:test
[INFO] |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.7.2:test
[INFO] |     \- org.junit.platform:junit-platform-engine:jar:1.7.2:test
[INFO] +- org.mockito:mockito-core:jar:2.23.4:test
[INFO] |  +- net.bytebuddy:byte-buddy:jar:1.10.22:test
[INFO] |  +- net.bytebuddy:byte-buddy-agent:jar:1.10.22:test
[INFO] |  \- org.objenesis:objenesis:jar:2.6:test
[INFO] +- com.microsoft.azure:documentdb-bulkexecutor:jar:2.6.0:compile
[INFO] |  +- com.google.guava:guava:jar:24.1.1-jre:compile
[INFO] |  |  +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] |  |  +- org.checkerframework:checker-compat-qual:jar:2.0.0:compile
[INFO] |  |  +- com.google.errorprone:error_prone_annotations:jar:2.1.3:compile
[INFO] |  |  +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] |  |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
[INFO] |  +- com.microsoft.azure:azure-documentdb:jar:2.4.0:compile
[INFO] |  |  +- com.fasterxml.uuid:java-uuid-generator:jar:3.1.4:compile
[INFO] |  |  +- org.json:json:jar:20140107:compile
[INFO] |  |  +- org.apache.httpcomponents:httpcore:jar:4.4.15:compile
[INFO] |  |  \- joda-time:joda-time:jar:2.9.9:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.36:compile
[INFO] +- com.azure:azure-storage-blob:jar:12.24.0:compile
[INFO] |  +- com.azure:azure-core:jar:1.26.0:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.12.6:compile
[INFO] |  |  \- io.netty:netty-tcnative-boringssl-static:jar:2.0.51.Final:compile
[INFO] |  |     +- io.netty:netty-tcnative-classes:jar:2.0.51.Final:compile
[INFO] |  |     +- io.netty:netty-tcnative-boringssl-static:jar:linux-x86_64:2.0.51.Final:compile
[INFO] |  |     +- io.netty:netty-tcnative-boringssl-static:jar:linux-aarch_64:2.0.51.Final:compile
[INFO] |  |     +- io.netty:netty-tcnative-boringssl-static:jar:osx-x86_64:2.0.51.Final:compile
[INFO] |  |     +- io.netty:netty-tcnative-boringssl-static:jar:osx-aarch_64:2.0.51.Final:compile
[INFO] |  |     \- io.netty:netty-tcnative-boringssl-static:jar:windows-x86_64:2.0.51.Final:compile
[INFO] |  +- com.azure:azure-core-http-netty:jar:1.11.8:compile
[INFO] |  |  +- io.netty:netty-handler:jar:4.1.75.Final:compile
[INFO] |  |  |  +- io.netty:netty-common:jar:4.1.75.Final:compile
[INFO] |  |  |  +- io.netty:netty-resolver:jar:4.1.75.Final:compile
[INFO] |  |  |  +- io.netty:netty-transport:jar:4.1.75.Final:compile
[INFO] |  |  |  \- io.netty:netty-codec:jar:4.1.75.Final:compile
[INFO] |  |  +- io.netty:netty-handler-proxy:jar:4.1.75.Final:compile
[INFO] |  |  |  \- io.netty:netty-codec-socks:jar:4.1.75.Final:compile
[INFO] |  |  +- io.netty:netty-buffer:jar:4.1.75.Final:compile
[INFO] |  |  +- io.netty:netty-codec-http:jar:4.1.75.Final:compile
[INFO] |  |  +- io.netty:netty-codec-http2:jar:4.1.75.Final:compile
[INFO] |  |  +- io.netty:netty-transport-native-unix-common:jar:4.1.75.Final:compile
[INFO] |  |  +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.75.Final:compile
[INFO] |  |  |  \- io.netty:netty-transport-classes-epoll:jar:4.1.75.Final:compile
[INFO] |  |  +- io.netty:netty-transport-native-kqueue:jar:osx-x86_64:4.1.75.Final:compile
[INFO] |  |  |  \- io.netty:netty-transport-classes-kqueue:jar:4.1.75.Final:compile
[INFO] |  |  \- io.projectreactor.netty:reactor-netty-http:jar:1.0.17:compile
[INFO] |  |     +- io.netty:netty-resolver-dns:jar:4.1.75.Final:compile
[INFO] |  |     |  \- io.netty:netty-codec-dns:jar:4.1.75.Final:compile
[INFO] |  |     +- io.netty:netty-resolver-dns-native-macos:jar:osx-x86_64:4.1.75.Final:compile
[INFO] |  |     |  \- io.netty:netty-resolver-dns-classes-macos:jar:4.1.75.Final:compile
[INFO] |  |     \- io.projectreactor.netty:reactor-netty-core:jar:1.0.17:compile
[INFO] |  +- com.azure:azure-storage-common:jar:12.15.0:compile
[INFO] |  +- com.azure:azure-storage-internal-avro:jar:12.2.0:compile
[INFO] |  \- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.12.6:compile
[INFO] |     +- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.12.6:compile
[INFO] |     |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
[INFO] |     |  \- jakarta.activation:jakarta.activation-api:jar:1.2.2:compile
[INFO] |     +- org.codehaus.woodstox:stax2-api:jar:4.2.1:compile
[INFO] |     \- com.fasterxml.woodstox:woodstox-core:jar:6.2.4:compile
[INFO] +- org.projectlombok:lombok:jar:1.18.2:provided
[INFO] +- com.google.code.gson:gson:jar:2.8.5:compile
[INFO] +- com.microsoft.azure:azure-keyvault-secrets-spring-boot-starter:jar:2.3.0:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.5.12:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:2.5.12:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.5.12:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.5.12:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.11:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.2.11:compile
[INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.17.2:compile
[INFO] |  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.17.2:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.36:compile
[INFO] |  |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  |  +- org.springframework:spring-core:jar:5.3.18:compile
[INFO] |  |  |  \- org.springframework:spring-jcl:jar:5.3.18:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.28:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-validation:jar:2.5.12:compile
[INFO] |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.60:compile
[INFO] |  |  \- org.hibernate.validator:hibernate-validator:jar:6.2.3.Final:compile
[INFO] |  |     +- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] |  |     +- org.jboss.logging:jboss-logging:jar:3.4.3.Final:compile
[INFO] |  |     \- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] |  +- com.microsoft.azure:azure-spring-boot:jar:2.3.0:compile
[INFO] |  |  +- org.springframework:spring-web:jar:5.3.18:compile
[INFO] |  |  \- com.azure:azure-security-keyvault-secrets:jar:4.3.8:compile
[INFO] |  +- com.microsoft.azure:azure-client-authentication:jar:1.6.13:compile
[INFO] |  |  +- com.microsoft.azure:azure-client-runtime:jar:1.6.13:compile
[INFO] |  |  |  \- com.microsoft.rest:client-runtime:jar:1.6.13:compile
[INFO] |  |  |     +- com.squareup.retrofit2:retrofit:jar:2.5.0:compile
[INFO] |  |  |     +- com.squareup.okhttp3:okhttp:jar:3.14.9:compile
[INFO] |  |  |     |  \- com.squareup.okio:okio:jar:1.17.2:compile
[INFO] |  |  |     +- com.squareup.okhttp3:logging-interceptor:jar:3.14.9:compile
[INFO] |  |  |     +- com.squareup.okhttp3:okhttp-urlconnection:jar:3.14.9:compile
[INFO] |  |  |     +- com.squareup.retrofit2:converter-jackson:jar:2.5.0:compile
[INFO] |  |  |     +- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.12.6:compile
[INFO] |  |  |     +- io.reactivex:rxjava:jar:1.3.8:compile
[INFO] |  |  |     \- com.squareup.retrofit2:adapter-rxjava:jar:2.4.0:compile
[INFO] |  |  +- commons-codec:commons-codec:jar:1.15:compile
[INFO] |  |  +- com.microsoft.azure:adal4j:jar:1.6.4:compile
[INFO] |  |  \- com.microsoft.azure:azure-annotations:jar:1.7.0:compile
[INFO] |  \- commons-io:commons-io:jar:2.3:compile
[INFO] +- com.opencsv:opencsv:jar:5.7.1:compile
[INFO] |  +- org.apache.commons:commons-lang3:jar:3.12.0:compile
[INFO] |  +- org.apache.commons:commons-text:jar:1.10.0:compile
[INFO] |  +- commons-beanutils:commons-beanutils:jar:1.9.4:compile
[INFO] |  |  \- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] |  \- org.apache.commons:commons-collections4:jar:4.4:compile
[INFO] +- org.apache.httpcomponents:fluent-hc:jar:4.5.10:compile
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.5.13:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- org.springframework.cloud:spring-cloud-function-adapter-azure:jar:3.2.4:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-function-context:jar:3.2.4:compile
[INFO] |  |  +- net.jodah:typetools:jar:0.6.2:compile
[INFO] |  |  +- org.springframework.cloud:spring-cloud-function-core:jar:3.2.4:compile
[INFO] |  |  \- org.springframework:spring-messaging:jar:5.3.18:compile
[INFO] |  +- io.projectreactor:reactor-core:jar:3.4.16:compile
[INFO] |  |  \- org.reactivestreams:reactive-streams:jar:1.0.3:compile
[INFO] |  +- com.microsoft.azure.functions:azure-functions-java-library:jar:1.2.2:compile
[INFO] |  \- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] +- com.azure:azure-identity:jar:1.5.1:compile
[INFO] |  +- com.microsoft.azure:msal4j:jar:1.12.0:compile
[INFO] |  |  +- com.nimbusds:oauth2-oidc-sdk:jar:9.9.1:compile
[INFO] |  |  |  +- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile
[INFO] |  |  |  +- com.nimbusds:content-type:jar:2.1:compile
[INFO] |  |  |  +- com.nimbusds:lang-tag:jar:1.5:compile
[INFO] |  |  |  \- com.nimbusds:nimbus-jose-jwt:jar:9.10.1:compile
[INFO] |  |  \- net.minidev:json-smart:jar:2.4.8:compile
[INFO] |  |     \- net.minidev:accessors-smart:jar:2.4.8:compile
[INFO] |  |        \- org.ow2.asm:asm:jar:9.1:compile
[INFO] |  +- com.microsoft.azure:msal4j-persistence-extension:jar:1.1.0:compile
[INFO] |  |  \- net.java.dev.jna:jna:jar:5.5.0:compile
[INFO] |  \- net.java.dev.jna:jna-platform:jar:5.6.0:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.13.3:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-annotations:jar:2.12.6:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.13.3:compile
[INFO] +- com.azure.spring:azure-spring-boot-starter-cosmos:jar:3.14.0:compile
[INFO] |  +- com.azure.spring:azure-spring-boot:jar:3.14.0:compile
[INFO] |  |  \- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] |  \- com.azure:azure-spring-data-cosmos:jar:3.19.0:compile
[INFO] |     +- org.springframework:spring-beans:jar:5.3.18:compile
[INFO] |     +- org.springframework:spring-context:jar:5.3.18:compile
[INFO] |     |  \- org.springframework:spring-aop:jar:5.3.18:compile
[INFO] |     +- org.springframework:spring-tx:jar:5.3.18:compile
[INFO] |     +- org.springframework.data:spring-data-commons:jar:2.5.10:compile
[INFO] |     +- org.springframework:spring-expression:jar:5.3.18:compile
[INFO] |     +- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.12.6:compile
[INFO] |     +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.12.6:compile
[INFO] |     \- org.javatuples:javatuples:jar:1.2:compile
[INFO] +- com.sams.rewards:sams-cosmosdb-starter:jar:1.0.3:compile
[INFO] |  \- com.microsoft.azure:applicationinsights-core:jar:2.6.2:compile
[INFO] \- com.azure:azure-cosmos:jar:4.42.0:compile
[INFO]    +- com.fasterxml.jackson.module:jackson-module-afterburner:jar:2.12.6:compile
[INFO]    +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
[INFO]    +- io.dropwizard.metrics:metrics-core:jar:4.1.31:compile
[INFO]    \- io.micrometer:micrometer-core:jar:1.7.10:compile
[INFO]       \- org.latencyutils:LatencyUtils:jar:2.0.3:runtime
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.367 s
[INFO] Finished at: 2024-11-02T19:53:27+05:30
[INFO] ------------------------------------------------------------------------

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

github-actions[bot] commented 3 weeks ago

@billwert @g2vinay

github-actions[bot] commented 3 weeks ago

Thank you for your feedback. Tagging and routing to the team member best able to assist.

billwert commented 2 weeks ago

Hello @shweta5595

Is it possible to collect some logs? Please enable logging as described here.

How often do you see this?

github-actions[bot] commented 2 weeks ago

Hi @shweta5595. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

github-actions[bot] commented 1 week ago

Hi @shweta5595, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!