Skip to content

remove poll #276

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

Closed
wants to merge 4 commits into from
Closed

Conversation

nick-zh
Copy link
Collaborator

@nick-zh nick-zh commented Sep 5, 2019

@nick-zh
Copy link
Collaborator Author

nick-zh commented Sep 5, 2019

Salut @arnaud-lb

I think this is related to #196 since the core dump happens during the destruct as well (i might be wrong though). I removed poll for high level as well, in my PR i only did it for low level producer / consumer.

From what i read here:
https://github.com/edenhill/librdkafka/wiki/Proper-termination-sequence#producers-and-simple-legacy-consumers
It seems poll is only used for those two for proper shutdown anyway.
In the high level section:
https://github.com/edenhill/librdkafka/wiki/Proper-termination-sequence#high-level-kafkaconsumer
It is only mentioned, that we need to call rd_kafka_consumer_close and rd_kafka_destroy which we do.

I found that rd_kafka_consumer_close already does a poll itself:
https://github.com/edenhill/librdkafka/blob/master/src/rdkafka.c#L2873
From the comment here, i see that rebalance_cb or others could still be called if set:
https://github.com/edenhill/librdkafka/blob/master/src/rdkafka.h#L2480

Maybe this is unsafe to do in the destructor, what do you think? It seems this exactly what is happening in the issue mentioned, callback is called but killed during execution time.

I think from what i gathered we could avoid the callbacks being called by setting the destroy flag properly:

rd_kafka_destroy_flags(intern->rk, RD_KAFKA_DESTROY_F_NO_CONSUMER_CLOSE);

rd_kafka_destroy_flags also calls rd_kafka_consumer_close but sets the flag accordingly beforehand.

Reference: https://github.com/edenhill/librdkafka/blob/master/src/rdkafka.h#L2516

@nick-zh
Copy link
Collaborator Author

nick-zh commented Sep 12, 2019

closing this since doing it as in #278 doesn't rely on a specific version of librdkafka, since any version prior to 0.11.6 is not able to do it in the way proposed here

@nick-zh nick-zh closed this Sep 12, 2019
@nick-zh nick-zh deleted the remove-poll-from-high-level-consumer-destruct branch September 12, 2019 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant