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

Revert "[Messenger] Fix exception message of failed message is dropped#34082

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
Tobion merged 1 commit intosymfony:4.3fromTobion:fix-message-size-growing
Oct 23, 2019

Conversation

@Tobion
Copy link
Contributor

@TobionTobion commentedOct 23, 2019
edited
Loading

QA
Branch?4.3
Bug fix?yes
New feature?no
Deprecations?no
Tickets
LicenseMIT
Doc PR

This reverts#33600 because it makes the message grow for each retry until AMQP cannot handle it anymore. On each retry, the full exception trace is added to the message. So in our case on the 5th retry, the message is too big for the AMQP library to encode it. AMQP extension then throws the exception

Library error: table too large for buffer

(ref.alanxz/rabbitmq-c#224 andphp-amqp/php-amqp#131) when trying to publish the message.

To solve this, I suggest to revert#33600 (this PR) and merge#32341 instead which does not re-add the exception on each failure.

Btw, the above problem causes other problematic side-effects of Symfony messenger. As the new retry message fails to be published with an exception, the old (currently processed message) also does not get removed (acknowledged) from the delay queue. So rabbitmq redelivers the message and the same thing happens forever. This can block the consumers and have a huge toll on your service. That's just another case for#32055 (comment). I'll try to fix this in another PR. Edit: Here it is#34107

@weaverryan
Copy link
Member

Sorry for being late on#33600 stuff!

Summary:

A) We should merge this and revert#33600 (into 4.3)
B) We should merge#32341, which is a superficial fix in how the exception info is displayed in the command (into 4.3)
C) We should consider#32904 for the future, which is a safer way to try to store some exception info foreach time it fails. (4.4 or 5.1 - I know 4.4 needs to get shipped)

Tobion added a commit that referenced this pull requestOct 23, 2019
…e is dropped (Tobion)This PR was merged into the 4.3 branch.Discussion----------Revert "[Messenger] Fix exception message of failed message is dropped| Q             | A| ------------- | ---| Branch?       | 4.3| Bug fix?      | yes| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tickets       || License       | MIT| Doc PR        |This reverts#33600 because it makes the message grow for each retry until AMQP cannot handle it anymore. On each retry, the full exception trace is added to the message. So in our case on the 5th retry, the message is too big for the AMQP library to encode it. AMQP extension then throws the exception> Library error: table too large for buffer(ref.alanxz/rabbitmq-c#224 andphp-amqp/php-amqp#131) when trying to publish the message.To solve this, I suggest to revert#33600 (this PR) and merge#32341 instead which does not re-add the exception on each failure.Btw, the above problem causes other problematic side-effects of Symfony messenger. As the new retry message fails to be published with an exception, the old (currently processed message) also does not get removed (acknowledged) from the delay queue. So rabbitmq redelivers the message and the same thing happens forever. This can block the consumers and have a huge toll on your service. That's just another case for#32055 (comment). I'll try to fix this in another PR.Commits-------3dbe924 Revert "[Messenger] Fix exception message of failed message is dropped on retry"
@TobionTobion merged commit3dbe924 intosymfony:4.3Oct 23, 2019
@TobionTobion deleted the fix-message-size-growing branchOctober 23, 2019 12:37
@fabpotfabpot mentioned this pull requestNov 1, 2019
@Warxcell
Copy link
Contributor

Warxcell commentedSep 21, 2021
edited
Loading

Still got same problem here. I could reproduce it by simply adding following in the handler

        $exception = null;        for ($i = 0; $i < 10; $i++) {            $exception = new Exception('Exception', null, $exception);        }        throw $exception;

Then I got

In AmqpSender.php line 77:                                               Library error: table too large for buffer

@yyaremenko
Copy link

@Tobion I can also confirm the bug still exists, can you re-check if it was really fixed please? Also is there a test which validates the bugfix?

symfony/messenger v5.3.10

@yyaremenko
Copy link

yyaremenko commentedJan 12, 2022
edited
Loading

Okay, for those who still gets the above error and uses RabbitMQ broker.

In short, the key is message's headers: atype header andstamps headers. If you don't provide or corrupt such headers, you'll get the growing message problem.

This helped me, hopefully this will help you.

  1. Make sure your symfony and messenger bundle are of version >=5.4

  2. If you send 'symfony' ('internal', not 'external') messages manually, by publishing messages via RabbitMQ interface, and consuming such messages in your app, you'll get the problem discussed here - because most probably you won't provide all needed headers. As a workaround, find a way to publish the message via your app (e.g. temporary modify your code) without consuming that message, then go to RabbitMQ UI and see what headers are provided in the message. Use these headers later on when sending messages manually (the main headers you'll probably need would be something like 'type' and 'X-Message-Stamp-Symfony\Component\Messenger\Stamp\BusNameStamp')

  3. For external messages, in case you followed the official symfony instruction herehttps://symfonycasts.com/screencast/messenger/transport-serializer#codeblock-bca382fd36 - bad news, theinstruction is misleading, which is not a big of surprise. If you take a look at how the stamps and 'type' are actually decoded/encoded inSymfony\Component\Messenger\Transport\Serialization\Serializer - you'll be surprised how much it differs from the instruction, especially that there is a type of stamps which must not be sent on retry at all, of a NonSendableStampInterface. So, your custom serializer for external messages must extend from Symfony\Component\Messenger\Transport\Serialization\Serializer as a starting point.

@enumag
Copy link
Contributor

enumag commentedJan 28, 2022
edited
Loading

In my case I got this error after an exception with way too long message. It was ServiceNotFoundException which listed all other services in a ServiceLocator instance which was several hundreds class names. This got into ErrorDetailsStamp which ended up way too large.

However I saw the same error once even after fixing that. I think it can grow too large simply from the exception traces in ErrorDetailsStamp.

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

Reviewers

@weaverryanweaverryanweaverryan approved these changes

@srozesrozeAwaiting requested review from sroze

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@Tobion@weaverryan@Warxcell@yyaremenko@enumag@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp