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

Free payload memory in rd_kafka_example when queue is full #11

Closed
wants to merge 5 commits into from
Closed

Conversation

ZhuYouzhi
Copy link
Contributor

Hi, Edenhill. I've learned a lot from discussion with you yesterday.

This patch is try to improve rd_kafka_example a little:

When queue is full due to max_outq_msg_cnt limit, opbuf is allocated but has no chance to deallocate in current code, and this patch fix this problem.

I'm not sure whether behavior in this patch is a little contradictory to RD_KAFKA_OP_F_FREE parameter in semantic. Realization in rd_kafka_produce prevent op_destroy to take effect.
int rd_kafka_produce (rd_kafka_t *rk, char *topic, uint32_t partition,
int msgflags,
char *payload, size_t len) {
rd_kafka_op_t *rko;

if (rk->rk_conf.producer.max_outq_msg_cnt &&
    rk->rk_op.rkq_qlen >= rk->rk_conf.producer.max_outq_msg_cnt) {
    errno = ENOBUFS;
    return -1;
}

@edenhill
Copy link
Contributor

edenhill commented Jun 4, 2013

Can you create a new pull request containing only the fixes for rdkafka_example* and rdkafkacpp.h?
This pull request is a bit messy.

@edenhill edenhill closed this Jun 4, 2013
@winbatch winbatch mentioned this pull request Feb 11, 2014
@vdeters vdeters mentioned this pull request Apr 12, 2016
@yanzhiqiang yanzhiqiang mentioned this pull request Oct 20, 2016
9 tasks
@longtong longtong mentioned this pull request Sep 27, 2016
9 tasks
@greatt1n greatt1n mentioned this pull request Jan 16, 2017
@DavidLiuXh DavidLiuXh mentioned this pull request Apr 26, 2017
9 tasks
@vk-coder vk-coder mentioned this pull request May 16, 2018
7 tasks
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.

None yet

2 participants