summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Heinrich <theinric@redhat.com>2013-06-08 23:27:48 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2013-06-10 08:06:36 +0200
commit573e3fb27c6521255a687da9321a9ecc7ce634ef (patch)
tree0d39858813f55f6cfe2277d4bcd89d4ada973b61
parentfc72c6cccc1e1e267c063e384a900a8987a8f14e (diff)
downloadrsyslog-573e3fb27c6521255a687da9321a9ecc7ce634ef.tar.gz
rsyslog-573e3fb27c6521255a687da9321a9ecc7ce634ef.tar.bz2
rsyslog-573e3fb27c6521255a687da9321a9ecc7ce634ef.zip
bugfix: prevent an endless loop in the ratelimiter
If messages are being dropped because of ratelimiting, an internal message is generated to inform about this fact. This should happen only uppon the firs occurance but the counter that tracks the number of dropped messages was incremented only after sending the message. If the message itself gets ratelimited, an endless loop spins out of control. Thanks to Jerry James for notifying about this.
-rw-r--r--runtime/ratelimit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/ratelimit.c b/runtime/ratelimit.c
index d83da2dd..ec248550 100644
--- a/runtime/ratelimit.c
+++ b/runtime/ratelimit.c
@@ -167,13 +167,13 @@ withinRatelimit(ratelimit_t *ratelimit, time_t tt)
ratelimit->done++;
ret = 1;
} else {
- if(ratelimit->missed == 0) {
+ ratelimit->missed++;
+ if(ratelimit->missed == 1) {
snprintf((char*)msgbuf, sizeof(msgbuf),
"%s: begin to drop messages due to rate-limiting",
ratelimit->name);
logmsgInternal(RS_RET_RATE_LIMITED, LOG_SYSLOG|LOG_INFO, msgbuf, 0);
}
- ratelimit->missed++;
ret = 0;
}