-
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
kafkaConsumer fall into an infinite loop #2108
Comments
Good catch! |
close function in KafkaConsumerImpl.cpp fall into an infinite loop too |
edenhill
added a commit
that referenced
this issue
Nov 20, 2018
Thank you @boatfish , will land in master soon. |
edenhill
added a commit
that referenced
this issue
Nov 21, 2018
This was referenced Mar 11, 2019
7 tasks
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Read the FAQ first: https://github.com/edenhill/librdkafka/wiki/FAQ
Description
when use the high level api (class KafkaConsumer) to consume the message, we set a timeout for it, the consumer may fall into an infinite loop in function rd_kafka_q_pop_serve due to the timeout_tspec.tv_nsec is exactly equal 1000 million, which seems cased by the rd_timeout_init_timespec function in rdtime.h.
the code is
static RD_INLINE void rd_timeout_init_timespec (struct timespec *tspec,
int timeout_ms) {
if (timeout_ms == RD_POLL_INFINITE ||
timeout_ms == RD_POLL_NOWAIT) {
tspec->tv_sec = timeout_ms;
tspec->tv_nsec = 0;
} else {
timespec_get(tspec, TIME_UTC);
tspec->tv_sec += timeout_ms / 1000;
tspec->tv_nsec += (timeout_ms % 1000) * 1000000;
if (tspec->tv_nsec > 1000000000) {
tspec->tv_nsec -= 1000000000;
tspec->tv_sec++;
}
}
}
is that the "if (tspec->tv_nsec > 1000000000)" need to be amend to “if (tspec->tv_nsec >= 1000000000)” ?
How to reproduce
<your steps how to reproduce goes here, or remove section if not relevant>
IMPORTANT: Always try to reproduce the issue on the latest released version (see https://github.com/edenhill/librdkafka/releases), if it can't be reproduced on the latest version the issue has been fixed.
Checklist
IMPORTANT: We will close issues where the checklist has not been completed.
Please provide the following information:
<REPLACE with e.g., v0.10.5 or a git sha. NOT "latest" or "current">
<REPLACE with e.g., 0.10.2.3>
<REPLACE with e.g., message.timeout.ms=123, auto.reset.offset=earliest, ..>
<REPLACE with e.g., Centos 5 (x64)>
debug=..
as necessary) from librdkafkaThe text was updated successfully, but these errors were encountered: