Skip to content

Fix races in ISO message confirmations - #808

Merged
adamdickmeiss merged 6 commits into
mainfrom
fix-iso-confirmation-waiters
Oct 13, 2026
Merged

adamdickmeiss merged 6 commits into
mainfrom
fix-iso-confirmation-waiters

Conversation

@adamdickmeiss

Copy link
Copy Markdown
Contributor

ISO HTTP handlers and asynchronous confirmation handlers accessed the shared waitingReqs map without synchronization. Notices were also published before their waiters were registered, allowing a fast confirmation to arrive before the HTTP request was ready to receive it.

Protect all map access with a mutex, consume waiters through atomic lookup and removal, and register waiters before publishing notices. Remove waiters when publication fails.

Add regression tests covering concurrent access, early confirmations, duplicate confirmations, and publication failure. Verified that the tests detect both original defects.

Validation: focused race tests passed for 20 repetitions; ISO integration race tests, the full broker suite, lint, build, and all 135 Bruno requests passed.

ISO HTTP handlers and asynchronous confirmation handlers accessed the
shared waitingReqs map without synchronization. Notices were also published
before their waiters were registered, allowing a fast confirmation to arrive
before the HTTP request was ready to receive it.

Protect all map access with a mutex, consume waiters through atomic lookup
and removal, and register waiters before publishing notices. Remove waiters
when publication fails.

Add regression tests covering concurrent access, early confirmations,
duplicate confirmations, and publication failure. Verified that the tests
detect both original defects.

Validation: focused race tests passed for 20 repetitions; ISO integration race
tests, the full broker suite, lint, build, and all 135 Bruno requests passed.
Copilot AI balanced review requested due to automatic review settings October 8, 2026 15:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The synchronization changes address the identified races and include focused regression coverage.

0 open findings

What changed in this PR

Fixes race conditions in ISO message confirmation handling.

Changes:

  • Synchronizes waiter registration, lookup, and removal.
  • Registers waiters before publishing confirmation notices.
  • Adds regression coverage for concurrency, duplicate confirmations, and failures.
File Description
broker/​handler/​iso18626-handler.go Adds synchronized confirmation waiter lifecycle.
broker/​handler/​request_wait_test.go Tests concurrent and failure scenarios.
broker/​events/​eventbus.go Supports caller-allocated notice IDs.
broker/​events/​eventbus_test.go Verifies custom notice IDs.
broker/​patron_request/​service/​action_test.go Updates the event-bus mock.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@adamdickmeiss
adamdickmeiss merged commit 058de1b into main Oct 13, 2026
8 checks passed
@adamdickmeiss
adamdickmeiss deleted the fix-iso-confirmation-waiters branch October 13, 2026 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants