diff -Nru librdkafka-0.11.6/debian/changelog librdkafka-0.11.6/debian/changelog --- librdkafka-0.11.6/debian/changelog 2018-11-04 17:41:48.000000000 +0000 +++ librdkafka-0.11.6/debian/changelog 2020-06-30 07:05:00.000000000 +0000 @@ -1,3 +1,13 @@ +librdkafka (0.11.6-1.1wmf1) buster-wikimedia; urgency=medium + + * Add 672dbf42d2, which applies cleanly to 0.11.6 as + debian/patches/fix-timespec-conversion.diff. Backport d62dd0e7 + as cnd-timewait-abs-logic.diff. Both patches might address the infinite + loop bug polling for messages we have seen in production with purged + (Bug: T256444) + + -- Emanuele Rocca Tue, 30 Jun 2020 07:05:00 +0000 + librdkafka (0.11.6-1.1) unstable; urgency=medium * Non-maintainer upload. diff -Nru librdkafka-0.11.6/debian/patches/cnd-timewait-abs-logic.diff librdkafka-0.11.6/debian/patches/cnd-timewait-abs-logic.diff --- librdkafka-0.11.6/debian/patches/cnd-timewait-abs-logic.diff 1970-01-01 00:00:00.000000000 +0000 +++ librdkafka-0.11.6/debian/patches/cnd-timewait-abs-logic.diff 2020-06-30 07:05:00.000000000 +0000 @@ -0,0 +1,31 @@ +Description: backport of patch d62dd0e7 +Author: Emanuele Rocca +Origin: https://github.com/edenhill/librdkafka/commit/d62dd0e7f16cde184e7c809a01ed5aa06861b660 +From d62dd0e7f16cde184e7c809a01ed5aa06861b660 Mon Sep 17 00:00:00 2001 +From: Roger Clermont +Date: Thu, 31 Jan 2019 02:23:52 +0000 +Subject: [PATCH] Revise logic for testing retval of cnd_timedwait_abs() to + account for conditions other than timeout. + +--- librdkafka-0.11.6.orig/src/rdkafka_queue.c ++++ librdkafka-0.11.6/src/rdkafka_queue.c +@@ -372,8 +372,8 @@ rd_kafka_op_t *rd_kafka_q_pop_serve (rd_ + + if (cnd_timedwait_abs(&rkq->rkq_cond, + &rkq->rkq_lock, +- &timeout_tspec) == +- thrd_timedout) { ++ &timeout_tspec) != ++ thrd_success) { + mtx_unlock(&rkq->rkq_lock); + return NULL; + } +@@ -530,7 +530,7 @@ int rd_kafka_q_serve_rkmessages (rd_kafk + + while (!(rko = TAILQ_FIRST(&rkq->rkq_q)) && + cnd_timedwait_abs(&rkq->rkq_cond, &rkq->rkq_lock, +- &timeout_tspec) != thrd_timedout) ++ &timeout_tspec) == thrd_success) + ; + + if (!rko) { diff -Nru librdkafka-0.11.6/debian/patches/fix-timespec-conversion.diff librdkafka-0.11.6/debian/patches/fix-timespec-conversion.diff --- librdkafka-0.11.6/debian/patches/fix-timespec-conversion.diff 1970-01-01 00:00:00.000000000 +0000 +++ librdkafka-0.11.6/debian/patches/fix-timespec-conversion.diff 2020-06-30 07:05:00.000000000 +0000 @@ -0,0 +1,25 @@ +Origin: https://github.com/edenhill/librdkafka/commit/672dbf42d2a0ab8694be160740dad48554178a7c +From 672dbf42d2a0ab8694be160740dad48554178a7c Mon Sep 17 00:00:00 2001 +From: Magnus Edenhill +Date: Tue, 20 Nov 2018 10:18:39 +0100 +Subject: [PATCH] Fix timespec conversion to avoid infinite loop (#2108, + @boatfish) + +Identified and proposed fix by @boatfish +--- + src/rdtime.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: librdkafka-0.11.6/src/rdtime.h +=================================================================== +--- librdkafka-0.11.6.orig/src/rdtime.h ++++ librdkafka-0.11.6/src/rdtime.h +@@ -172,7 +172,7 @@ static RD_INLINE void rd_timeout_init_ti + timespec_get(tspec, TIME_UTC); + tspec->tv_sec += timeout_ms / 1000; + tspec->tv_nsec += (timeout_ms % 1000) * 1000000; +- if (tspec->tv_nsec > 1000000000) { ++ if (tspec->tv_nsec >= 1000000000) { + tspec->tv_nsec -= 1000000000; + tspec->tv_sec++; + } diff -Nru librdkafka-0.11.6/debian/patches/series librdkafka-0.11.6/debian/patches/series --- librdkafka-0.11.6/debian/patches/series 2018-11-04 17:41:18.000000000 +0000 +++ librdkafka-0.11.6/debian/patches/series 2020-06-30 07:05:00.000000000 +0000 @@ -1 +1,3 @@ hurd.diff +cnd-timewait-abs-logic.diff +fix-timespec-conversion.diff