Skip to content

Unexpected timeout exception #2233

@MaxiPigna

Description

@MaxiPigna

Given this source code

builder.Services.AddHealthChecks()
    .AddAzureCosmosDB(optionsFactory: static (sp) =>
    {
        CosmosDbOptions cosmosConfig = sp.GetRequiredService<IOptions<CosmosDbOptions>>().Value;
        return new AzureCosmosDbHealthCheckOptions
        {
            DatabaseId = cosmosConfig.DatabaseName,
            ContainerIds = [Constants.ConversationContainerName]
        };
    }, tags: ["Database"], timeout: TimeSpan.FromSeconds(2))

It works most of the time, but sometimes I find exception like this in the log, why?
image

I think it's weird I get a timeout exception, while Cosmos replied 200 OK in the expected time.

Environment:

  • .NET 8 version
  • AspNetCore.HealthChecks.CosmosDb version 8.0.0
  • Linux Azure App Service

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcosmosdb

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions