summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-03-19 07:37:56 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2010-03-19 07:37:56 +0100
commit3e0578605f7df8427aa5b70c2b4396504113fafc (patch)
tree39df3fbe362c46b1f00e699c9d33431deae0c9c7
parent44f670848a87fc59bffc0b8f433a2e2c798dc176 (diff)
downloadrsyslog-3e0578605f7df8427aa5b70c2b4396504113fafc.tar.gz
rsyslog-3e0578605f7df8427aa5b70c2b4396504113fafc.tar.xz
rsyslog-3e0578605f7df8427aa5b70c2b4396504113fafc.zip
bugfix: potential hang condition during filestream close
predicate was not properly checked when waiting for the background file writer
-rw-r--r--ChangeLog3
-rw-r--r--runtime/stream.c10
2 files changed, 9 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index b00965c4..672c69ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@ Version 4.6.2 [v4-stable] (rgerhards), 2010-03-??
to ease migration from syslog-ng. See property replacer doc for
details. [backport from 5.5.3 because urgently needed by some]
- improved testbench
+- bugfix: potential hang condition during filestream close
+ predicate was not properly checked when waiting for the background file
+ writer
- bugfix: improper synchronization when "$OMFileFlushOnTXEnd on" was used
Internal data structures were not properly protected due to missing
mutex calls.
diff --git a/runtime/stream.c b/runtime/stream.c
index 93f7fd58..88606db7 100644
--- a/runtime/stream.c
+++ b/runtime/stream.c
@@ -163,7 +163,7 @@ doSizeLimitProcessing(strm_t *pThis)
ASSERT(pThis->fd != -1);
if(pThis->iCurrOffs >= pThis->iSizeLimit) {
- /* strmClosefile() destroys the current file name, so we
+ /* strmCloseFile() destroys the current file name, so we
* need to preserve it.
*/
CHKmalloc(pszCurrFName = ustrdup(pThis->pszCurrFName));
@@ -296,8 +296,10 @@ strmWaitAsyncWriterDone(strm_t *pThis)
BEGINfunc
if(pThis->bAsyncWrite) {
/* awake writer thread and make it write out everything */
- pthread_cond_signal(&pThis->notEmpty);
- d_pthread_cond_wait(&pThis->isEmpty, &pThis->mut);
+ while(pThis->iCnt > 0) {
+ pthread_cond_signal(&pThis->notEmpty);
+ d_pthread_cond_wait(&pThis->isEmpty, &pThis->mut);
+ }
}
ENDfunc
}
@@ -944,7 +946,7 @@ dbgprintf("XXX: asyncWriterThread iterating %s\n", pThis->pszFName);
continue; /* now we should have data */
}
bTimedOut = 0;
- timeoutComp(&t, pThis->iFlushInterval * 2000); /* *1000 millisconds */
+ timeoutComp(&t, pThis->iFlushInterval * 2000); /* *1000 millisconds */ // TODO: check the 2000?!?
if(pThis->bDoTimedWait) {
dbgprintf("asyncWriter thread going to timeout sleep\n");
if(pthread_cond_timedwait(&pThis->notEmpty, &pThis->mut, &t) != 0) {