Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Messenger][AMQP] Automatically reconnect on connection loss#53892

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:7.1fromostrolucky:amqp-connection-reconnect
Feb 23, 2024

Conversation

ostrolucky
Copy link
Contributor

@ostroluckyostrolucky commentedFeb 10, 2024
edited
Loading

QA
Branch?7.1
Bug fix?no
New feature?no
Deprecations?no
Issues
LicenseMIT

When using Rabbitmq in cluster, there is a common need of having to upgrade the nodes, while keeping the existing connections. The way this is normally done is by putting nodes in cluster tomaintenance mode, ensuring cluster is healthy at all times. However, symfony/messenger nor php-amqp handle this use case at the moment. What happens instead is that exception when getting the message is thrown, worker crashes, error is logged and process manager has to respin it. This all happens without having a way in user space to handle this case better. Messenger's retry mechanism does not work here, because that one kicks in only when exception is thrown in handlers. Concrete exception is following:

[AMQPConnectionException (320)]
Server connection error: 320, message: CONNECTION_FORCED - Node was put into maintenance mode

What I'm proposing in this PR is that if connection error is detectedtry to reconnect once before throwing exception. That should handle the outlined case. This goes line in line with recommendation from AWS's support we got:

kindly ensure that the client connecting to the broker attempts a retry in case the above error message is observed during a maintenance window. In RabbitMQ cluster deployments, the nodes are restarted one-by-one, meaning at least two nodes will be up and running at all times. Even if a connection is severed, a connection retry will result in the other nodes accepting the connection, and the clients can keep using the broker.

I've also reported issue atphp-amqplib/php-amqplib#1161 with hope that this could be fixed at some point upstream, but I don't give it a big chance.

@OskarStarkOskarStark changed the title[Messenger] AMQP:Automatically reconnect on connection loss[Messenger][AMQP] Automatically reconnect on connection lossFeb 23, 2024
@ostroluckyostroluckyforce-pushed theamqp-connection-reconnect branch fromd5b946d toae95410CompareFebruary 23, 2024 09:41
@ostroluckyostroluckyforce-pushed theamqp-connection-reconnect branch fromae95410 to056b4a5CompareFebruary 23, 2024 10:10
@ostrolucky
Copy link
ContributorAuthor

ci failures unrelated

@fabpot
Copy link
Member

Thank you@ostrolucky.

@fabpotfabpot merged commitf78f932 intosymfony:7.1Feb 23, 2024
@fabpotfabpot mentioned this pull requestMay 2, 2024
nicolas-grekas added a commit that referenced this pull requestJan 17, 2025
…nPillevesse)This PR was merged into the 7.1 branch.Discussion----------[Messenger] [AMQP] Improve AMQP connection issues| Q             | A| ------------- | ---| Branch?       | 7.1| Bug fix?      | yes| New feature?  | no| Deprecations? | no| License       | MITAppy thisfix#53892 for :- `ack` (https://github.com/php-amqp/php-amqp/blob/latest/stubs/AMQPQueue.php#L50)- `nack` (https://github.com/php-amqp/php-amqp/blob/latest/stubs/AMQPQueue.php#L238)Because `\AMQPConnectionException` can also happen hereCommits-------5356023 improve amqp connection issues
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@OskarStarkOskarStarkOskarStark left review comments

@NyholmNyholmNyholm left review comments

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
7.1
Development

Successfully merging this pull request may close these issues.

6 participants
@ostrolucky@fabpot@nicolas-grekas@OskarStark@Nyholm@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp