diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-03-19 07:37:56 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-03-19 07:37:56 +0100 |
commit | 3e0578605f7df8427aa5b70c2b4396504113fafc (patch) | |
tree | 39df3fbe362c46b1f00e699c9d33431deae0c9c7 /runtime | |
parent | 44f670848a87fc59bffc0b8f433a2e2c798dc176 (diff) | |
download | rsyslog-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
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/stream.c | 10 |
1 files changed, 6 insertions, 4 deletions
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) { |