File syslog-ng-2.0.9-mark_freq-flood.diff of Package syslog-ng
commit 79de86eb23f7ca06cfe8abd1ebfcd72c419bd2cd
Author: Balazs Scheidler <bazsi@balabit.hu>
Date: Fri Aug 6 13:36:21 2010 +0200
mark_freq: fixed 100% CPU usage when mark_freq() is changed to 0 during a SIGHUP
If mark_freq() is set to 0 from a non-zero value and syslog-ng receives
a SIGHUP, it started spinning and emitting MARK messages like crazy.
This patch reinitializes the next_mark_target variable on SIGHUP which causes
it to behave normally.
Reported-By: Yann Ilas, Marius Tomaschewski
Index: syslog-ng-2.0.9/src/afinter.c
===================================================================
--- syslog-ng-2.0.9.orig/src/afinter.c
+++ syslog-ng-2.0.9/src/afinter.c
@@ -137,6 +137,7 @@ afinter_source_watch_new(LogPipe *pipe,
{
AFInterWatch *self = (AFInterWatch *) g_source_new(&afinter_source_watch_funcs, sizeof(AFInterWatch));
+ next_mark_target = -1;
self->mark_freq = mark_freq;
g_source_set_callback(&self->super, (GSourceFunc) afinter_source_dispatch_msg, log_pipe_ref(pipe), (GDestroyNotify) log_pipe_unref);
return &self->super;