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-3690: Fix observation leak in the KafkaMessageListenerContainer #3694

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

artembilan
Copy link
Member

Fixes: #3690

When this.listener is an instance of RecordMessagingMessageListenerAdapter, we rely on its logic to call invoke() from super class to handle observation lifecycle this or other way.
However, Spring Integration's KafkaMessageDrivenChannelAdapter use its own IntegrationRecordMessageListener extension of the RecordMessagingMessageListenerAdapter without calling super invoke().
The problem apparent from Spring Cloud Stream Kafka Binder, where an observation is enabled.

  • Fix KafkaMessageListenerContainer to check for exact type of this.listener before making decision to close an observation here, or propagate it down to the RecordMessagingMessageListenerAdapter

…enerContainer`

Fixes: spring-projects#3690

When `this.listener` is an instance of `RecordMessagingMessageListenerAdapter`,
we rely on its logic to call `invoke()` from super class to handle observation
lifecycle this or other way.
However, Spring Integration's `KafkaMessageDrivenChannelAdapter` use its own
`IntegrationRecordMessageListener` extension of the `RecordMessagingMessageListenerAdapter`
without calling super `invoke()`.
The problem apparent from Spring Cloud Stream Kafka Binder, where an observation is enabled.

* Fix `KafkaMessageListenerContainer` to check for exact type of `this.listener`
before making decision to close an observation here, or propagate it down to the `RecordMessagingMessageListenerAdapter`
@sobychacko sobychacko merged commit c9e7edc into spring-projects:main Dec 23, 2024
3 checks 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
Development

Successfully merging this pull request may close these issues.

Memory leak on a Kafka Observation due to the metric "spring.kafka.listener.active"
2 participants