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 leak in storeOffsetMessage and storeOffsets #199

Merged
merged 1 commit into from
Mar 10, 2024

Conversation

lazamar
Copy link
Contributor

@lazamar lazamar commented Mar 8, 2024

The use of toNativeTopicPartitionListNoDispose in Kafka.Consumer.storeOffsetMessage and storeOffsets left the partition lists in memory indefinitely as there is no foreign pointer finaliser attached and the list isn't explicitly freed afterwards.
This was causing OOMs in my application every few hours.

I confirmed that using toNativeTopicPartitionList instead fixes the issue and is also in line with how these lists are handled in librdkafka (example) by being destroyed after calls to rd_kafka_offsets_store.

This PR applies the fix to storeOffsetMessage and storeOffsets.

@AlexeyRaga AlexeyRaga merged commit 17451f5 into haskell-works:main Mar 10, 2024
8 checks passed
@AlexeyRaga
Copy link
Member

Thanks @lazamar! :)

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.

2 participants