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

Adding a produce() flag to free msg_opaque (like RD_KAFKA_MSG_F_FREE) #3192

Closed
2 tasks done
arnaud-lb opened this issue Dec 28, 2020 · 5 comments
Closed
2 tasks done

Comments

@arnaud-lb
Copy link
Contributor

Description

In bindings for memory managed languages, freeing a msg_opaque is tricky.

Adding a flag to rd_kafka_produce() that allows librdkafka to free the msg_opaque, as RD_KAFKA_MSG_F_FREE does for the payload, would be very helpful.

The flag could be named RD_KAFKA_MSG_OPAQUE_F_FREE, and passing it to rd_kafka_produce() and variants would cause rd_kafka_msg_destroy() to free ->rkm_opaque.

Would you accept a PR with this change?

Checklist

  • librdkafka version: e116a873bbe395b78d3b40171afa9c68dc93da78
  • Feature request
@edenhill
Copy link
Contributor

Why can't you free it in the delivery report callback?

@arnaud-lb
Copy link
Contributor Author

We could, but will it be called in all cases, including when the rd_kafka_t is destroyed while a message is still queued ?

@arnaud-lb
Copy link
Contributor Author

Actually I could handle this by keeping track of inflight msg_opaques and free them after rd_kafka_destroy()

@edenhill
Copy link
Contributor

edenhill commented Dec 28, 2020 via email

@arnaud-lb
Copy link
Contributor Author

Oh, this is perfect! Thanks :)

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

No branches or pull requests

2 participants