Skip to content

TCP Connection Error (Proxy) #9662

@MartinSGill

Description

@MartinSGill

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I just created a new Aspire project from a template, and I encountered #7817, which has been closed/locked. Since I cannot add more information to that issue, I created this new one.

Work-Around: When I rebooted my computer the issue went away.

My suspicion is that AppHost might not be correctly releasing some resources (sockets/ports maybe?) and eventually it runs out of them and breaks.

Expected Behavior

I should be able to go the the port displayed in the dashboard to access my application.

Steps To Reproduce

  1. Start and stop AppHost application a number of times (different hosts)

I was experimenting with different aspire templates

  1. dotnet new install Microsoft.FluentUI.AspNetCore.Templates` (Version: 4.11.7)
  2. mkdir AspireApp1 ; cd AspireApp1
  3. dotnet new fluentaspire-starter
  4. dotnet run dotnet run --project .\AspireApp1.AppHost\
  5. Click on api app link in dashboard and wait for timeout.
  6. Eventually see Error handling TCP connection ... in AppHost log

Exceptions (if any)

I found the following in the Application Logs for the .NET Runtime.

I do not know if it's relevant or not, but I've not seen this specific error in the log again after I rebooted my computer (causing the issue to resolved iteself).

Category: Aspire.Dashboard.Model.DashboardClient
EventId: 0
SpanId: 6bde70e3e217a803
TraceId: d7315eb7127bccff2ac1a5ddea1c2619
ParentId: 0000000000000000
ConnectionId: 0HND2GN2H4I7D
RequestId: 0HND2GN2H4I7D:00000001
RequestPath: /_blazor
TransportConnectionId: ZnzjZxA4ipYxDXZCqjdJNg

Error #1 watching resources.

Exception: 
Grpc.Core.RpcException: Status(StatusCode="Unavailable", Detail="Error reading next message. IOException: The request was aborted. IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.. SocketException: An existing connection was forcibly closed by the remote host.", DebugException="System.IO.IOException: The request was aborted.")
 ---> System.IO.IOException: The request was aborted.
 ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
 ---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host.
   --- End of inner exception stack trace ---
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token)
   at Grpc.Net.Client.Balancer.Internal.StreamWrapper.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)
   at System.Net.Http.Http2Connection.ProcessIncomingFramesAsync()
   --- End of inner exception stack trace ---
   at System.Net.Http.Http2Connection.ThrowRequestAborted(Exception innerException)
   at System.Net.Http.Http2Connection.Http2Stream.CheckResponseBodyState()
   at System.Net.Http.Http2Connection.Http2Stream.TryReadFromBuffer(Span`1 buffer, Boolean partOfSyncRead)
   at System.Net.Http.Http2Connection.Http2Stream.ReadDataAsync(Memory`1 buffer, HttpResponseMessage responseMessage, CancellationToken cancellationToken)
   at Grpc.Net.Client.Internal.StreamExtensions.ReadMessageAsync[TResponse](Stream responseStream, GrpcCall call, Func`2 deserializer, String grpcEncoding, Boolean singleMessage, CancellationToken cancellationToken)
   at Grpc.Net.Client.Internal.GrpcCall`2.ReadMessageAsync(Stream responseStream, String grpcEncoding, Boolean singleMessage, CancellationToken cancellationToken)
   at Grpc.Net.Client.Internal.HttpContentClientStreamReader`2.MoveNextCore(CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Grpc.Net.Client.Internal.HttpContentClientStreamReader`2.MoveNextCore(CancellationToken cancellationToken)
   at Grpc.Net.Client.Internal.Retry.RetryCallBaseClientStreamReader`2.MoveNext(CancellationToken cancellationToken)
   at Grpc.Core.AsyncStreamReaderExtensions.ReadAllAsyncCore[T](IAsyncStreamReader`1 streamReader, CancellationToken cancellationToken)+MoveNext()
   at Grpc.Core.AsyncStreamReaderExtensions.ReadAllAsyncCore[T](IAsyncStreamReader`1 streamReader, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
   at Aspire.Dashboard.Model.DashboardClient.<>c__DisplayClass29_1.<<EnsureInitialized>g__WatchResourcesAsync|5>d.MoveNext() in /_/src/Aspire.Dashboard/ResourceService/DashboardClient.cs:line 323
--- End of stack trace from previous location ---
   at Aspire.Dashboard.Model.DashboardClient.<>c__DisplayClass29_1.<<EnsureInitialized>g__WatchResourcesAsync|5>d.MoveNext() in /_/src/Aspire.Dashboard/ResourceService/DashboardClient.cs:line 323
--- End of stack trace from previous location ---
   at Aspire.Dashboard.Model.DashboardClient.<>c__DisplayClass29_0.<<EnsureInitialized>g__WatchResourcesWithRecoveryAsync|3>d.MoveNext() in /_/src/Aspire.Dashboard/ResourceService/DashboardClient.cs:line 298

.NET Version info

.NET SDK:
Version: 9.0.204
Commit: 23062858b9
Workload version: 9.0.200-manifests.d2ef4c67
MSBuild version: 17.13.25+b1feb5ea6

Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.204\

.NET workloads installed:
[android]
Installation Source: SDK 9.0.200
Manifest Version: 35.0.50/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.android\35.0.50\WorkloadManifest.json
Install Type: Msi

[ios]
Installation Source: SDK 9.0.200
Manifest Version: 18.2.9180/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.ios\18.2.9180\WorkloadManifest.json
Install Type: Msi

[maccatalyst]
Installation Source: SDK 9.0.200
Manifest Version: 18.2.9180/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maccatalyst\18.2.9180\WorkloadManifest.json
Install Type: Msi

[maui-windows]
Installation Source: SDK 9.0.200
Manifest Version: 9.0.0/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maui\9.0.0\WorkloadManifest.json
Install Type: Msi

Configured to use loose manifests when installing new manifests.

Host:
Version: 9.0.5
Architecture: x64
Commit: e36e4d1a8f

.NET SDKs installed:
7.0.410 [C:\Program Files\dotnet\sdk]
8.0.410 [C:\Program Files\dotnet\sdk]
9.0.106 [C:\Program Files\dotnet\sdk]
9.0.204 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Anything else?

  • I was experimenting with different templates for aspire and after a few restarts of various AppHost projects the issue suddenly started. I was using both Rider and the command line dotnet run for this.
  • The SDK Version seemed to have no effect (once the issue presented itself). The issue started happening when I was using 9.3.0 SDK.
  • Once the issue existed, I tried changing SDKs to 9.2.0, 9.2.1 and 9.0.0 (also the package-references) and restarting AppHost but it made no difference.
  • I tried all the steps mentioned in TCP Connection Error #7817, including disabling my firewall. Nothing worked.
  • If I look at the console logs for my application and use the port listed there I can connect successfully to my app

Metadata

Metadata

Assignees

Labels

area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplicationarea-orchestrator

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions