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] Proper message decoding error handling#50043

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

Conversation

@alex-dev
Copy link
Contributor

@alex-devalex-dev commentedApr 17, 2023
edited
Loading

QA
Branch?6.3
Bug fix?yes
New feature?no
Deprecations?no
BC breaks?yes
TicketsFix#44117
LicenseMIT
Doc PRN/A
  • Update CHANGELOG.md
  • Update whatever is needed for BC breaks
  • Ensure serialization works across a full failing message (failed decoding into encoding)

Problem

Handling deserialization in transports prevents actual error handling from running... And depending on transports, can even drop messages. While envelope and stamps deserialization failures may be actual error warranting undefined behavior, message denormalization failures is merely an application concern. Symfony should never drop messages that are broken by the application.

Solution

Reusing some part of#39622:

  • Ensure bothPhpSerializer andSerializer do not throw error in message deserialization
    • Stamps and envelope are still allowed to throw.
    • Remove toggling incomplete classes fromPhpSerializer
  • HandleMessageDecodingFailedStamp inWorker
    • Trigger standard message rejection (event and retry into full rejection)
  • Ensure compatibility withAbstractFailedMessagesCommand

BC breaks

  • Messenger\Transport\Serialization\Serializer::__construct() first arguments goes from?SerializerInterface $serializer = null toDecoderInterface&DenormalizerInterface&SerializerInterface $serializer
    • To support distinguishing between encoding errors and normalization errors, we must call each separately. This requires an intersection of interfaces
    • Framework always pass a constructed serializer, so no issue
    • No other instantiations are done... So only BC breaks will be in standalone uses passing null as first argument
    • Messenger\Transport\Serialization\Serializer::create() still return a default constructed instance

valtzu reacted with thumbs up emoji
@alex-devalex-devforce-pushed theserializer-error-proper-error-handling branch 4 times, most recently from72a5cb3 to08b0850CompareApril 24, 2023 13:37
@alex-dev
Copy link
ContributorAuthor

@lyrixx Here is a fix for#44117

@alex-devalex-devforce-pushed theserializer-error-proper-error-handling branch 2 times, most recently from6f0f923 to796da17CompareApril 25, 2023 13:32
@alex-devalex-devforce-pushed theserializer-error-proper-error-handling branch from60068ef tod3f1e14CompareMay 15, 2023 14:57
@alex-devalex-devforce-pushed theserializer-error-proper-error-handling branch fromd3f1e14 to67fb47cCompareMay 15, 2023 16:26
@nicolas-grekasnicolas-grekas modified the milestones:6.3,6.4May 23, 2023
@ismail1432
Copy link
Contributor

ismail1432 commentedNov 9, 2023
edited
Loading

Hello@alex-dev,
I think this fix is important, why the PR was closed?

nikophil reacted with thumbs up emoji

@alex-dev
Copy link
ContributorAuthor

alex-dev commentedNov 9, 2023
edited
Loading

I could not justify spending more time on this to update it. Seeing Symfony had little interest in this fix, my company chose to implement a solution inside the transport layer. It is hacked, but the right behavior is guaranteed.
If thee is clear interest in this, I may reopen in January.

nikophil reacted with confused emoji

@B-Galati
Copy link
Contributor

@alex-dev any chance you could share your solution?

@alex-dev
Copy link
ContributorAuthor

We just reimplemented the transport and made rejection a no-op. There are a few annoying caveats.

  • Retries and failures must be handled by the queue itself (SQS does).
  • You lose a lot of debugging utilities Symfony gives you (you must unconfigure failure handling from Symfony)

Other alternative would be to reimplement the worker and associated commands (what this PR more or less does).

B-Galati reacted with thumbs up emoji

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

Reviewers

1 more reviewer

@nikophilnikophilnikophil left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

6.4

Development

Successfully merging this pull request may close these issues.

[Messenger] MessageDecodingFailedException should not delete message from queue

6 participants

@alex-dev@ismail1432@B-Galati@nikophil@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp