Skip to content

Fix uAMQP sender close failures - #7356

Open
Johnathan W (j7nw4r) wants to merge 3 commits into
mainfrom
fix/7350-uamqp-open-close-failures
Open

Fix uAMQP sender close failures#7356
Johnathan W (j7nw4r) wants to merge 3 commits into
mainfrom
fix/7350-uamqp-open-close-failures

Conversation

@j7nw4r

Copy link
Copy Markdown
Member

Summary

Fixes #7350.

Motivation

uAMQP could free an unsettled send callback before a delayed broker disposition used it. Sender Open cleanup could also wait for polling while it held the connection lock.

Changes

  • Remove a pending native transfer before freeing its outer send state during close.
  • Move sender Open polling removal before the connection lock.
  • Report synthetic sender and receiver deadlines as retryable AMQP timeouts, while caller cancellation stays final.

Test plan

  • Ran the socket-mock-broker regression under AddressSanitizer. The unchanged source reports a heap-use-after-free in message_sender.c:113; this branch passes.
  • Ran 216 azure-core-amqp tests and 9 uAMQP-only tests under AddressSanitizer.
  • Ran RetriesAllowlistedEventHubsConditions and DoesNotRetryOperationCancelledException.

Johnathan Walker added 2 commits August 18, 2026 17:52
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 6dd2b823-ee32-4dae-8a39-431336702c4b
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 6dd2b823-ee32-4dae-8a39-431336702c4b
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
8 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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.

Pull request overview

Fixes uAMQP sender teardown safety and distinguishes synthetic timeouts from caller cancellation.

Changes:

  • Cancels pending transfers before freeing send callback state.
  • Avoids holding the connection lock during poll removal.
  • Adds timeout handling and an unsettled-send regression test.

Reviewed changes

Copilot reviewed 4 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
CHANGELOG.md Documents the fixes.
link.h Declares transfer cancellation.
link.c Implements pending-delivery cancellation.
message_sender.c Safely tears down unsettled sends.
message_sender.cpp Adjusts open cleanup and timeout reporting.
message_receiver.cpp Distinguishes close timeout from cancellation.
message_sender_receiver.cpp Adds the sender-close regression test.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread sdk/core/azure-core-amqp/test/ut/message_sender_receiver.cpp Outdated
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
8 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(core-amqp): closing a uAMQP sender with an unsettled send is a use-after-free

2 participants