Files
Heimdall/skills/signalr-client-lifecycle/SKILL.md
T
arnaud.dartois 938adbf3a8
Heimdall Gitea / Detect CI scope (push) Successful in 19s
Heimdall Gitea / Build and tests (push) Successful in 18m10s
Heimdall Gitea / Publish versioned release (push) Skipped
Heimdall Gitea / Build and scan server image (push) Successful in 5m20s
Heimdall Gitea / Build and scan agent image (push) Successful in 9m26s
Heimdall Gitea / Publish Docker Hub latest tags (push) Successful in 1m19s
Heimdall Gitea / Build and scan NVIDIA Agent image (push) Successful in 16m17s
Heimdall Gitea / CI policy (push) Successful in 2s
fix(web): avoid blocking SignalR disposal
Fixes blocking SignalR client shutdown; see issue #233.

Co-authored-by: Arnaud Dartois <admin@tordais.cc>
2026-11-06 20:55:07 +01:00

1.9 KiB

name, description
name description
signalr-client-lifecycle Avoid blocking SignalR client teardown in Heimdall Blazor components and services.

Heimdall SignalR client lifecycle

NotificationsHubClient is scoped to a Blazor circuit and owns a HubConnection. Components that use it should implement IAsyncDisposable, unsubscribe their event handlers, then await Hub.DisposeAsync().

Implementation

  • Do not call .Wait(), .Result, or GetAwaiter().GetResult() on SignalR stop/dispose operations. Network shutdown can block a renderer or request thread.
  • Centralize teardown in one asynchronous helper. Atomically detach the owned connection before awaiting shutdown so repeated disposal cannot dispose it twice.
  • DisposeAsync() awaits StopAsync and DisposeAsync, handling shutdown failures independently so failed stop still attempts resource disposal.
  • If compatibility requires synchronous IDisposable, it must return without blocking and start best-effort asynchronous cleanup. Keep GC.SuppressFinalize(this) on both dispose paths.
  • Log cleanup failures at debug level without access tokens, URLs containing credentials, or message payloads.

Acceptance

  1. Build src/Heimdall.Web/Heimdall.Web.csproj with the SDK pinned by global.json; do not suppress analyzer warnings for blocking calls.
  2. Verify the component unsubscribes handlers and awaits async disposal.
  3. Run the disposable Central + PostgreSQL Compose recipe from skills/compose-disposable-recipe/SKILL.md with unique generated credentials, ports, project, and image tag; check /healthz and verify cleanup of project resources and that exact tag.
  4. Treat production GlitchTip recurrence as external evidence: local build and Compose do not prove the deployed client has stopped emitting events.

See Gitea issue #233 for the current incident evidence.