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

On kafka_topic_map_ and destructors #4

Open
javierguerragiraldez opened this issue May 18, 2017 · 0 comments
Open

On kafka_topic_map_ and destructors #4

javierguerragiraldez opened this issue May 18, 2017 · 0 comments

Comments

@javierguerragiraldez
Copy link

Hi.

As far as I can tell, the kafka_topic_map_ table is used only to relate the topics created with each producer, so that they can be destroyed before the producer. but:

  1. it uses the rd_kafka_t cdata object as the table key; but that's specifically advised against in the FFI docs:

Lua tables may be indexed by cdata objects, but this doesn't provide any useful semantics — cdata objects are unsuitable as table keys!

I guess in this specific case it's workable, since the only library function that returns a rd_kafka_t pointer is the creator, so there shouldn't be two different cdata objects with the same content. Still, it's a fragile situation.

  1. kafka_topic_map_ is a regular, strong, Lua table; so the rd_kafka_t cdata objects registered there won't be GC'ed, even if the producer Lua wrapper is collected. Effectively, it's made useless by its own existence.
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

1 participant