-
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
Spurious EoF from C++ API #182
Comments
Sounds like you are starting to read from the last offset, so you will only get the last message and then EOF. Is this correct? |
Nope; I read starting from unread messages; model situation: Sometimes it happens after several successful batches... |
Huhm, are you creating and destroying (or start stopping) your consumer between batches? |
No, sorry, I mislead you, here; the topic and consumer is cached throughout the process life. Is that wrong, maybe? Basically, my program is a system service that is triggered (by a client), a new processing instance that reads all the newly produced messages and does some job.
Receiving a message:
|
Another weird observation: If there's no new message in the queue between the batches, I mostly get the last one (over and over again) and sometimes get timeout, instead. |
kafkacat doesn't seem to suffer from such problems, however. |
Is this reproducible with examples/rdkafka_example_cpp? |
Doesn't seem so; let me go through the example code and compare it with mine... |
Yes, every 5 minutes (i.e. every batch). Is that right or wrong? |
I guess that was a reply to the comment I mistakenly removed asking if you were start/stopping your consumer repeatedly? |
And, btw, I'm consuming/producing from/to multiple different queues (topics). |
Yup, I start/stop the consumer before/after each batch. |
Unless you are going to jump to a different offset (rather than the next one) you shouldn't start/stop your consumer, just keep it idling until you need it again. |
OK |
Stupid, but perhaps key question; do I need separate topic config object per every topic? |
In the C API: Yes, the config objects are taken over by the API when you pass them. In the C++ API: No, config objects are reusable. |
So the problem with repeated reading of the last message in the queue seems to have disappeared (although I seem to get RdKafka::ERR__TIMED_OUT return status rather than RdKafka::ERR__PARTITION_EOF which I'd expect). |
But I guess that's because I use timeout of 0. |
Is getting TIMED_OUT rather than PARTITION_EOF a problem for you? |
No, it's not a problem (just noted that in case it'd be relevant). |
Okay, so the message replay is gone now, do you have any idea why? |
Well, I did what you've advised: I'm now starting the consumer just once and leave it idle between the batches... |
Okay, so there is a bug in the restart code somewhere, I'll look into it. |
Unfortunately, the component that feeds me with the messages is currently down, so I can't see if the original issue is still emerging (no new messages are coming). |
Thanks a lot |
I was just able to reproduce the behaviour described above with a small modification of the rdkafka_example.cpp code (see the -B and -T options added):
|
I run the consumer with -B 100 (100 seconds wait between the batches) and -T 0 (timeout of 0). |
Big thanks for providing a reproducable patch, much kudos! |
Hi, sorry to bother you; any news on the issue? Can I help in any way? |
Sorry for the delay, I have reproduced the issue but have not sorted it out yet. Will take a closer look tomorrow. |
No problem, thanks. |
Fixed on master |
I am facing the same issue that C++ consumer API is returning with EOF and consuming fewer (1, 2) messages though queue has many messages. Can you let me know what is the version which contains the fix for the problem. Help is much appreciated. |
@maharajan1 what version are you on now? |
I am using version. librdkafka_2.10-0.8.2.1. Thanks for reply! |
I'm having trouble reading from queue; sometimes (the problem doesn't seem to be really deterministic, it emerges erratically) I get into a situation where I only can read 1 message and a second attempt ends with EoF (empty queue), although it's positively full of messages.
I read the queue starting with saved msgs.
When I re-create the consumer, then again, I read one message and the get an EoF.
When I re-start the whole process, I can read normally.
The text was updated successfully, but these errors were encountered: