Skip to content
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

[v22.2.x] Backport #9105 bugfix #9475

Merged

Conversation

BenPope
Copy link
Member

@BenPope BenPope commented Mar 15, 2023

Backport of PR #9105 to branch v22.2.x. (just the bugfix)
Fixes #9310

Previously, the value of `_name` was passed into `on_stopped`. This is a
problem in the case of an unnamed consumer because `_name` will be an
empty string. Instead, use the result of `consumer::name()`.

Here is the definition of `on_stopped`:
```cpp
auto on_stopped = [this, group_id](const member_id& name) {
    _consumers[group_id].erase(name); // silenty fails if name is empty
};
```
The result of passing an empty string to `on_stopped` is that the
consumer is not erased from the map. This is an issue because the client
expects the map to eventually become empty.

From `client::stop()`:
```cpp
for (auto& [id, group] : _consumers) {
    while (!group.empty()) { // group is never empty, so infinite loop
        auto c = *group.begin();
        co_await catch_and_log([c]() {
            return c->leave();
        });
    }
}
```

Instead, the while loop becaomes an inifite loop since the consumer is
never removed.

Fixes redpanda-data#9310

(cherry picked from commit 791cf6e)
@BenPope BenPope added area/pandaproxy REST interface for Kafka API and removed area/redpanda labels Mar 15, 2023
@BenPope BenPope requested a review from NyaliaLui March 15, 2023 13:20
@NyaliaLui NyaliaLui merged commit b8196fa into redpanda-data:v22.2.x Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/pandaproxy REST interface for Kafka API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants