mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-22 10:40:42 +01:00
bugfix: dynafile zip files could be corrupted
This could happen if a dynafile was destructed before the first write. In practice, this could happen if few lines were written to a file and it then became evicted from the dynafile cache. This would probably look very random, because it depended on the timing in regard to message volume and dynafile cache size.
This commit is contained in:
parent
9ab1503180
commit
557f20f841
@ -1,3 +1,9 @@
|
|||||||
|
- bugfix: dynafile zip files could be corrupted
|
||||||
|
This could happen if a dynafile was destructed before the first write.
|
||||||
|
In practice, this could happen if few lines were written to a file and
|
||||||
|
it then became evicted from the dynafile cache. This would probably
|
||||||
|
look very random, because it depended on the timing in regard to
|
||||||
|
message volume and dynafile cache size.
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
Version 7.3.2 [devel] 2012-10-30
|
Version 7.3.2 [devel] 2012-10-30
|
||||||
- mmnormalize: support for v6+ config interface added
|
- mmnormalize: support for v6+ config interface added
|
||||||
|
|||||||
@ -343,6 +343,9 @@ static rsRetVal strmCloseFile(strm_t *pThis)
|
|||||||
|
|
||||||
if(pThis->tOperationsMode != STREAMMODE_READ) {
|
if(pThis->tOperationsMode != STREAMMODE_READ) {
|
||||||
strmFlushInternal(pThis, 0);
|
strmFlushInternal(pThis, 0);
|
||||||
|
if(pThis->iZipLevel) {
|
||||||
|
doZipFinish(pThis);
|
||||||
|
}
|
||||||
if(pThis->bAsyncWrite) {
|
if(pThis->bAsyncWrite) {
|
||||||
strmWaitAsyncWriterDone(pThis);
|
strmWaitAsyncWriterDone(pThis);
|
||||||
}
|
}
|
||||||
@ -780,9 +783,6 @@ BEGINobjDestruct(strm) /* be sure to specify the object type also in END and COD
|
|||||||
int i;
|
int i;
|
||||||
CODESTARTobjDestruct(strm)
|
CODESTARTobjDestruct(strm)
|
||||||
/* we need to stop the ZIP writer */
|
/* we need to stop the ZIP writer */
|
||||||
if(pThis->iZipLevel) {
|
|
||||||
doZipFinish(pThis);
|
|
||||||
}
|
|
||||||
if(pThis->bAsyncWrite)
|
if(pThis->bAsyncWrite)
|
||||||
/* Note: mutex will be unlocked in stopWriter! */
|
/* Note: mutex will be unlocked in stopWriter! */
|
||||||
d_pthread_mutex_lock(&pThis->mut);
|
d_pthread_mutex_lock(&pThis->mut);
|
||||||
@ -1231,11 +1231,9 @@ doZipFinish(strm_t *pThis)
|
|||||||
unsigned outavail;
|
unsigned outavail;
|
||||||
assert(pThis != NULL);
|
assert(pThis != NULL);
|
||||||
|
|
||||||
if(!pThis->bzInitDone) {
|
if(!pThis->bzInitDone)
|
||||||
FINALIZE;
|
goto done;
|
||||||
}
|
|
||||||
|
|
||||||
dbgprintf("AAAA: doZipFinish() called\n");
|
|
||||||
pThis->zstrm.avail_in = 0;
|
pThis->zstrm.avail_in = 0;
|
||||||
/* run deflate() on buffer until everything has been compressed */
|
/* run deflate() on buffer until everything has been compressed */
|
||||||
do {
|
do {
|
||||||
@ -1257,7 +1255,7 @@ finalize_it:
|
|||||||
}
|
}
|
||||||
|
|
||||||
pThis->bzInitDone = 0;
|
pThis->bzInitDone = 0;
|
||||||
RETiRet;
|
done: RETiRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* flush stream output buffer to persistent storage. This can be called at any time
|
/* flush stream output buffer to persistent storage. This can be called at any time
|
||||||
@ -1423,7 +1421,7 @@ strmWrite(strm_t *pThis, uchar *pBuf, size_t lenBuf)
|
|||||||
ASSERT(pThis != NULL);
|
ASSERT(pThis != NULL);
|
||||||
ASSERT(pBuf != NULL);
|
ASSERT(pBuf != NULL);
|
||||||
|
|
||||||
//DBGPRINTF("strmWrite(%p, '%65.65s', %ld);, disabled %d, sizelim %ld, size %lld\n", pThis, pBuf,lenBuf, pThis->bDisabled, pThis->iSizeLimit, pThis->iCurrOffs);
|
/* DEV DEBUG ONLY DBGPRINTF("strmWrite(%p[%s], '%65.65s', %ld);, disabled %d, sizelim %ld, size %lld\n", pThis, pThis->pszCurrFName, pBuf,(long) lenBuf, pThis->bDisabled, (long) pThis->iSizeLimit, (long long) pThis->iCurrOffs); */
|
||||||
if(pThis->bAsyncWrite)
|
if(pThis->bAsyncWrite)
|
||||||
d_pthread_mutex_lock(&pThis->mut);
|
d_pthread_mutex_lock(&pThis->mut);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user