From eb006d74dd8bbadbd7a551e732e373e7cf3ad9c9 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Wed, 27 Feb 2008 10:49:43 +0000 Subject: bugfix: queue disk file were not properly persisted when immediately after closing an output file rsyslog was stopped or huped (the new output file open must NOT have happend at that point) - this lead to a sparse and invalid queue file which could cause several problems to the engine (unpredictable results). This situation should have happened only in very rare cases. tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=40 --- ChangeLog | 10 ++++++++++ obj.c | 4 +++- queue.c | 1 - stream.c | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 52382c8e..addfadb1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,16 @@ Version 3.11.6 (rgerhards), 2008-02-?? - bugfix: rsyslogd segfaulted on second SIGHUP tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=38 - improved stability of queuee engine +- bugfix: queue disk file were not properly persisted when + immediately after closing an output file rsyslog was stopped + or huped (the new output file open must NOT have happend at + that point) - this lead to a sparse and invalid queue file + which could cause several problems to the engine (unpredictable + results). This situation should have happened only in very + rare cases. tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=40 +- bugfix: imfile could abort under extreme stress conditions + (when it was terminated before it could open all of its + to be monitored files) - applied patch from varmojfekoj to fix an issue with compatibility mode and default module directories (many thanks!): I've also noticed a bug in the compatibility code; the problem is that diff --git a/obj.c b/obj.c index f0ad9787..5e0fd278 100644 --- a/obj.c +++ b/obj.c @@ -460,8 +460,9 @@ static rsRetVal objDeserializeHeader(uchar *pszRecType, objID_t *poID, int* poVe /* and now we skip over the rest until the delemiting \n */ NEXTC; - while(c != '\n') + while(c != '\n') { NEXTC; + } *poID = (objID_t) ioID; *poVers = oVers; @@ -659,6 +660,7 @@ rsRetVal objDeserialize(void *ppObj, objID_t objTypeExpected, strm_t *pStrm, rsR iRetLocal = objDeserializeHeader((uchar*) "Obj", &oID, &oVers, pStrm); if(iRetLocal != RS_RET_OK) { dbgprintf("objDeserialize error %d during header processing - trying to recover\n", iRetLocal); +abort(); CHKiRet(objDeserializeTryRecover(pStrm)); } } while(iRetLocal != RS_RET_OK); diff --git a/queue.c b/queue.c index c54d3991..28dd1f33 100644 --- a/queue.c +++ b/queue.c @@ -1576,7 +1576,6 @@ queueRegOnWrkrShutdown(queue_t *pThis) wtpAdviseMaxWorkers(pThis->pqParent->pWtpDA, 1); /* reactivate DA worker (always 1) */ } -finalize_it: RETiRet; } diff --git a/stream.c b/stream.c index b6be4da2..0f05c97c 100644 --- a/stream.c +++ b/stream.c @@ -137,6 +137,7 @@ static rsRetVal strmCloseFile(strm_t *pThis) unlink((char*) pThis->pszCurrFName); // TODO: check returncode } + pThis->iCurrOffs = 0; /* we are back at begin of file */ if(pThis->pszCurrFName != NULL) { free(pThis->pszCurrFName); /* no longer needed in any case (just for open) */ pThis->pszCurrFName = NULL; @@ -199,7 +200,6 @@ strmHandleEOFMonitor(strm_t *pThis) ABORT_FINALIZE(RS_RET_IO_ERROR); if(stat((char*) pThis->pszCurrFName, &statName) == -1) ABORT_FINALIZE(RS_RET_IO_ERROR); -//dbgoprint((obj_t*)pThis, "curr ino %d, new ino %d, curr offset %lld, new size %ld\n", statOpen.st_ino, statName.st_ino, pThis->iCurrOffs, statName.st_size); if(statOpen.st_ino == statName.st_ino && pThis->iCurrOffs == statName.st_size) { ABORT_FINALIZE(RS_RET_EOF); } else { -- cgit v1.2.3