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] Add option to prevent Redis from deleting messages on rejection#36727

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:masterfromSteveb-p:redis-transport-rejection
Sep 4, 2020
Merged

[Messenger] Add option to prevent Redis from deleting messages on rejection#36727

fabpot merged 1 commit intosymfony:masterfromSteveb-p:redis-transport-rejection
Sep 4, 2020

Conversation

@Steveb-p
Copy link
Contributor

@Steveb-pSteveb-p commentedMay 6, 2020
edited
Loading

Unlessdelete_after_ack configuration is set totrue.

Introducesdelete_after_reject configuration property.

QA
Branch?master
Bug fix?yes
New feature?no yes (introduces config property)
Deprecations?no
TicketsFix#36619
LicenseMIT

Redis Messenger transport deletes messages when rejecting, causing other consumers / applications to be unable to reach that message.

This affects primarily cases where Messenger component is used to read/write with other, third party applications.

@Steveb-pSteveb-p requested a review fromsroze as acode ownerMay 6, 2020 13:54
@Steveb-pSteveb-p changed the titleStop deleting messages on rejection[Messenger] Prevent Redis from deleting messages on rejectionMay 6, 2020
@nicolas-grekas
Copy link
Member

Then there is going to be zero different between calling reject() and calling ack(). This looks suspicious to me.

soyuka reacted with thumbs up emoji

@nicolas-grekasnicolas-grekas added this to the5.1 milestoneMay 8, 2020
@nicolas-grekasnicolas-grekas changed the base branch frommaster to5.1May 16, 2020 12:34
@soyuka
Copy link
Contributor

soyuka commentedMay 20, 2020
edited
Loading

Maybe that introducing a newdelete_after_reject option would make more sense. As a reminder, this option is here to cover memory usage (7c416a7) although#36619 is an issue where rejected (not acknowledged) messages would not be available to other consumers. Acknowledged messages would could still be deleted to spare memory even though rejected ones could persist.

@Steveb-p
Copy link
ContributorAuthor

Steveb-p commentedMay 21, 2020
edited
Loading

Then there is going to be zero different between calling reject() and calling ack(). This looks suspicious to me.

Whoops, missed the comment.

Pretty much yes, rejection and acknowledgement becomes undistinguishable. From my point of view, acknowledgement means "Yup, I've seen this message and I've handled it". Whether it was rejected or handled ok is not possible to pass to Redis as there is noXREJect command anyway.

This is similar to how Kafka handles messages, which is what Redis streams are based on conceptually. It is simply a structured log that you go through, acknowledging messages as they come (meaning, "I've read it").

https://redis.io/topics/streams-intro

Consumer groups were initially introduced by the popular messaging system called Kafka (TM). Redis reimplements a similar idea in completely different terms, but the goal is the same: to allow a group of clients to cooperate consuming a different portion of the same stream of messages.

As you can see in the original,XACK was sent to Redis just beforeXDEL anyway. Deleting the message causes other consumer groups to be unable to handle that message, despite potentially being able to.
In my case, other consumer group is simply another application. Errors during deserialization caused Worker to reject the message and delete, even though another app was perfectly able to work with it.

As a reminder, this option is here to cover memory usage

(delete_after_ack) I would like to add some sort of warning/note to documentation of this feature (probably in another PR?). I can see where it comes from, but it's "only" reasonable to delete messages if only one consumer group is assumed (that is, Messenger component is treated as internal application queue, not as a method of different application parts / applications to speak to one another).
In cases where another consumer group shows up, it breaks consumer group functionality in Redis.

@Steveb-p
Copy link
ContributorAuthor

Steveb-p commentedMay 26, 2020
edited
Loading

@sroze could you give your opinion on this if you have some spare time? I'd like to adjust the PR to match.

Does this need some tests to be added, or will it be good as-is, even with new configuration propertydelete_after_reject?

EDIT: Also, whatdelete_after_reject default value should be? From my point of view it should maybe follow thedelete_after_ack property if it is set, and befalse otherwise?
I think that this would prevent messages from being deleted (which is what surprised me in the original issue) while keeping the intent of managing redis's memory indelete_after_ack =true case.

EDIT2: I rebased the PR to the currentmaster5.1 branch. And I've put a lot of people on reviever list by doing so... Sorry 😞 😢

Copy link
Member

@chalasrchalasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@chalasr
Copy link
Member

Looks good to me, but I'm not sure this qualifies as a bugfix given it introduces a new option (and thus requires code changes).

@fabpot
Copy link
Member

I agree with@chalasr, this should target 5.2 (aka master).

@Steveb-p
Copy link
ContributorAuthor

@fabpot@chalasr I'll rebase and adjust the PR accordingly.

Hopefully I won't pull half of the community into it this time 🙈

@Steveb-pSteveb-p changed the base branch from5.1 tomasterJune 22, 2020 17:11
@chalasrchalasr added Feature and removed Bug labelsJun 23, 2020
@chalasrchalasr modified the milestones:5.1,nextJun 23, 2020
@Steveb-pSteveb-p marked this pull request as draftJuly 20, 2020 05:28
@Steveb-pSteveb-p marked this pull request as ready for reviewJuly 20, 2020 05:35
@nicolas-grekasnicolas-grekas changed the title[Messenger] Prevent Redis from deleting messages on rejection[Messenger] Add option to prevent Redis from deleting messages on rejectionSep 3, 2020
@fabpot
Copy link
Member

Thank you@Steveb-p.

Steveb-p reacted with thumbs up emoji

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

Reviewers

@chalasrchalasrchalasr requested changes

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@srozesrozeAwaiting requested review from sroze

+1 more reviewer

@soyukasoyukasoyuka approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

5.2

Development

Successfully merging this pull request may close these issues.

[Messenger] Redis Transport removes message from stream on rejection

6 participants

@Steveb-p@nicolas-grekas@soyuka@chalasr@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp