Skip to content

Destroy rd_kafka_t handle on consumer.close() (#30) #33

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
Aug 23, 2016

Conversation

edenhill
Copy link
Contributor

Solves issue #30


CallState_begin(self, &cs);

rd_kafka_consumer_close(self->rk);

if (!CallState_end(self, &cs))
raise = !CallState_end(self, &cs);
Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding of the behavior here is that we essentially want to do the equivalent of Consumer_dealloc, but as far as I can tell, the rd_kafka_destroy is only a fraction of what should actually be done? Why isn't the full Consumer_clear (or more completely, Consumer_dealloc) performed? In particular, since the full Consumer_clear is not performed, doesn't this mean we'll leave some callbacks un-decref'd?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, almost, dealloc() is eventually triggered by the GC and I left it for that to clean up any lingering objects (such as callbacks), but they will be cleaned up on the next GC spin.

We could call cleanup from close() as an optimization to speed up GC, apart from that there shouldnt be any functional differences.
What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

@edenhill Hmm, I guess it doesn't matter much then. Seems fine as is and this LGTM.

@edenhill edenhill merged commit 3ee33f0 into master Aug 23, 2016
@ewencp ewencp deleted the destroy_on_close branch October 4, 2016 05:40
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