diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | syslogd.c | 19 |
3 files changed, 21 insertions, 2 deletions
@@ -22,6 +22,9 @@ Version 1.17.6 (rgerhards), 2007-07-3? - fixed an invalid value for the MARK timer - unfortunately, there was a testing aid left in place. This resulted in quite frequent MARK messages - added $include config directive +- applied a patch from mildew to prevent rsyslogd from freezing under heavy + load. This could happen when the queue was full. Now, we drop messages + but rsyslogd remains active. --------------------------------------------------------------------------- Version 1.17.5 (rgerhards), 2007-07-30 - continued to work on output module modularization diff --git a/configure.ac b/configure.ac index 24e01f06..1e11c930 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,7 @@ case "${host}" in esac # Checks for libraries. +AC_CHECK_LIB(rt,clock_gettime,,,) # Checks for header files. AC_HEADER_RESOLV @@ -163,6 +163,9 @@ #include <sys/file.h> #include <sys/un.h> #include <sys/time.h> +#ifdef BSD +# include <sys/timespec.h> +#endif #include <sys/resource.h> #include <signal.h> @@ -2510,6 +2513,7 @@ static void *singleWorker() } else { /* the mutex must be unlocked in any case (important for termination) */ pthread_mutex_unlock(fifo->mut); } + if(debugging_on && bGlblDone && !fifo->empty) dprintf("Worker does not yet terminate because it still has messages to process.\n"); } @@ -2536,6 +2540,7 @@ static void enqueueMsg(msg_t *pMsg) { int iRet; msgQueue *fifo = pMsgQueue; + struct timespec t; assert(pMsg != NULL); @@ -2547,12 +2552,22 @@ static void enqueueMsg(msg_t *pMsg) processMsg(pMsg); } else { /* "normal" mode, threading initialized */ - iRet = pthread_mutex_lock(fifo->mut); + pthread_mutex_lock(fifo->mut); + while (fifo->full) { dprintf ("enqueueMsg: queue FULL.\n"); - pthread_cond_wait (fifo->notFull, fifo->mut); + + clock_gettime (CLOCK_REALTIME, &t); + t.tv_sec += 2; + + if(pthread_cond_timedwait (fifo->notFull, + fifo->mut, &t) != 0) { + dprintf("enqueueMsg: cond timeout, dropping message!\n"); + goto unlock; + } } queueAdd(fifo, MsgAddRef(pMsg)); + unlock: /* now activate the worker thread */ pthread_mutex_unlock(fifo->mut); iRet = pthread_cond_signal(fifo->notEmpty); |