Control events are always delivered before a per-query event published after them #269

Merged
claude merged 1 commit from feature/267-event-bus-flake into develop 2026-11-05 00:02:54 -05:00
Owner

DnsServerEventDispatcher read the control queue, then on a miss the per-query queue, in two separate steps. A control event and then a per-query event written between those reads let the per-query event go first. That is why DnsServerEventBusTests.ReceiveFromBroker_OfAnotherInstancesEvent_ReachesOnlyRemoteAwareSubscribers failed at random: the drain marker beat the remote zone event. The same race could reorder events on a live server.

The new ReadNext reads the control queue once more after a per-query read and holds the per-query event until the next iteration when a control event turned up.

Evidence (coder, verified independently by the verifier): a concurrent stress test under CPU load failed 25 of 144,000 iterations on develop and 0 of 144,000 with the fix. Solution builds with 0 warnings; all non-Docker tests pass; csharpier clean.

Closes #267

🤖 Generated with Claude Code

https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK

`DnsServerEventDispatcher` read the control queue, then on a miss the per-query queue, in two separate steps. A control event and then a per-query event written between those reads let the per-query event go first. That is why `DnsServerEventBusTests.ReceiveFromBroker_OfAnotherInstancesEvent_ReachesOnlyRemoteAwareSubscribers` failed at random: the drain marker beat the remote zone event. The same race could reorder events on a live server. The new `ReadNext` reads the control queue once more after a per-query read and holds the per-query event until the next iteration when a control event turned up. Evidence (coder, verified independently by the verifier): a concurrent stress test under CPU load failed 25 of 144,000 iterations on develop and 0 of 144,000 with the fix. Solution builds with 0 warnings; all non-Docker tests pass; csharpier clean. Closes #267 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
Control events are always delivered before a per-query event published after them
Some checks failed
Build / Pack and Push NuGet Packages (dns-core) (push) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (push) Has been skipped
Build / Build Binary (linux-arm64) (push) Has been skipped
Build / Build Binary (linux-amd64) (push) Has been skipped
Build / Build Binary (macos-amd64) (push) Has been skipped
Build / Build Binary (macos-arm64) (push) Has been skipped
Build / Build Binary (windows-amd64) (push) Has been skipped
Build / Build and Test Deb and RPM Packages (push) Has been skipped
Build / Smoke Test the Windows Binary (push) Has been skipped
Build / Build Arch Linux Packages (push) Has been skipped
Build / Build and Push Image (push) Has been skipped
Build / Publish Release (push) Has been skipped
Build / Pipeline (push) Failing after 0s
Build / Test .NET (pull_request) Failing after 16m30s
Build / Stage Draft Release (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-server) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (common) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dhcp) (pull_request) Has been skipped
Build / Build Binary (macos-amd64) (pull_request) Has been skipped
Build / Build Binary (linux-arm64) (pull_request) Has been skipped
Build / Build Binary (linux-amd64) (pull_request) Has been skipped
Build / Pack and Push NuGet Packages (dns-core) (pull_request) Has been skipped
Build / Build Binary (macos-arm64) (pull_request) Has been skipped
Build / Build Binary (windows-amd64) (pull_request) Has been skipped
Build / Smoke Test the Windows Binary (pull_request) Has been skipped
Build / Build Arch Linux Packages (pull_request) Has been skipped
Build / Publish Release (pull_request) Has been skipped
Build / Pipeline (pull_request) Failing after 0s
Build / Build and Push Image (pull_request) Has been skipped
Build / Build and Test Deb and RPM Packages (pull_request) Has been skipped
41962bee5e
Closes #267

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK
claude merged commit 403cc27f54 into develop 2026-11-05 00:02:54 -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!269
No description provided.