-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Query on Async programming (Seastar) with librdkafka #2292
Comments
I am able to resolve the issue by passing consumer object in the lamda function (above code is in lambda) as pass by value (earlier, I passed by reference)... but when consumer->close() is called, it crashes with below trace in the function RdKafka::rebalance_cb_trampoline at HandleImpl.cpp:182... Any idea why it could be? #0 0x00000000005eea1e in RdKafka::rebalance_cb_trampoline(rd_kafka_s*, rd_kafka_resp_err_t, rd_kafka_topic_partition_list_s*, void*) |
I've never used seastar so I can't help with that, but the crash looks like your RebalanceCb instance has been freed/gone-out-of-scope prior to the Consumer object, which it must outlive. |
Description
We are trying to embed librdkafka client in Seastar framework for achieving high performance of the product. Reading and writing into Kafka queue is part of processing of message in our product.
How compatible is librdkafka with parallel way (async) of programming using Seastar(https://github.com/scylladb/seastar)? I am trying the simple kafka consumer (rd_kafka_consumer_cpp) in Seastar framework. I have replaced the while loop with Seastar do_until loop technique. At the place where consume() function is called, it crashes. Need to understand why it is crashing and how it is related to parallel async programming?
Doesn't crash
while (run) {
std::cerr << "% Inside while Consumed " << msg_cnt << " messages (" << msg_bytes << " bytes)" << std::endl;
RdKafka::Message *msg = consumer->consume(1000);
msg_consume(msg, NULL);
delete msg;
}
Crashes:
return seastar::do_until([&run] { return run; }, [&run, &consumer] {
RdKafka::Message *msg = consumer->consume(1000); // CRASHES HERE after two loops
msg_consume(msg, NULL);
delete msg;
return seastar::make_ready_future<>();
}).finally(&consumer{
}
How to reproduce
Embedded the rd_kafka_consumer_cpp code into Seastar framework and executed the program.
Any help in this regard would be appreciated.
The text was updated successfully, but these errors were encountered: