From 7fdeac0bdcaad3525f203ae5dc1fa7636078e37f Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 6 Jul 2009 13:30:45 +0200 Subject: bugfix: abort condition when RecvFrom was not set and message reduction was on Happend e.g. with imuxsock. --- ChangeLog | 2 ++ runtime/msg.c | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e5e3296..3a17f28e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- Version 4.5.1 [DEVEL] (rgerhards), 2009-07-?? +- bugfix: abort condition when RecvFrom was not set and message reduction + was on. Happend e.g. with imuxsock. - added $klogConsoleLogLevel directive which permits to set a new console log level while rsyslog is active --------------------------------------------------------------------------- diff --git a/runtime/msg.c b/runtime/msg.c index 6c272d1f..0ce84f35 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -864,12 +864,18 @@ msg_t* MsgDup(msg_t* pOld) pNew->iProtocolVersion = pOld->iProtocolVersion; pNew->ttGenTime = pOld->ttGenTime; pNew->offMSG = pOld->offMSG; - pNew->pRcvFrom = pOld->pRcvFrom; - prop.AddRef(pNew->pRcvFrom); - pNew->pRcvFromIP = pOld->pRcvFromIP; - prop.AddRef(pNew->pRcvFromIP); - pNew->pInputName = pOld->pInputName; - prop.AddRef(pNew->pInputName); + if(pOld->pRcvFrom != NULL) { + pNew->pRcvFrom = pOld->pRcvFrom; + prop.AddRef(pNew->pRcvFrom); + } + if(pOld->pRcvFromIP != NULL) { + pNew->pRcvFromIP = pOld->pRcvFromIP; + prop.AddRef(pNew->pRcvFromIP); /* XXX */ + } + if(pOld->pInputName != NULL) { + pNew->pInputName = pOld->pInputName; + prop.AddRef(pNew->pInputName); + } /* enable this, if someone actually uses UxTradMsg, delete after some time has * passed and nobody complained -- rgerhards, 2009-06-16 pNew->offAfterPRI = pOld->offAfterPRI; -- cgit v1.2.3 From 01cdda8a65f76cc1270fa788aa0847a4d2d13ed7 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Mon, 6 Jul 2009 18:52:27 +0200 Subject: performance enhancement: much faster, up to twice as fast (depending on configuration). This was a small change, but with big results. There is more potential to explore, but the effects were so dramatic that I think it makes sense to include this fix. --- ChangeLog | 2 ++ runtime/queue.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a17f28e..0418f56d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- Version 4.5.1 [DEVEL] (rgerhards), 2009-07-?? +- performance enhancement: much faster, up to twice as fast (depending + on configuration) - bugfix: abort condition when RecvFrom was not set and message reduction was on. Happend e.g. with imuxsock. - added $klogConsoleLogLevel directive which permits to set a new diff --git a/runtime/queue.c b/runtime/queue.c index 13e7007a..ddff1bcf 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -1452,11 +1452,11 @@ qqueueDequeueConsumable(qqueue_t *pThis, wti_t *pWti, int iCancelStateSave) * we have someone waiting for the condition (or only when we hit the watermark right * on the nail [exact value]) -- rgerhards, 2008-03-14 */ - if(iQueueSize < pThis->iFullDlyMrk) { + if(iQueueSize < pThis->iFullDlyMrk / 2) { pthread_cond_broadcast(&pThis->belowFullDlyWtrMrk); } - if(iQueueSize < pThis->iLightDlyMrk) { + if(iQueueSize < pThis->iLightDlyMrk / 2) { pthread_cond_broadcast(&pThis->belowLightDlyWtrMrk); } -- cgit v1.2.3 From 27deea809d478fb9984000898f92c89e7843ef49 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 7 Jul 2009 12:26:23 +0200 Subject: bugfix: properties inputname, fromhost, fromhost-ip were lost ... when working with disk queues. --- ChangeLog | 2 ++ runtime/msg.c | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0418f56d..1cd4cb56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- Version 4.5.1 [DEVEL] (rgerhards), 2009-07-?? +- bugfix: properties inputname, fromhost, fromhost-ip were lost when + working with disk queues - performance enhancement: much faster, up to twice as fast (depending on configuration) - bugfix: abort condition when RecvFrom was not set and message reduction diff --git a/runtime/msg.c b/runtime/msg.c index 0ce84f35..3b421dbe 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -942,8 +942,6 @@ static rsRetVal MsgSerialize(msg_t *pThis, strm_t *pStrm) assert(pThis != NULL); assert(pStrm != NULL); - /* "pump" some property values into strings */ - /* then serialize elements */ CHKiRet(obj.BeginSerialize(pStrm, (obj_t*) pThis)); objSerializeSCALAR(pStrm, iProtocolVersion, SHORT); @@ -965,11 +963,11 @@ static rsRetVal MsgSerialize(msg_t *pThis, strm_t *pStrm) objSerializePTR(pStrm, pszRawMsg, PSZ); objSerializePTR(pStrm, pszHOSTNAME, PSZ); getInputName(pThis, &psz, &len); - objSerializeSCALAR_VAR(pStrm, "pszInputName", PSZ, psz); + CHKiRet(obj.SerializeProp(pStrm, UCHAR_CONSTANT("pszInputName"), PROPTYPE_PSZ, (void*) psz)); psz = getRcvFrom(pThis); - objSerializeSCALAR_VAR(pStrm, "pszRcvFrom", PSZ, psz); + CHKiRet(obj.SerializeProp(pStrm, UCHAR_CONSTANT("pszRcvFrom"), PROPTYPE_PSZ, (void*) psz)); psz = getRcvFromIP(pThis); - objSerializeSCALAR_VAR(pStrm, "pszRcvFromIP", PSZ, psz); + CHKiRet(obj.SerializeProp(pStrm, UCHAR_CONSTANT("pszRcvFromIP"), PROPTYPE_PSZ, (void*) psz)); objSerializePTR(pStrm, pCSStrucData, CSTR); objSerializePTR(pStrm, pCSAPPNAME, CSTR); -- cgit v1.2.3 From 9e9322585d632b20d714cdbf37e86be624b60642 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Tue, 7 Jul 2009 13:12:15 +0200 Subject: bugfix: property msg was lost when working with disk queues --- ChangeLog | 2 +- runtime/msg.c | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1cd4cb56..5cb51646 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,6 @@ --------------------------------------------------------------------------- Version 4.5.1 [DEVEL] (rgerhards), 2009-07-?? -- bugfix: properties inputname, fromhost, fromhost-ip were lost when +- bugfix: properties inputname, fromhost, fromhost-ip, msg were lost when working with disk queues - performance enhancement: much faster, up to twice as fast (depending on configuration) diff --git a/runtime/msg.c b/runtime/msg.c index 3b421dbe..63ed0083 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -947,7 +947,6 @@ static rsRetVal MsgSerialize(msg_t *pThis, strm_t *pStrm) objSerializeSCALAR(pStrm, iProtocolVersion, SHORT); objSerializeSCALAR(pStrm, iSeverity, SHORT); objSerializeSCALAR(pStrm, iFacility, SHORT); - objSerializeSCALAR(pStrm, offMSG, SHORT); objSerializeSCALAR(pStrm, msgFlags, INT); objSerializeSCALAR(pStrm, ttGenTime, INT); objSerializeSCALAR(pStrm, tRcvdAt, SYSLOGTIME); @@ -974,6 +973,11 @@ static rsRetVal MsgSerialize(msg_t *pThis, strm_t *pStrm) objSerializePTR(pStrm, pCSPROCID, CSTR); objSerializePTR(pStrm, pCSMSGID, CSTR); + /* offset must be serialized after pszRawMsg, because we need that to obtain the correct + * MSG size. + */ + objSerializeSCALAR(pStrm, offMSG, SHORT); + CHKiRet(obj.EndSerialize(pStrm)); finalize_it: @@ -1157,14 +1161,16 @@ int getMSGLen(msg_t *pM) char *getMSG(msg_t *pM) { + char *ret; if(pM == NULL) - return ""; + ret = ""; else { if(pM->offMSG == -1) - return ""; + ret = ""; else - return (char*)(pM->pszRawMsg + pM->offMSG); + ret = (char*)(pM->pszRawMsg + pM->offMSG); } + return ret; } @@ -2287,6 +2293,7 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, return "**INVALID PROPERTY NAME**"; } + /* If we did not receive a template pointer, we are already done... */ if(pTpe == NULL) { return pRes; @@ -2925,7 +2932,7 @@ rsRetVal MsgSetProperty(msg_t *pThis, var_t *pProp) } else if(isProp("msgFlags")) { pThis->msgFlags = pProp->val.num; } else if(isProp("offMSG")) { - pThis->offMSG = pProp->val.num; + MsgSetMSGoffs(pThis, pProp->val.num); } else if(isProp("pszRawMsg")) { MsgSetRawMsg(pThis, (char*) rsCStrGetSzStrNoNULL(pProp->val.pStr), cstrLen(pProp->val.pStr)); /* enable this, if someone actually uses UxTradMsg, delete after some time has -- cgit v1.2.3