summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2012-07-24 11:11:39 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2012-07-24 11:11:39 +0200
commit8805b0f25ff1409a41ecc2e054896e653e4cfa55 (patch)
tree8af18a5d36dc1b619ad81900305699e02c314a5c
parent33acb956db2824a118656021d873143ff1475321 (diff)
downloadrsyslog-8805b0f25ff1409a41ecc2e054896e653e4cfa55.tar.gz
rsyslog-8805b0f25ff1409a41ecc2e054896e653e4cfa55.tar.xz
rsyslog-8805b0f25ff1409a41ecc2e054896e653e4cfa55.zip
bugfix: DA queue could cause abort
...due to invalid mutex synchronisation in DA worker. In case of idle queue, mutex was incorrectly locked.
-rw-r--r--ChangeLog1
-rw-r--r--runtime/queue.c8
2 files changed, 6 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 23c55ce8..d12e14c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
---------------------------------------------------------------------------
Version 5.8.13 [V5-stable] 2012-06-??
+- bugfix: DA queue could cause abort
- bugfix: "last message repeated n times" message was missing hostname
Thanks to Zdenek Salvet for finding this bug and to Bodik for reporting
- bugfix "$PreserveFQDN on" was not honored in some modules
diff --git a/runtime/queue.c b/runtime/queue.c
index d78ab2e3..280ebd94 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -1743,6 +1743,7 @@ ConsumerDA(qqueue_t *pThis, wti_t *pWti)
{
int i;
int iCancelStateSave;
+ int bNeedReLock = 0; /**< do we need to lock the mutex again? */
DEFiRet;
ISOBJ_TYPE_assert(pThis, qqueue);
@@ -1752,6 +1753,7 @@ ConsumerDA(qqueue_t *pThis, wti_t *pWti)
/* we now have a non-idle batch of work, so we can release the queue mutex and process it */
d_pthread_mutex_unlock(pThis->mut);
+ bNeedReLock = 1;
/* at this spot, we may be cancelled */
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &iCancelStateSave);
@@ -1770,10 +1772,10 @@ ConsumerDA(qqueue_t *pThis, wti_t *pWti)
/* but now cancellation is no longer permitted */
pthread_setcancelstate(iCancelStateSave, NULL);
- /* now we are done, but need to re-aquire the mutex */
- d_pthread_mutex_lock(pThis->mut);
-
finalize_it:
+ /* now we are done, but potentially need to re-aquire the mutex */
+ if(bNeedReLock)
+ d_pthread_mutex_lock(pThis->mut);
DBGOPRINT((obj_t*) pThis, "DAConsumer returns with iRet %d\n", iRet);
RETiRet;
}