Skip to content

Commit

Permalink
Reset rkb_blocking_max_ms on broker DOWN to avoid busy-loop during CO…
Browse files Browse the repository at this point in the history
  • Loading branch information
edenhill authored and Daniel Woodlins committed Nov 6, 2017
1 parent 13c27d5 commit 9de4c43
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/rdkafka_broker.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,15 @@ void rd_kafka_broker_fail (rd_kafka_broker_t *rkb,
rkb->rkb_recv_buf = NULL;
}

/* Reset max blocking time back to the default to avoid busy-looping
* on reconnect if blocking=0 (#1397).
* But honour the lower on-termination blocking time. */
if (rd_kafka_terminating(rkb->rkb_rk))
rkb->rkb_blocking_max_ms = 1;
else
rkb->rkb_blocking_max_ms =
rkb->rkb_rk->rk_conf.socket_blocking_max_ms;

rd_kafka_broker_lock(rkb);

/* The caller may omit the format if it thinks this is a recurring
Expand Down

0 comments on commit 9de4c43

Please sign in to comment.