diff options
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | plugins/imdiag/imdiag.c | 4 | ||||
-rw-r--r-- | runtime/msg.c | 3 | ||||
-rw-r--r-- | tests/Makefile.am | 3 | ||||
-rwxr-xr-x | tests/diag.sh | 19 | ||||
-rw-r--r-- | tests/testsuites/udp-msgreduc-vg.conf | 11 | ||||
-rwxr-xr-x | tests/udp-msgreduc-vg.sh | 18 |
7 files changed, 74 insertions, 3 deletions
@@ -1,5 +1,6 @@ --------------------------------------------------------------------------- -Version 6.1.5 [DEVEL] (rgerhards), 2011-02-?? +Version 6.1.5 [DEVEL] (rgerhards), 2011-03-04 +- improved testbench - enhanced imtcp to use a pool of worker threads to process incoming messages. This enables higher processing rates, especially in the TLS case (where more CPU is needed for the crypto functions) @@ -14,6 +15,13 @@ Version 6.1.5 [DEVEL] (rgerhards), 2011-02-?? fixes: http://bugzilla.adiscon.com/show_bug.cgi?id=218 - bugfix: memory leak when $RepeatedMsgReduction on was used bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=225 +- bugfix: potential abort condition when $RepeatedMsgReduction set to on + as well as potentially in a number of other places where MsgDup() was + used. This only happened when the imudp input module was used and it + depended on name resolution not yet had taken place. In other words, + this was a strange problem that could lead to hard to diagnose + instability. So if you experience instability, chances are good that + this fix will help. --------------------------------------------------------------------------- Version 6.1.4 [DEVEL] (rgerhards), 2011-02-18 - bugfix/omhdfs: directive $OMHDFSFileName rendered unusable @@ -116,6 +124,15 @@ expected that interfaces, even new ones, break during the initial syslog plain tcp input plugin (NOT supporting TLS!) [ported from v4] --------------------------------------------------------------------------- +Version 5.7.7 [V5-BETA] (rgerhards), 2011-03-?? +- bugfix: potential abort condition when $RepeatedMsgReduction set to on + as well as potentially in a number of other places where MsgDup() was + used. This only happened when the imudp input module was used and it + depended on name resolution not yet had taken place. In other words, + this was a strange problem that could lead to hard to diagnose + instability. So if you experience instability, chances are good that + this fix will help. +--------------------------------------------------------------------------- Version 5.7.6 [V5-BETA] (rgerhards), 2011-02-25 - bugfix: fixed a memory leak and potential abort condition this could happen if multiple rulesets were used and some output batches diff --git a/plugins/imdiag/imdiag.c b/plugins/imdiag/imdiag.c index f96bf754..36fe7e50 100644 --- a/plugins/imdiag/imdiag.c +++ b/plugins/imdiag/imdiag.c @@ -291,6 +291,7 @@ OnMsgReceived(tcps_sess_t *pSess, uchar *pRcv, int iLenMsg) { int iMsgQueueSize; uchar *pszMsg; + uchar *pToFree = NULL; uchar cmdBuf[1024]; DEFiRet; @@ -302,6 +303,7 @@ OnMsgReceived(tcps_sess_t *pSess, uchar *pRcv, int iLenMsg) * before proceeding. */ CHKmalloc(pszMsg = MALLOC(sizeof(uchar) * (iLenMsg + 1))); + pToFree = pszMsg; memcpy(pszMsg, pRcv, iLenMsg); pszMsg[iLenMsg] = '\0'; @@ -321,6 +323,8 @@ OnMsgReceived(tcps_sess_t *pSess, uchar *pRcv, int iLenMsg) } finalize_it: + if(pToFree != NULL) + free(pToFree); RETiRet; } diff --git a/runtime/msg.c b/runtime/msg.c index 70b20749..ec132489 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -944,13 +944,14 @@ msg_t* MsgDup(msg_t* pOld) pNew->iLenMSG = pOld->iLenMSG; pNew->iLenTAG = pOld->iLenTAG; pNew->iLenHOSTNAME = pOld->iLenHOSTNAME; - if((pOld->msgFlags & NEEDS_DNSRESOL) == 1) { + if((pOld->msgFlags & NEEDS_DNSRESOL)) { localRet = msgSetFromSockinfo(pNew, pOld->rcvFrom.pfrominet); if(localRet != RS_RET_OK) { /* if something fails, we accept loss of this property, it is * better than losing the whole message. */ pNew->msgFlags &= ~NEEDS_DNSRESOL; + pNew->rcvFrom.pRcvFrom = NULL; /* make sure no dangling values */ } } else { if(pOld->rcvFrom.pRcvFrom != NULL) { diff --git a/tests/Makefile.am b/tests/Makefile.am index 9bf33938..059f951f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -47,6 +47,7 @@ TESTS = $(TESTRUNS) cfg.sh \ imuxsock_logger_root.sh \ imuxsock_traillf_root.sh \ imuxsock_ccmiddle_root.sh \ + udp-msgreduc-vg.sh \ queue-persist.sh if ENABLE_IMPTCP @@ -203,6 +204,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \ testsuites/imtcp-tls-basic.conf \ imtcp-multiport.sh \ testsuites/imtcp-multiport.conf \ + udp-msgreduc-vg.sh \ + testsuites/udp-msgreduc-vg.conf \ manytcp.sh \ testsuites/manytcp.conf \ manyptcp.sh \ diff --git a/tests/diag.sh b/tests/diag.sh index 2f307750..64b507e6 100755 --- a/tests/diag.sh +++ b/tests/diag.sh @@ -34,7 +34,12 @@ case $1 in ;; 'startup') # start rsyslogd with default params. $2 is the config file name to use # returns only after successful startup, $3 is the instance (blank or 2!) - $valgrind ../tools/rsyslogd -c4 -u2 -n -irsyslog$3.pid -M../runtime/.libs:../.libs -f$srcdir/testsuites/$2 & + $valgrind ../tools/rsyslogd -c6 -u2 -n -irsyslog$3.pid -M../runtime/.libs:../.libs -f$srcdir/testsuites/$2 & + $srcdir/diag.sh wait-startup $3 + ;; + 'startup-vg') # start rsyslogd with default params under valgrind control. $2 is the config file name to use + # returns only after successful startup, $3 is the instance (blank or 2!) + valgrind --error-exitcode=10 --malloc-fill=ff --free-fill=fe --leak-check=full ../tools/rsyslogd -c6 -u2 -n -irsyslog$3.pid -M../runtime/.libs:../.libs -f$srcdir/testsuites/$2 & $srcdir/diag.sh wait-startup $3 ;; 'wait-startup') # wait for rsyslogd startup ($2 is the instance) @@ -58,6 +63,18 @@ case $1 in exit 1 fi ;; + 'wait-shutdown-vg') # actually, we wait for rsyslog.pid to be deleted. $2 is the + # instance + wait `cat rsyslog.pid` + export RSYSLOGD_EXIT=$? + echo rsyslogd run exited with $RSYSLOGD_EXIT + if [ -e core.* ] + then + echo "ABORT! core file exists, starting interactive shell" + bash + exit 1 + fi + ;; 'wait-queueempty') # wait for main message queue to be empty. $2 is the instance. if [ "$2" == "2" ] then diff --git a/tests/testsuites/udp-msgreduc-vg.conf b/tests/testsuites/udp-msgreduc-vg.conf new file mode 100644 index 00000000..150bef2e --- /dev/null +++ b/tests/testsuites/udp-msgreduc-vg.conf @@ -0,0 +1,11 @@ +# Test for queue disk mode (see .sh file for details) +# rgerhards, 2009-05-22 +$IncludeConfig diag-common.conf + +$ModLoad ../plugins/imudp/.libs/imudp +$UDPServerRun 13514 +$RepeatedMsgReduction on + +$template outfmt,"%msg:F,58:2%\n" +*.* ./rsyslog.out.log;outfmt +#:msg, contains, "msgnum:" ./rsyslog.out.log;outfmt diff --git a/tests/udp-msgreduc-vg.sh b/tests/udp-msgreduc-vg.sh new file mode 100755 index 00000000..e19ffd86 --- /dev/null +++ b/tests/udp-msgreduc-vg.sh @@ -0,0 +1,18 @@ +# check if valgrind violations occur. Correct output is not checked. +# added 2011-03-01 by Rgerhards +# This file is part of the rsyslog project, released under GPLv3 +echo =============================================================================== +echo \[udp-msgreduc-vg.sh\]: testing imtcp multiple listeners +source $srcdir/diag.sh init +source $srcdir/diag.sh startup-vg udp-msgreduc-vg.conf +source $srcdir/diag.sh wait-startup +./tcpflood -t 127.0.0.1 -m 4 -r -Tudp -M "<133>2011-03-01T11:22:12Z host tag msgh ..." +./tcpflood -t 127.0.0.1 -m 1 -r -Tudp -M "<133>2011-03-01T11:22:12Z host tag msgh ...x" +source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages +source $srcdir/diag.sh wait-shutdown-vg +if [ "$RSYSLOGD_EXIT" -eq "10" ] +then + echo "udp-msgreduc-vg.sh FAILED" + exit 1 +fi +source $srcdir/diag.sh exit |