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

[fix] Close consumer resources if creation fails #1070

Merged
merged 1 commit into from
Jul 26, 2023

Conversation

michaeljmarshall
Copy link
Member

Motivation

When a consumer fails to get created, we should close any resources that it created to prevent leaks of internal resources and leaks of the consumer on the broker side. The broker leak could happen if the connection was left open. These fixes are similar to #1061.

Modifications

  • Close ackGroupingTracker and chunkedMsgCtxMap if grabConn fails. We cannot call Close on the consumer because the state is not Ready. If we re-design the consumer, it could be nice to be able to call Close in this scenario.
  • Call Close on the consumer in cases where we move it to Ready but determine it is not able to be created.
  • Fix typo in comment

Verifying this change

This is a trivial change.

@RobertIndie RobertIndie added this to the v0.12.0 milestone Jul 26, 2023
@RobertIndie RobertIndie merged commit a3fcc9a into apache:master Jul 26, 2023
6 checks passed
RobertIndie pushed a commit that referenced this pull request Sep 7, 2023
### Motivation

When a consumer fails to get created, we should close any resources that it created to prevent leaks of internal resources and leaks of the consumer on the broker side. The broker leak could happen if the connection was left open. These fixes are similar to #1061.

### Modifications

* Close `ackGroupingTracker` and `chunkedMsgCtxMap` if `grabConn` fails. We cannot call `Close` on the consumer because the state is not `Ready`. If we re-design the consumer, it could be nice to be able to call `Close` in this scenario.
* Call `Close` on the consumer in cases where we move it to `Ready` but determine it is not able to be created.
* Fix typo in comment

(cherry picked from commit a3fcc9a)
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.

3 participants