Fix AMQP remote connection close cleanup#49832
Open
arnabnandy7 wants to merge 7 commits into
Open
Conversation
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
Contributor
|
Thank you for your contribution @arnabnandy7! We will review the pull request and get back to you soon. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). 34 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request fixes an azure-core-amqp cleanup/termination issue when the remote AMQP peer closes the connection with an error condition (for example amqp:connection:forced). The change ensures the ConnectionHandler emits a terminal error signal (mapped to AmqpException) instead of suppressing it when the remote endpoint is already CLOSED, helping avoid retaining connection/transport resources across reconnect cycles.
Changes:
- Emit a mapped terminal error (
AmqpException) fromonConnectionRemoteClosewhen the remote close includes an AMQP error condition. - Preserve existing behavior for graceful remote closes (still emits
EndpointState.CLOSED). - Add regression tests covering both graceful remote close and
amqp:connection:forcedremote close, and update the changelog.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/handler/ConnectionHandler.java | Ensures remote close events with an error condition surface a terminal error instead of being suppressed. |
| sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/handler/ConnectionHandlerTest.java | Adds regression tests for remote close signaling behavior (graceful vs error-bearing close). |
| sdk/core/azure-core-amqp/CHANGELOG.md | Documents the bug fix in the upcoming unreleased version. |
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes an
azure-core-amqpconnection cleanup issue when a remote endpoint closes an AMQP connection with an error condition, such asamqp:connection:forced.Previously,
ConnectionHandlersuppressed the error because the remote endpoint was already in theCLOSEDstate. As a result,ReactorConnectiondid not receive a terminal signal and could retain connection and transport resources across reconnects.This change:
AmqpExceptionfor error-bearing remote connection closes.CLOSEDsignal for graceful remote closes.amqp:connection:forcedcloses.azure-core-amqpchangelog.Fixes #49440.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines
Test validation:
ConnectionHandlerTest- 9 tests passed with no failures or errors.