8000 fix: Kafka client resource leak by jalaziz · Pull Request #469 · lovoo/goka · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: Kafka client resource leak #469

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
Feb 21, 2025

Conversation

jalaziz
Copy link
Contributor
@jalaziz jalaziz commented Feb 16, 2025

Sarama Kafka clients leak several resources (goroutines, metrics, connections) if not closed properly. A client is created and managed within the topic manager and therefore a topic manager will leak resources if not properly closed.

Topic Managers are created in two places:

  1. When calling prepareTopics while instantiating a new processor.
  2. Within processor.Run.

The first of these is correctly closed, but the latter was not. Closing the second instance should ensure underlying Sarama resources are appropriate cleaned up when a processor stops.

Sarama Kafka clients leak several resources (goroutines, metrics,
connections) if not closed properly. A client is created and managed
within the topic manager and therefore a topic manager will leak
resources if not properly closed.

Topic Managers are created in two places:

1. When calling `prepareTopics` while instantiating a new processor.
2. Within `processor.Run`.

The first of these is correctly closed, but the latter was not. Closing
the second instance should ensure underlying Sarama resources are
appropriate cleaned up when a processor stops.
Copy link
Contributor
@frairon frairon left a comment

Choose a reason for hiding this comment

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

awesome, thanks!

Copy link
Contributor
@mmreza79 mmreza79 left a comment

Choose a reason for hiding this comment

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

nice :)

@jalaziz
Copy link
Contributor Author
jalaziz commented Feb 21, 2025

Happy to help! If there's anything else I can do to help get this over the line and released, please let me know 🙏🏼. It was actively affecting some of our workloads, so we'd love to upgrade to a patched version.

@norbertklawikowski norbertklawikowski merged commit 5c19cef into lovoo:master Feb 21, 2025
2 of 4 checks passed
@jalaziz jalaziz deleted the fix-topicmgr-memory-leak branch February 27, 2025 07:21
@jalaziz
Copy link
Contributor Author
jalaziz commented Feb 28, 2025

Just checking if there's a planned release with this fix in the near future? Don't mean to rush a release, just trying to figure out if we should wait for a release or publish or own patched version.

@norbertklawikowski
Copy link
Contributor

@jalaziz Let me check back with @frairon to see if we have everything for the next release, will notify you if we have released a new version.

@norbertklawikowski
Copy link
Contributor

@jalaziz FYI fix is contained in this release: https://github.com/lovoo/goka/releases/tag/v1.1.13 Thanks again for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0