CosmosDB stop answer from time to time

bingodk 6 Reputation points
2021-06-13T06:53:14.19+00:00

I have a Java Function that is trigered by REST.
The Function query an existing item from CosmosDB table (using container.readItem), and then update (or not) the item.

I have seen several times that the CosmosDB doesn't answer to the query,
and an exception catched after long time.
After about an hour, the CosmosDB return to normal responses.

The only logs I could find are the "Log Stream" of the Function App.

See below those logs (of good response and of no response)

My subscription is currently the very basic one - 1 free year, as it is kind of trial

  1. Are there any other logs I can collect to analyze the problem, mainly on the CosmosDB side?
  2. What can be the reason for this behavior?

Thanks
Doron

FunctionApp Log Stream:

Good Answer

2021-06-06T05:55:14.532 [Information] Executing 'Functions.Expose' (Reason='This function was programmatically called via the host APIs.', Id=cd3b9c28-6747-4973-8a3a-bab231c78676)
2021-06-06T05:55:15.182 [Information] Function "Expose" (Id: cd3b9c28-6747-4973-8a3a-bab231c78676) invoked by Java Worker
2021-06-06T05:55:15.183 [Information] Executed 'Functions.Expose' (Succeeded, Id=cd3b9c28-6747-4973-8a3a-bab231c78676, Duration=651ms)

No Answer

2021-06-06T05:55:19.888 [Information] Executing 'Functions.Expose' (Reason='This function was programmatically called via the host APIs.', Id=f3e8c71c-1f99-483a-a63a-01c3d838b1d1)
2021-06-06T05:55:29.354 [Information] Host Status: {"id": "...","state": "Running","version": "3.0.15733.0","versionDetails": "3.0.15733 Commit hash: a0b4f7d3a2fadb61bc3e0ef99987e1701f12e310","platformVersion": "94.0.7.89","instanceId": "f73ec259463d6bbea48b0c896be42940712d933e5f5bc906985703249e6d8a84","computerName": "DW0-HR0-8-17","processUptime": 1133375,"extensionBundle": {"id": "Microsoft.Azure.Functions.ExtensionBundle","version": "1.8.1"}}
2021-06-06T05:55:29.416 [Information] Host Status: {"id": "...","state": "Running","version": "3.0.15733.0","versionDetails": "3.0.15733 Commit hash: a0b4f7d3a2fadb61bc3e0ef99987e1701f12e310","platformVersion": "94.0.7.89","instanceId": "f73ec259463d6bbea48b0c896be42940712d933e5f5bc906985703249e6d8a84","computerName": "DW0-HR0-8-17","processUptime": 1133437,"extensionBundle": {"id": "Microsoft.Azure.Functions.ExtensionBundle","version": "1.8.1"}}
2021-06-06T05:55:52.328 [Information] Function "Expose" (Id: f3e8c71c-1f99-483a-a63a-01c3d838b1d1) invoked by Java Worker
2021-06-06T05:55:52.328 [Information] Executed 'Functions.Expose' (Succeeded, Id=f3e8c71c-1f99-483a-a63a-01c3d838b1d1, Duration=32440ms)

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,867 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,608 questions
{count} votes

2 answers

Sort by: Most helpful
  1. bingodk 6 Reputation points
    2021-06-23T07:15:01.06+00:00

    Hello @Oury Ba-MSFT
    Thanks for your tracking.
    I did open a support ticket. I will updated when issue solved.
    By the way, the analysis during ticket preparation is excellent, and actually showed the issue


  2. bingodk 6 Reputation points
    2021-07-08T05:24:27.043+00:00

    The problem was with the way I used to connect between Function JAVA code to CosmosDB.

    The correct way to connect between Function and CosmosDB is using "input binding" and "output binding"
    by using @CosmosDBInput and @CosmosDBOutput in the Function declaration.
    The fetched item from cosmosDB is automatically injected, and updating the output item automatically update the cosmosDB

    In my previous non efficient code I used a direct way: create CosmosClient instance, and then connected it to cosmosDB using:
    client.getDatabase()
    database.getContainer()
    and finally container.readItem() and container.upsertItem()

    I used it this way because this was the sample code I received when created the JAVA method using: mvn azure-functions:add

    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.