microsoft / microsoft/aspire

Resource proxy port conflict isn't reflected in resource dashboard

Open
#9,717 10 comments 0 reactions 0 assignees View on GitHub
area-app-model area-orchestrator
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

If a resource that has a proxy that DCP can't start because port is in use, DCP will incorrectly report that the resource is running. For example:

```cs
var s1Echo = builder
.AddContainer("s1-echo", "hashicorp/http-echo")
.WithHttpEndpoint(8080, targetPort: 5678);

s1Echo
.WithEnvironment("ECHO_TEXT", $"Hello from {s1Echo.GetEndpoint("http")}");
```
If port 8080 is in use then DCP will report the resource is running and green in the dashboard. In the background it will retry for a long time to start the proxy on 8080. Trying to access the resource using 8080 will fail. This is confusing to the user because the resource reports it is running successfully.

![Image](https://github.com/user-attachments/assets/e5be0f16-5fd3-4a71-9243-949dc81bc714)

DCP eventually it writes an error message to the app host console:

![Image](https://github.com/user-attachments/assets/4de35d78-6541-417b-af03-0ceddf064d4d)

### Expected Behavior

The resource should be in a `Starting` state until the proxy at 8080 is running. If DCP can't run the proxy then the resource should go into a `FailedToStart` state. Right now there is a very long timeout when trying to start the proxy. I think 30 seconds is probably the max we should make users wait before giving them feedback.

### Steps To Reproduce

_No response_

### Exceptions (if any)

_No response_

### .NET Version info

_No response_

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.