AccessViolationException crashes w3wp on .NET 11 with IIS in-process hosting (SignalR hub invocation reads local endpoint in IISHttpContext.InitializeLocalEndpoint)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- csharp
- 領域
- backend, networking
調査の方向性
Start by tracing the reported call path from SignalR's DefaultHubDispatcher.StartActivity through ConnectionEndpointTags.AddConnectionEndpointTags to IIS's IISHttpContext.InitializeLocalEndpoint and NativeRequestContext.GetEndPoint. The report gives no source files or minimal reproduction, so first determine when the native request memory becomes invalid during in-process hosting. Done means endpoint tag collection no longer crashes the worker process in the reported scenario, with the fix covered by a reproducible test.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
After upgrading a Blazor Web App (interactive server rendering) from .NET 10 to .NET 11.0.0, the IIS worker process is terminated by an AccessViolationException when it is hosted in-process. It happens during a SignalR hub method invocation (Blazor circuit traffic). After several crashes IIS rapid-fail protection stops the application pool and the site returns HTTP 503.
The faulting path is DefaultHubDispatcher.StartActivity → ConnectionEndpointTags.AddConnectionEndpointTags → IConnectionEndPointFeature.LocalEndPoint → IISHttpContext.InitializeLocalEndpoint → NativeRequestContext.GetEndPoint → SocketAddress.CopyOutAddress. The local endpoint is read lazily from the native request, apparently when that memory is no longer valid.
Expected Behavior
No crash. Reading the connection endpoint for activity tags should not touch native request memory that has been released, or should fail safely.
Steps To Reproduce
No minimal repro yet. Observed with:
- A Blazor Web App using
AddInteractiveServerComponents()/AddInteractiveServerRenderMode(), targetingnet11.0-windows, published self-contained forwin-x64. - Deployed to IIS with
hostingModel="inprocess". - Users open pages and interact; the worker process crashes with the stack below.
The same build on the same server with hostingModel="outofprocess" runs without the crash. The same application ran in-process on .NET 10 without it. The app does not register any OpenTelemetry or ActivityListener of its own.
Unverified guess: the invocation arrives on a connection whose originating HTTP request has already completed (for example the long-polling transport), so the native request backing IISHttpContext is gone when the endpoint is first read.
Exceptions (if any)
Application: w3wp.exe
CoreCLR Version: 11.0.26.53018
.NET Version: 11.0.0
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Stack:
at System.Runtime.EH.DispatchEx(System.Runtime.StackFrameIterator ByRef, ExInfo ByRef)
at System.Runtime.EH.RhThrowHwEx(UInt32, ExInfo*)
at Microsoft.AspNetCore.HttpSys.Internal.SocketAddress.CopyOutAddress(Windows.Win32.Networking.WinSock.SOCKADDR*)
at Microsoft.AspNetCore.HttpSys.Internal.NativeRequestContext.GetEndPoint(Boolean)
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.InitializeLocalEndpoint()
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature.get_LocalIpAddress()
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContext.Microsoft.AspNetCore.Connections.Features.IConnectionEndPointFeature.get_LocalEndPoint()
at Microsoft.AspNetCore.Shared.ConnectionEndpointTags.AddConnectionEndpointTags(System.Diagnostics.TagList ByRef, Microsoft.AspNetCore.Http.Features.IFeatureCollection)
at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.StartActivity(System.String, System.Diagnostics.ActivityKind, System.Diagnostics.Activity, System.IServiceProvider, System.String, System.Collections.Generic.IDictionary`2<System.String,System.String>, Microsoft.Extensions.Logging.ILogger, Microsoft.AspNetCore.SignalR.HubConnectionContext)
at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.<Invoke>g__ExecuteInvocation|24_0(...)
at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.Invoke(Microsoft.AspNetCore.SignalR.Internal.HubMethodDescriptor, Microsoft.AspNetCore.SignalR.HubConnectionContext, Microsoft.AspNetCore.SignalR.Protocol.HubMethodInvocationMessage, Boolean, Boolean)
at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1+<>c.<ProcessInvocation>b__23_0(...)
at Microsoft.AspNetCore.SignalR.Internal.ChannelBasedSemaphore.RunTask(...)
at Microsoft.AspNetCore.SignalR.Internal.ChannelBasedSemaphore.RunAsync(...)
at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.ProcessInvocation(Microsoft.AspNetCore.SignalR.HubConnectionContext, Microsoft.AspNetCore.SignalR.Protocol.HubMethodInvocationMessage, Boolean)
at Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher`1.DispatchMessageAsync(Microsoft.AspNetCore.SignalR.HubConnectionContext, Microsoft.AspNetCore.SignalR.Protocol.HubMessage)
at Microsoft.AspNetCore.SignalR.HubConnectionHandler`1.DispatchMessagesAsync(Microsoft.AspNetCore.SignalR.HubConnectionContext)
at System.Runtime.CompilerServices.AsyncHelpers+RuntimeAsyncTask`1.DispatchContinuations()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool+WorkerThread.WorkerDoWork(System.Threading.PortableThreadPool)
at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback(System.Threading.Thread*)
.NET Version
11.0.0 (self-contained, win-x64; SDK 11.0.100)
Anything else?
- Hosting: IIS, in-process, self-contained deployment.
- Server OS version, whether the IIS WebSocket Protocol feature is installed, and the installed ASP.NET Core Hosting Bundle version: not yet confirmed; will add in a comment.
- Workaround:
hostingModel="outofprocess".
- 主要言語
- C#
- スター
- 38.5k
- フォーク
- 11.6k
- 平均マージ
- 3日 1時間
- マージ済み PR(30日)
- 289
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dotnet/aspnetcore のほかの issue
-
area-networking
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/aspnetcore#70545 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area-infrastructure
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
dotnet/aspnetcore#70524 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[OpenTelemetry] Hosting replaces an Activity.DisplayName that the app set, when a route matchesオープンarea-hosting Regression
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/aspnetcore#70516 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[SSE] ServerSentEventsResult.WrapEvents is missing [EnumeratorCancellation], so RequestAborted never reaches the app's generator on the IAsyncEnumerable<T> overload対応中かも @bharatprajapati-coder が 1 日前に担当しました。 オープンarea-minimal
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/aspnetcore#70419 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[Blazor] DefaultInMemoryCircuitPersistenceProvider never disposes the retention CancellationTokenSource when a persist is rejected at capacity対応中かも @Vinoth2562000 が 1 日前に担当しました。 オープンarea-blazor
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
dotnet/aspnetcore#70418 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
dotnet/aspnetcore の issue をすべて見る
似ている issue
-
bug emitter:client:csharp
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoft/typespec#12572 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
needs-area-label
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
AWS Lambda: KeyNotFoundException drops HTTP-triggered transactions when allowAllHeaders is disabledオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
newrelic/newrelic-dotnet-agent#3949 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 87/100
メンテナーはふだん 1 日以内に返信
-
priority:P2
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100