diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | action.c | 17 | ||||
-rw-r--r-- | doc/rsyslog_pgsql.html | 4 | ||||
-rw-r--r-- | runtime/msg.c | 12 | ||||
-rw-r--r-- | runtime/queue.c | 9 | ||||
-rw-r--r-- | tools/pmrfc3164.c | 2 |
6 files changed, 46 insertions, 8 deletions
@@ -54,6 +54,9 @@ Version 6.1.12 [BETA] (al), 2011-??-?? if a name is resolved to IPv4-mapped-on-IPv6 address Found by Ismail Dönmez at suse - bugfix: The NUL-Byte for the syslogtag was not copied in MsgDup (msg.c) +- bugfix: fixed incorrect state handling for Discard Action (transactions) + Note: This caused all messages in a batch to be set to COMMITTED, + even if they were discarded. --------------------------------------------------------------------------- Version 6.1.11 [BETA] (rgerhards), 2011-07-11 - systemd support: set stdout/stderr to null - thx to Lennart for the patch @@ -346,8 +349,13 @@ Version 5.9.0 [V5-DEVEL] (rgerhards), 2011-06-08 affected directive was: $ActionExecOnlyWhenPreviousIsSuspended on closes: http://bugzilla.adiscon.com/show_bug.cgi?id=236 --------------------------------------------------------------------------- -Version 5.8.5 [V5-stable] (al), 2011-??-?? +Version 5.8.5 [V5-stable] (rgerhards/al), 2011-??-?? +- bugfix: potential hang condition during tag emulation +- bugfix: too-early string termination during tag emulation - bugfix: The NUL-Byte for the syslogtag was not copied in MsgDup (msg.c) +- bugfix: fixed incorrect state handling for Discard Action (transactions) + Note: This caused all messages in a batch to be set to COMMITTED, + even if they were discarded. --------------------------------------------------------------------------- Version 5.8.4 [V5-stable] (al), 2011-08-10 - bugfix: potential misadressing in property replacer @@ -1032,13 +1032,17 @@ tryDoAction(action_t *pAction, batch_t *pBatch, int *pnElem) /* mark messages as committed */ while(iCommittedUpTo <= i) { pBatch->pElem[iCommittedUpTo].bPrevWasSuspended = 0; /* we had success! */ - pBatch->pElem[iCommittedUpTo++].state = BATCH_STATE_COMM; + batchSetElemState(pBatch, iCommittedUpTo, BATCH_STATE_COMM); + ++iCommittedUpTo; + //pBatch->pElem[iCommittedUpTo++].state = BATCH_STATE_COMM; } } else if(localRet == RS_RET_PREVIOUS_COMMITTED) { /* mark messages as committed */ while(iCommittedUpTo < i) { pBatch->pElem[iCommittedUpTo].bPrevWasSuspended = 0; /* we had success! */ - pBatch->pElem[iCommittedUpTo++].state = BATCH_STATE_COMM; + batchSetElemState(pBatch, iCommittedUpTo, BATCH_STATE_COMM); + ++iCommittedUpTo; + //pBatch->pElem[iCommittedUpTo++].state = BATCH_STATE_COMM; } pBatch->pElem[i].state = BATCH_STATE_SUB; } else if(localRet == RS_RET_DEFER_COMMIT) { @@ -1063,6 +1067,15 @@ finalize_it: RETiRet; } +/* debug aid */ +static void displayBatchState(batch_t *pBatch) +{ + int i; + for(i = 0 ; i < pBatch->nElem ; ++i) { + dbgprintf("XXXXX: displayBatchState2 %p[%d]: %d\n", pBatch, i, pBatch->pElem[i].state); + } +} + /* submit a batch for actual action processing. * The first nElem elements are processed. This function calls itself diff --git a/doc/rsyslog_pgsql.html b/doc/rsyslog_pgsql.html index dcb9dc3a..21516ec8 100644 --- a/doc/rsyslog_pgsql.html +++ b/doc/rsyslog_pgsql.html @@ -30,7 +30,7 @@ --> </STYLE> </HEAD> -<BODY LANG="de-DE" DIR="LTR"> +<BODY> <H1 CLASS="western"><SPAN LANG="en-US">Writing </SPAN>syslog messages to MySQL, PostgreSQL or any other supported Database</H1> <P CLASS="western"><FONT SIZE=2><I>Written by </I></FONT><A HREF="http://www.adiscon.com/en/people/rainer-gerhards.php"><FONT SIZE=2><I>Rainer @@ -333,4 +333,4 @@ Gerhards</A>, Marc Schiffbauer and <A HREF="http://www.adiscon.com/en/">Adiscon< <P CLASS="western"><BR><BR> </P> </BODY> -</HTML>
\ No newline at end of file +</HTML> diff --git a/runtime/msg.c b/runtime/msg.c index 3bc6ffe6..420fa542 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -1653,6 +1653,8 @@ void MsgSetTAG(msg_t *pMsg, uchar* pszBuf, size_t lenBuf) uchar *pBuf; assert(pMsg != NULL); +dbgprintf("MsgSetTAG in: len %d, pszBuf: %s\n", lenBuf, pszBuf); + freeTAG(pMsg); pMsg->iLenTAG = lenBuf; @@ -1671,6 +1673,8 @@ void MsgSetTAG(msg_t *pMsg, uchar* pszBuf, size_t lenBuf) memcpy(pBuf, pszBuf, pMsg->iLenTAG); pBuf[pMsg->iLenTAG] = '\0'; /* this also works with truncation! */ + +dbgprintf("MsgSetTAG exit: pMsg->iLenTAG %d, pMsg->TAG.szBuf: %s\n", pMsg->iLenTAG, pMsg->TAG.szBuf); } @@ -1689,8 +1693,11 @@ static inline void tryEmulateTAG(msg_t *pM, sbool bLockMutex) if(bLockMutex == LOCK_MUTEX) MsgLock(pM); - if(pM->iLenTAG > 0) + if(pM->iLenTAG > 0) { + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); return; /* done, no need to emulate */ + } if(getProtocolVersion(pM) == 1) { if(!strcmp(getPROCID(pM, MUTEX_ALREADY_LOCKED), "-")) { @@ -1700,7 +1707,7 @@ static inline void tryEmulateTAG(msg_t *pM, sbool bLockMutex) /* now we can try to emulate */ lenTAG = snprintf((char*)bufTAG, CONF_TAG_MAXSIZE, "%s[%s]", getAPPNAME(pM, MUTEX_ALREADY_LOCKED), getPROCID(pM, MUTEX_ALREADY_LOCKED)); - bufTAG[32] = '\0'; /* just to make sure... */ + bufTAG[sizeof(bufTAG)-1] = '\0'; /* just to make sure... */ MsgSetTAG(pM, bufTAG, lenTAG); } } @@ -1726,6 +1733,7 @@ getTAG(msg_t *pM, uchar **ppBuf, int *piLen) *piLen = pM->iLenTAG; } } +dbgprintf("getTAG: len %d, buf '%s'\n", *piLen, *ppBuf); } diff --git a/runtime/queue.c b/runtime/queue.c index f390d987..3876ec39 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -93,7 +93,6 @@ static rsRetVal qDestructDisk(qqueue_t *pThis); #define QUEUE_CHECKPOINT 1 #define QUEUE_NO_CHECKPOINT 0 - /* tables for interfacing with the v6 config system */ static struct cnfparamdescr cnfpdescr[] = { { "queue.filename", eCmdHdlrGetWord, 0 }, @@ -127,6 +126,14 @@ static struct cnfparamblk pblk = cnfpdescr }; +/* debug aid */ +static void displayBatchState(batch_t *pBatch) +{ + int i; + for(i = 0 ; i < pBatch->nElem ; ++i) { + dbgprintf("XXXXX: displayBatchState %p[%d]: %d\n", pBatch, i, pBatch->pElem[i].state); + } +} /*********************************************************************** * we need a private data structure, the "to-delete" list. As C does diff --git a/tools/pmrfc3164.c b/tools/pmrfc3164.c index 635ca985..d56e53f0 100644 --- a/tools/pmrfc3164.c +++ b/tools/pmrfc3164.c @@ -176,6 +176,7 @@ CODESTARTparse * in RFC3164...). We now receive the full size, but will modify the * outputs so that only 32 characters max are used by default. */ +dbgprintf("pmrfc3164:tag:in: lenMsg %d, p2parse: '%s'\n", lenMsg, p2parse); i = 0; while(lenMsg > 0 && *p2parse != ':' && *p2parse != ' ' && i < CONF_TAG_MAXSIZE) { bufParseTAG[i++] = *p2parse++; @@ -191,6 +192,7 @@ CODESTARTparse * is considered OK. So we do not need to check for empty TAG. -- rgerhards, 2009-06-23 */ bufParseTAG[i] = '\0'; /* terminate string */ +dbgprintf("pmrfc3164:tag:done: lenMsg %d, i %d, bufParseTAG: '%s'\n", lenMsg, i, bufParseTAG); MsgSetTAG(pMsg, bufParseTAG, i); } else {/* we enter this code area when the user has instructed rsyslog NOT * to parse HOSTNAME and TAG - rgerhards, 2006-03-13 |