Skip to content

Query on Async programming (Seastar) with librdkafka #2292

@pradeepp2019

Description

@pradeepp2019

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions