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

Segfault in NativeClient::rebalance_protocol #416

Closed
bruceg opened this issue Dec 29, 2021 · 3 comments · Fixed by #417
Closed

Segfault in NativeClient::rebalance_protocol #416

bruceg opened this issue Dec 29, 2021 · 3 comments · Fixed by #417

Comments

@bruceg
Copy link
Contributor

bruceg commented Dec 29, 2021

We are seeing a sporadic segfault when handling rebalance events in our kafka client. I have traced this down to a null pointer being passed to CStr::from_ptr. It appears that rdsys::rd_kafka_rebalance_protocol can return a null pointer in some circumstances and the Rust library doesn't handle that. I have worked around it by returning RebalanceProtocol::None when this happens, but I don't know if there is a better solution or a deeper underlying problem.

@benesch
Copy link
Collaborator

benesch commented Dec 29, 2021

Oy, yeah, looks like that's how it signals errors. None seems about right. The C example that I copied the incremental stuff from passes the return value to strcmp, which ignores any distinction between NULL and "NONE": https://github.com/edenhill/librdkafka/blob/f092c290995ca81b3afb4015fcc3350ba02caa96/examples/rdkafka_complex_consumer_example.c#L218

@benesch
Copy link
Collaborator

benesch commented Dec 29, 2021

Would you be up for submitting a PR?

@bruceg
Copy link
Contributor Author

bruceg commented Dec 29, 2021

Sure, coming right up.

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 a pull request may close this issue.

2 participants