dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.23k stars 9.95k forks source link

Unhandled ChannelClosedException while debugging #53325

Closed davidkarlsson closed 8 months ago

davidkarlsson commented 8 months ago

Is there an existing issue for this?

Describe the bug

While pausing the debugger in another project than the one that is running ASP.NET Core the process running the web server will consistently crash with an unhandled ChannelClosedException if I pause long enough at a breakpoint.

The project I'm pausing the debugger with is running a gRPC server which the process that is running ASP.NET is connected to with bi-directional streaming calls but I'm not sure if that's related to this issue in some way.

Expected Behavior

I don't expect the process running ASP.NET Core to crash just because I'm pausing the debugger at a breakpoint.

Steps To Reproduce

I have not been able to reproduce this in a minimalistic project and I unfortunately can't share the projects where this happens.

Exceptions (if any)

Unhandled exception. System.Threading.Channels.ChannelClosedException: The channel has been closed.
   at System.Threading.Channels.ChannelWriter`1.Complete(Exception error)
   at System.Net.Http.Http2Connection.FinalTeardown()
   at System.Net.Http.Http2Connection.Shutdown()
   at System.Net.Http.Http2Connection.Abort(Exception abortException)
   at System.Net.Http.Http2Connection.HeartBeat()
   at System.Net.Http.HttpConnectionPool.HeartBeat()
   at System.Net.Http.HttpConnectionPoolManager.HeartBeat()
   at System.Net.Http.HttpConnectionPoolManager.<>c.<.ctor>b__11_1(Object state)
   at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool)
   at System.Threading.TimerQueue.FireNextTimers()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
Unhandled exception. System.Threading.Channels.ChannelClosedException: The channel has been closed.
   at System.Threading.Channels.ChannelWriter`1.Complete(Exception error)
   at System.Net.Http.Http2Connection.FinalTeardown()
   at System.Net.Http.Http2Connection.Shutdown()
   at System.Net.Http.Http2Connection.Abort(Exception abortException)
   at System.Net.Http.Http2Connection.HeartBeat()
   at System.Net.Http.HttpConnectionPool.HeartBeat()
   at System.Net.Http.HttpConnectionPoolManager.HeartBeat()
   at System.Net.Http.HttpConnectionPoolManager.<>c.<.ctor>b__11_1(Object state)
   at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool)

.NET Version

8.0.101

Anything else?

The IDE I'm using when this happens is JetBrains Rider 2023.3.2 Build #RD-233.13135.100.

dotnet --info outputs:

.NET SDK:
 Version:           8.0.101
 Commit:            6eceda187b
 Workload version:  8.0.100-manifests.69afb982

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

.NET workloads installed:
 Workload version: 8.0.100-manifests.69afb982
There are no installed workloads to display.

Host:
  Version:      8.0.1
  Architecture: x64
  Commit:       bf5e279d92

.NET SDKs installed:
  6.0.300 [C:\Program Files\dotnet\sdk]
  7.0.312 [C:\Program Files\dotnet\sdk]
  8.0.100 [C:\Program Files\dotnet\sdk]
  8.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

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

Download .NET:
  https://aka.ms/dotnet/download
BrennanConroy commented 8 months ago

Looks like https://github.com/dotnet/runtime/issues/95621

davidkarlsson commented 8 months ago

Duplicate of https://github.com/dotnet/runtime/issues/95621