Stopping the cluster config backfill runner after it was disposed does nothing instead of throwing #376

Merged
claude merged 1 commit from feature/373-backfill-stop-after-dispose into develop 2026-11-12 04:50:00 -05:00
Owner

Stopping the cluster config backfill runner after it was disposed now does nothing instead of throwing ObjectDisposedException. This is a product fix; it also removes a rare failure of the web tests.

  • Failure: in pull-request run 1445 one Ninlil.Web.Tests test failed while its second host was disposed, with The CancellationTokenSource has been disposed at ClusterConfigBackfillRunner.StopAsync.
  • Cause: DisposeAsync disposed the runner's cancellation source, and a later StopAsync cancelled it. Under the test host, the app.Run() thread and the factory teardown both stop the same host, so a second stop can arrive after the container disposed the singletons. This path is reasoned from the code and from the same race described in DnsQueryProcessingPipeline; it was not reproduced in the web tests.
  • Fix: DisposeAsync still stops the runner but no longer disposes the source, which holds no timer and no link. Stop and dispose are safe in any order and at the same time. No pass starts after either.
  • Sweep: the coder and the verifier checked the other hosted services for a StopAsync that would throw after dispose and found none.

Verified:

  • Two new tests in ClusterConfigBackfillRunnerTests fail without the fix and pass with it (coder and verifier both ran this).
  • Ninlil.Dns.Server.Cluster.Tests passed 76/76.
  • Ninlil.Web.Tests without Docker tests: 2351 passed; the 2 failures are SpaFallbackTests, which need a built admin console the worktree does not have.
  • The build has 0 warnings and csharpier is clean. The verifier accepted the commit.

Closes #373

🤖 Generated with Claude Code

https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK

Stopping the cluster config backfill runner after it was disposed now does nothing instead of throwing `ObjectDisposedException`. This is a product fix; it also removes a rare failure of the web tests. - **Failure:** in pull-request run 1445 one `Ninlil.Web.Tests` test failed while its second host was disposed, with `The CancellationTokenSource has been disposed` at `ClusterConfigBackfillRunner.StopAsync`. - **Cause:** `DisposeAsync` disposed the runner's cancellation source, and a later `StopAsync` cancelled it. Under the test host, the `app.Run()` thread and the factory teardown both stop the same host, so a second stop can arrive after the container disposed the singletons. This path is reasoned from the code and from the same race described in `DnsQueryProcessingPipeline`; it was not reproduced in the web tests. - **Fix:** `DisposeAsync` still stops the runner but no longer disposes the source, which holds no timer and no link. Stop and dispose are safe in any order and at the same time. No pass starts after either. - **Sweep:** the coder and the verifier checked the other hosted services for a `StopAsync` that would throw after dispose and found none. **Verified:** - Two new tests in `ClusterConfigBackfillRunnerTests` fail without the fix and pass with it (coder and verifier both ran this). - `Ninlil.Dns.Server.Cluster.Tests` passed 76/76. - `Ninlil.Web.Tests` without Docker tests: 2351 passed; the 2 failures are `SpaFallbackTests`, which need a built admin console the worktree does not have. - The build has 0 warnings and csharpier is clean. The verifier accepted the commit. Closes #373 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Stopping the cluster config backfill runner after it was disposed does nothing instead of throwing
All checks were successful
Build / Test .NET (push) Successful in 5m18s
Build / Pack and Push NuGet Packages (dns-core) (pull_request) Successful in -1m56s
Build / Pack and Push NuGet Packages (dns-server) (pull_request) Successful in -1m47s
Build / Build Binary (linux-arm64) (pull_request) Successful in -45s
Build / Build Binary (linux-amd64) (pull_request) Successful in -40s
Build / Build Binary (macos-amd64) (pull_request) Successful in -43s
Build / Stage Draft Release (push) Successful in -2m34s
Build / Pack and Push NuGet Packages (common) (push) Successful in -2m16s
Build / Pack and Push NuGet Packages (dhcp) (push) Successful in -1m50s
Build / Build Binary (windows-amd64) (pull_request) Successful in -43s
Build / Build Binary (macos-arm64) (pull_request) Successful in -50s
Build / Pack and Push NuGet Packages (dns-core) (push) Successful in -2m2s
Build / Pack and Push NuGet Packages (dns-server) (push) Successful in -1m55s
Build / Smoke Test the Windows Binary (pull_request) Successful in 1m22s
Build / Build Binary (linux-amd64) (push) Successful in 1s
Build / Build Binary (linux-arm64) (push) Successful in -17s
Build / Build Arch Linux Packages (pull_request) Successful in -2m1s
Build / Build Binary (macos-arm64) (push) Successful in -39s
Build / Build Binary (macos-amd64) (push) Successful in -18s
Build / Build Binary (windows-amd64) (push) Successful in -43s
Build / Build and Push Image (pull_request) Successful in -2m29s
Build / Smoke Test the Windows Binary (push) Successful in 22s
Build / Build and Test Deb and RPM Packages (pull_request) Successful in -6s
Build / Build Arch Linux Packages (push) Successful in -1m41s
Build / Build and Push Image (push) Successful in -2m27s
Build / Publish Release (pull_request) Successful in -2m32s
Build / Pipeline (pull_request) Successful in 0s
Build / Build and Test Deb and RPM Packages (push) Successful in 4s
Build / Publish Release (push) Successful in -2m28s
Build / Pipeline (push) Successful in 0s
1b730a8b87
Closes #373

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
claude merged commit 39ca996ddb into develop 2026-11-12 04:50:00 -05:00
claude deleted branch feature/373-backfill-stop-after-dispose 2026-11-12 04:50:00 -05:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lantea-one/ninlil!376
No description provided.