aspire icon indicating copy to clipboard operation
aspire copied to clipboard

Windows ARM64: Health checks are performed over IPv6 only, while docker defaults to IPv4

Open oising opened this issue 5 months ago • 3 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Describe the bug

Note: This behaviour does not occur with Intel windows, only ARM64 (afaict)

Health checks only go over ipv6, while docker desktop defaults to only using ipv4, making the aspire network inaccessible.

Expected Behavior

Health checks should try ipv6 and ipv4.

Steps To Reproduce

requires WoA (windows on arm) to repro:

I used this apphost to show that the health check fails but the http port is reachable within an event handler using a vanilla httpclient:

using System.Net.Http.Headers;

var builder = DistributedApplication.CreateBuilder(args);

#pragma warning disable ASPIREPROXYENDPOINTS001
var openfga = builder.AddContainer("openfga", "openfga/openfga:latest")
    .WithEnvironment(e =>
    {
        e.EnvironmentVariables.Add("OPENFGA_DATASTORE_ENGINE", "memory");
        e.EnvironmentVariables.Add("OPENFGA_PLAYGROUND_ENABLED", "true");
    })
    .WithEndpoint(
        targetPort: 8080,
        name: "http",
        scheme: "http"
    )
    //.WithEndpoint("http", (ep) => ep.TargetHost = "127.0.0.1")  // uncomment this to force IPv4
    .WithArgs("run")
    .WithLifetime(ContainerLifetime.Persistent)
    .WithHttpHealthCheck(path: "/healthz", statusCode: 200, endpointName: "http")
    .WithEndpointProxySupport(proxyEnabled: false);
#pragma warning restore ASPIREPROXYENDPOINTS001

openfga.OnResourceEndpointsAllocated(async (r, e, c) =>
{
    var http = r.GetEndpoint("http");
    
    {
        retry:
        try
        {
            Console.WriteLine($"OpenFGA {http.EndpointName} Endpoint: {http.Url}");
            using HttpClient client = new() { BaseAddress = new Uri(http.Url) };
        
            var res = await client.GetAsync("/healthz");
            res.EnsureSuccessStatusCode();

            var content = await res.Content.ReadAsStringAsync();
            Console.WriteLine($"OpenFGA {http.EndpointName} /healthz: {content}");
        }
        catch (Exception ex)
        {
            Console.WriteLine($"OpenFGA {http.EndpointName} {ex.GetType().Name}: {ex.Message}, retrying...");
            await Task.Delay(1000);
            goto retry;
        }
    }
});

builder. Build().Run();

Exceptions (if any)

TaskCanceledException is throw for the healthcheck, almost immediately.

.NET Version info

tried net8, net10

Anything else?

No response

oising avatar Sep 22 '25 00:09 oising

When dealing with containers/Docker, the safest bet is to stick with IPv4 as much as possible

karolz-ms avatar Sep 22 '25 17:09 karolz-ms

@karolz-ms said:

When dealing with containers/Docker, the safest bet is to stick with IPv4 as much as possible

Absolutely. But I'm not in control of this behaviour. It is an issue with the DCP on ARM64. No problems with my colleagues' Wintel machines.

oising avatar Sep 22 '25 18:09 oising

@karolz-ms said:

When dealing with containers/Docker, the safest bet is to stick with IPv4 as much as possible

Absolutely. But I'm not in control of this behaviour. It is an issue with the DCP on ARM64. No problems with my colleagues' Wintel machines.

Sorry I should have been more clear. The audience for my remark is myself or my collegues who will be fixing this issue in Aspire app model 😄

karolz-ms avatar Sep 22 '25 19:09 karolz-ms