Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] Fix Redis Connection::get() after reject() #31387

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2019

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented May 5, 2019

Q A
Branch? 4.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

If a message is rejected, another consumer cannot read from the stream because the first subsequent call to \Redis::xreadgroup() returns false for some reason.
Reproducer: https://github.com/chalasr/redis-transport-bug

ping @alexander-schranz

@@ -123,7 +123,7 @@ public function ack(string $id): void
} catch (\RedisException $e) {
}

if (!$acknowledged || $e) {
if ($e || !$acknowledged) {
Copy link
Member Author

Choose a reason for hiding this comment

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

unrelated: if $e is not null then $acknowledged is undefined.

@fabpot
Copy link
Member

fabpot commented May 6, 2019

Thank you @chalasr.

@fabpot fabpot merged commit c05273f into symfony:master May 6, 2019
fabpot added a commit that referenced this pull request May 6, 2019
…alasr)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[Messenger] Fix Redis Connection::get() after reject()

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  |no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

If a message is rejected, another consumer cannot read from the stream because the first subsequent call to `\Redis::xreadgroup()` returns false for some reason.
Reproducer: https://github.com/chalasr/redis-transport-bug

ping @alexander-schranz

Commits
-------

c05273f [Messenger] Fix Redis Connection::get() after reject()
@alexander-schranz
Copy link
Contributor

@chalasr for me it looks like we need to call on reject xack to remove it from the pending messages and xdel to remove it for the other consumers in the reject command?

@chalasr
Copy link
Member Author

chalasr commented May 6, 2019

@alexander-schranz Makes sense, would you mind opening a PR?

@chalasr chalasr deleted the redis-stream-read-pending branch May 6, 2019 12:40
fabpot added a commit that referenced this pull request May 6, 2019
…chranz)

This PR was squashed before being merged into the 4.3-dev branch (closes #31396).

Discussion
----------

[Messenger] Fix rejecting of pending messages

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #...
| License       | MIT
| Doc PR        | -

As discussed in #31387 (comment). It seems pending messages are not removed by calling xdel so we need to call xack first to remove them from the pending state and then call xdel to remove it from the complete stream.

It seems to be the correct way as mentioned in: https://github.com/antirez/redis/issues/5754

Test should be the same as added in: https://github.com/symfony/symfony/pull/31387/files#diff-46c1e03dafbcebc46b5cace7d05de20c

Commits
-------

072e466 [Messenger] Fix rejecting of pending messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants