summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Lorbach <alorbach@adiscon.com>2011-08-18 15:45:00 +0200
committerAndre Lorbach <alorbach@adiscon.com>2011-08-18 15:45:00 +0200
commitc1108d7af1ca04b2c485bd87a8cbbf044ffde6fb (patch)
treebc313aaed75f9ac30098309ffd07fb5d72869910
parent1eff0e2ebee9b6a53a6b77cdc106bbf3b5d62b55 (diff)
parent154747929f87010b444af2d552f980daafe451e6 (diff)
downloadrsyslog-c1108d7af1ca04b2c485bd87a8cbbf044ffde6fb.tar.gz
rsyslog-c1108d7af1ca04b2c485bd87a8cbbf044ffde6fb.tar.xz
rsyslog-c1108d7af1ca04b2c485bd87a8cbbf044ffde6fb.zip
Merge branch 'v5-stable' into beta
Conflicts: ChangeLog configure.ac
-rw-r--r--ChangeLog10
-rw-r--r--action.c17
-rw-r--r--doc/rsyslog_pgsql.html4
-rw-r--r--runtime/msg.c12
-rw-r--r--runtime/queue.c9
-rw-r--r--tools/pmrfc3164.c2
6 files changed, 47 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index a050639a..08c3b60c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,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
@@ -218,8 +221,13 @@ Version 5.9.0 [V5-DEVEL] (rgerhards), 2011-03-??
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
diff --git a/action.c b/action.c
index ae833ab0..5cdaacba 100644
--- a/action.c
+++ b/action.c
@@ -986,13 +986,17 @@ dbgprintf("XXXXX: tryDoAction %p, pnElem %d, nElem %d\n", pAction, *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) {
@@ -1017,6 +1021,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 98eb4b89..7b9b9b90 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -1673,6 +1673,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;
@@ -1691,6 +1693,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);
}
@@ -1709,8 +1713,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), "-")) {
@@ -1720,7 +1727,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);
}
}
@@ -1746,6 +1753,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 00eb76c7..9012abeb 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -88,6 +88,15 @@ static rsRetVal qqueueMultiEnqObjDirect(qqueue_t *pThis, multi_submit_t *pMultiS
#define QUEUE_CHECKPOINT 1
#define QUEUE_NO_CHECKPOINT 0
+/* 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
* not provide any partly private data structures, we implement this
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