summaryrefslogtreecommitdiffstats
path: root/runtime/queue.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-11-20 17:01:39 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2013-11-20 17:01:39 +0100
commitede2e4ccf225b6f02312ba7d5523dca8268acd67 (patch)
tree0e3d80d05453c26b1b7f8265d28f39f62b5ccd22 /runtime/queue.c
parente5e8e3b8153d09b8374b3f6f76a6c47dd9e1f0cc (diff)
downloadrsyslog-ede2e4ccf225b6f02312ba7d5523dca8268acd67.tar.gz
rsyslog-ede2e4ccf225b6f02312ba7d5523dca8268acd67.tar.bz2
rsyslog-ede2e4ccf225b6f02312ba7d5523dca8268acd67.zip
regression fix: prevent queue stall if ratelimiter is used
Thanks to Pavel Levshin for alerting us. This regression was introduced roughly 2 hours ago and was never released.
Diffstat (limited to 'runtime/queue.c')
-rw-r--r--runtime/queue.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/runtime/queue.c b/runtime/queue.c
index 5770eae9..0fe95876 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -1680,6 +1680,9 @@ DequeueConsumable(qqueue_t *pThis, wti_t *pWti)
/* The rate limiter
*
+ * IMPORTANT: the rate-limiter MUST unlock and re-lock the queue when
+ * it actually delays processing. Otherwise inputs are stalled.
+ *
* Here we may wait if a dequeue time window is defined or if we are
* rate-limited. TODO: If we do so, we should also look into the
* way new worker threads are spawned. Obviously, it doesn't make much
@@ -1765,8 +1768,10 @@ RateLimiter(qqueue_t *pThis)
}
if(iDelay > 0) {
+ pthread_mutex_unlock(pThis->mut);
DBGOPRINT((obj_t*) pThis, "outside dequeue time window, delaying %d seconds\n", iDelay);
srSleep(iDelay, 0);
+ pthread_mutex_lock(pThis->mut);
}
RETiRet;