Heap dumps: every SDK shutdown logs "Error waiting for GarbageCollectionMonitor task to complete"
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
src/Sentry/Internal/MemoryMonitor.csから始め、特に45~49行目付近の継続処理の設定と、176~191行目付近のシャットダウン処理を確認してください。破棄中に待機するタスクにキャンセルがどう影響するかを追い、その後、関連するメモリモニターのテストを調べてください。ヒープダンプを有効にした通常のシャットダウンでエラーがログに記録されなくなり、モニターの障害は引き続き報告される状態が完了の条件です。
索引モデルが issue の本文から書いたものです。
説明
With heap dumps enabled, every normal SDK shutdown logs this at Error level:
Error: Error waiting for GarbageCollectionMonitor task to complete
System.AggregateException: One or more errors occurred. (A task was canceled.)
---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Sentry.Internal.MemoryMonitor.Dispose()
at Sentry.Internal.Hub.Dispose()
at Sentry.Integrations.AppDomainProcessExitIntegration.HandleProcessExit(Object sender, EventArgs e)
Nothing is actually wrong. It's just noise, but it shows up for anyone with Debug on, and at Error level it looks like a real failure.
Cause
_monitorTask isn't the monitor task itself. It's the ContinueWith(..., TaskContinuationOptions.OnlyOnFaulted) continuation that logs monitor failures:
On shutdown, Dispose cancels the token, and the monitor stops without faulting. An OnlyOnFaulted continuation gets cancelled when its antecedent doesn't fault, so _monitorTask.Wait(500) throws an AggregateException that wraps a TaskCanceledException. The catch (OperationCanceledException) doesn't match the wrapper, so the general catch logs it as an error:
Repro
Console app on .NET 10, macOS arm64. Reproduces on 5.0.1 and on current main (7.1.0+):
SentrySdk.Init(o =>
{
o.Dsn = "...";
o.Debug = true;
o.EnableHeapDumps((_, _) => false);
});
// let the app exit normally
The trigger doesn't need to fire. The error is logged whenever the SDK is disposed with heap dumps enabled.
Possible fix
Keep a reference to the monitor task itself and wait on that, or treat an AggregateException whose inner exceptions are all OperationCanceledException as a normal shutdown.
Found while reproducing #4007.
- 主要言語
- C#
- スター
- 775
- フォーク
- 262
- 平均マージ
- 1日 16時間
- マージ済み PR(30日)
- 118
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
getsentry/sentry-dotnet のほかの issue
-
chore: remove stale IL3050/IL3053 workaround from the iOS sample対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンState: Needs Discussion
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
getsentry/sentry-dotnet#6071 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
.NET Platform: Android Task
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
getsentry/sentry-dotnet#6020 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Move the Blazor WebAssembly sample off the deprecated DevServer対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン.NET Framework: Blazor
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
getsentry/sentry-dotnet#5906 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Docs MSBuild Needs Docs Update
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
getsentry/sentry-dotnet#5691 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
.NET Docs State: Needs Discussion
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
getsentry/sentry-dotnet#5637 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
getsentry/sentry-dotnet の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
microsoft/fluentui-blazor#5688 ·
メンテナーはふだん 1 日以内に返信
-
OpenTelemetryChatClient records gen_ai.response.finish_reasons as a JSON string instead of string[]オープンarea-ai bug untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
dotnet/extensions#7995 ·
メンテナーはふだん 1 日以内に返信
-
:watch: Not Triaged dotnet-target-version
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
dotnet/docs-desktop#2313 ·
メンテナーはふだん 4 日以内に返信
-
dotnet-target-version
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
-
area/frontend type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
umbraco/Umbraco-CMS#24867 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信