-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
C++ consumer APIs have memory leaks under certain conditions #4486
Comments
Tried 2.3.0, have the same leaks. |
We have the same issue using the C API directly. I did a bisect and the problem was introduced with 8e20e1e. If I revert that commit the leaks go away. |
Thanks for the report. In provided stack trace it's just the example that is leaking memory, because the topic isn't destroyed. |
Not just for examples. |
My employer has also tentatively bisected an issue to 8e20e1e. We see that if we have a groupconsumer, and the broker goes down (that is, we shut down the Kafka broker), and then comes back up, and then we try to shut down the groupconsumer, it simply hangs forever. This doesn't reproduce in 1.9.3rc2 or earlier, but it does reproduce in 2.0.0rc1 through 2.3.0. In fact, it appears not to reproduce in a83cadf but to start reproducing with 8e20e1e. I see a lot of separate reporters pointing at #4117 (and the followup #4208), and things like "TODO" appearing in the changelog. Is it possible that those commits weren't reviewed as thoroughly as they should have been? |
…pconsumer We observed that destroying a groupconsumer would often hang waiting for the broker thread to exit. We tediously bisected the problem to the specific commit 8e20e1e (the last commit before the v2.0.0rc1 tag). Only then did we find that a lot of people on GitHub were already complaining about that commit as introducing a resource leak: the commit adds a call to `rd_kafka_toppar_keep` that bumps the refcount of the toppar, and I don't immediately see a corresponding `rd_kafka_toppar_destroy` anywhere. Reverting 8e20e1e (as in this commit) does fix the hang in groupconsumer destruction which we were observing, so we've applied this patch to our downstream library. Fixes confluentinc#4486.
Found and fixed the memory leak that happens in these examples In these examples it doesn't hangs in the destroy call, but only causes a memory leak. |
This seems related #4362 |
Replied on #4669 (comment) |
Description
C++ consumer APIs have memory leaks under certain conditions.
How to reproduce
OS: Linux CentOS 7.9.2009
VERSION: librdkafka 2.1.0
I verified it with examples/rdkafka_example.cpp.
The command line is like:
When the kafka is not started or the topic does not exist, the result is like:
The text was updated successfully, but these errors were encountered: