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

GH-3062: Fix KafkaBinderMetrics for resource leaks #3064

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

artembilan
Copy link
Contributor

Fixes: #3062

The KafkaBinderMetrics creates KafkaConsumer instances and schedule the fix rate task for them, but never closes them even when the scheduler is shut downed

  • Implement a Lifecycle contract in the KafkaBinderMetrics and call close() from the stop() to satisfy CRaC resource management expectations.
  • Also close all the KafkaConsumer instances from the metadataConsumers

Cherry-pick to 4.1.x

Fixes: spring-cloud#3062

The `KafkaBinderMetrics` creates `KafkaConsumer` instances and schedule the fix rate
task for them, but never closes them even when the `scheduler` is shut downed

* Implement a `Lifecycle` contract in the `KafkaBinderMetrics` and call `close()`
from the `stop()` to satisfy CRaC resource management expectations.
* Also close all the `KafkaConsumer` instances from the `metadataConsumers`

**Cherry-pick to `4.1.x`**
@artembilan artembilan marked this pull request as draft January 7, 2025 14:58
@artembilan
Copy link
Contributor Author

Do not merge yet.
Apparently something else is missing.
Will look later today after my doc appointment.

When CRaC checkpoint is requested, the binder contexts must be stopped as well,
which includes all their managed beans, respectively.
@artembilan artembilan marked this pull request as ready for review January 7, 2025 19:24
@olegz olegz merged commit 70b8037 into spring-cloud:main Jan 8, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants