UnknownHostException intermittently when Java makes connection with cosmosdb

cosmosdbuser 5 Reputation points
2023-06-02T23:44:02.63+00:00

We have a springboot app deployed in kubernetes (using latest azure-cosmos jar files) This app connects to cosmosdb and it all works fine for a while when we use it continuously. When the app is left untouched for a while (or sometimes first time use) and we try hitting it, we notice UnknownHostException and it will retry 3 times or so and then gives the results from cosmos. It is able to make connection eventually, but not sure why this exception happens before making connection(or if kept idle) intermittently

WARN 1 --- [or-http-epoll-1] c.a.c.i.WebExceptionRetryPolicy : Received retriable web exception, will retry

springboot-app

com.azure.cosmos.CosmosException: {"innerErrorMessage":null,"cosmosDiagnostics":{"userAgent":"azsdk-java-cosmos/4.45.1 Linux/4.15.0-173-generic JRE/17.0.7 az-sd-cos/3.19.0","activityId":null,"requestLatencyInMs":5009,"requestStartTimeUTC":"2023-06-02T22:23:26.115499944Z","requestEndTimeUTC":"2023-06-02T22:23:31.125221458Z","responseStatisticsList":[],"supplementalResponseStatisticsList":[],"addressResolutionStatistics":{},"regionsContacted":["west us 2"],"retryContext":{"statusAndSubStatusCodes":null,"retryLatency":0,"retryCount":0},"metadataDiagnosticsContext":{"metadataDiagnosticList":null},"serializationDiagnosticsContext":{"serializationDiagnosticsList":null},"gatewayStatistics":{"sessionToken":null,"operationType":"QueryPlan","resourceType":"Document","statusCode":503,"subStatusCode":10001,"requestCharge":0.0,"requestTimeline":[{"eventName":"connectionAcquired","startTimeUTC":"2023-06-02T22:23:26.115929088Z","durationInMilliSecs":5009.249658},{"eventName":"connectionConfigured","startTimeUTC":null,"durationInMilliSecs":0.0},{"eventName":"requestSent","startTimeUTC":null,"durationInMilliSecs":0.0},{"eventName":"transitTime","startTimeUTC":null,"durationInMilliSecs":0.0},{"eventName":"received","startTimeUTC":null,"durationInMilliSecs":0.0}],"partitionKeyRangeId":null,"exceptionMessage":null,"exceptionResponseHeaders":"{x-ms-substatus=10001}","responsePayloadSizeInBytes":0},"samplingRateSnapshot":1.0,"systemInformation":{"usedMemory":"66301 KB","availableMemory":"187139 KB","systemCpuLoad":"(2023-06-02T22:23:03.201816571Z 0.7%), (2023-06-02T22:23:08.201829869Z 3.8%), (2023-06-02T22:23:13.201827491Z 1.2%), (2023-06-02T22:23:18.201819737Z 1.6%), (2023-06-02T22:23:23.201822475Z 2.2%), (2023-06-02T22:23:28.201820864Z 2.4%)","availableProcessors":1},"clientCfgs":{"id":1,"machineId":"uuid:4197750d-5682-4cc1-8ef5-18166feefcf8","connectionMode":"DIRECT","numberOfClients":1,"clientEndpoints":{"https://<REMOVED FOR SECURITY>:443/":1},"connCfg":{"rntbd":"(cto:PT15S, nrto:PT5S, icto:PT15S, ieto:PT1H, mcpe:130, mrpc:30, cer:true)","gw":"(cps:1000, nrto:PT1M, icto:PT1M, p:false)","other":"(ed: true, cs: true, rv: true)"},"consistencyCfg":"(consistency: Session, mm: true, prgns: [westus2])","proactiveInit":null}}}

springboot-app

at com.azure.cosmos.BridgeInternal.createCosmosException(BridgeInternal.java:462) ~[azure-cosmos-4.45.1.jar!/:4.45.1]

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

1 answer

Sort by: Most helpful
  1. Rachakonda, Kranthi kumar 0 Reputation points
    2023-12-19T22:24:47.8933333+00:00

    Do you use coredns?

    Do you netty for your springboot? Check if you running into this bug https://github.com/reactor/reactor-netty/issues/1431

    0 comments No comments

Your answer

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