summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-01-12 13:34:01 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2010-01-12 13:34:01 +0100
commit58870fc483c441fba4a87b8411642ea5bc8a7e74 (patch)
tree10726bfa4634429d24f0d3f41a2e5441b8a13ffb
parent671470f1a1880865bc1175414b0e5000713556d1 (diff)
parentd7277484811249b7acacb45a223928980e1a36b4 (diff)
downloadrsyslog-58870fc483c441fba4a87b8411642ea5bc8a7e74.tar.gz
rsyslog-58870fc483c441fba4a87b8411642ea5bc8a7e74.tar.xz
rsyslog-58870fc483c441fba4a87b8411642ea5bc8a7e74.zip
Merge branch 'beta'
-rw-r--r--ChangeLog6
-rw-r--r--action.c16
-rw-r--r--doc/action_state.dot1
-rw-r--r--doc/rsyslog_conf_actions.html10
-rw-r--r--plugins/ompgsql/ompgsql.c19
-rw-r--r--tools/omfwd.c6
6 files changed, 43 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 39e8212d..04489253 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,5 @@
+- fixed a memory leak when sending messages in zip-compressed format
+ Thanks to Naoya Nakazawa for analyzing this issue and providing a patch.
---------------------------------------------------------------------------
Version 5.5.2 [DEVEL] (rgerhards), 2009-11-??
- worked around an issue where omfile failed to compile on32 bit platforms
@@ -40,6 +42,10 @@ Version 5.5.0 [DEVEL] (rgerhards), 2009-11-18
- doc: improved description of what loadable modules can do
---------------------------------------------------------------------------
Version 5.3.6 [BETA] (rgerhards), 2009-11-??
+- bugfix: ompgsql did not properly check the server connection in
+ tryResume(), which could lead to rsyslog running in a thight loop
+- bugfix: suspension during beginTransaction() was not properly handled
+ by rsyslog core
- bugfix: omfile output was only written when buffer was full, not at
end of transaction
- bugfix: commit transaction was not properly conveyed to message layer,
diff --git a/action.c b/action.c
index 925ba824..b3600e4f 100644
--- a/action.c
+++ b/action.c
@@ -575,8 +575,19 @@ static rsRetVal actionPrepare(action_t *pThis)
* action state accordingly
*/
if(pThis->eState == ACT_STATE_RDY) {
- CHKiRet(pThis->pMod->mod.om.beginTransaction(pThis->pModData));
- actionSetState(pThis, ACT_STATE_ITX);
+ iRet = pThis->pMod->mod.om.beginTransaction(pThis->pModData);
+ switch(iRet) {
+ case RS_RET_OK:
+ actionSetState(pThis, ACT_STATE_ITX);
+ break;
+ case RS_RET_SUSPENDED:
+ actionRetry(pThis);
+ break;
+ case RS_RET_DISABLE_ACTION:
+ actionDisable(pThis);
+ break;
+ default:FINALIZE;
+ }
}
finalize_it:
@@ -773,7 +784,6 @@ finishBatch(action_t *pThis, batch_t *pBatch)
CHKiRet(actionPrepare(pThis));
if(pThis->eState == ACT_STATE_ITX) {
iRet = pThis->pMod->mod.om.endTransaction(pThis->pModData);
-dbgprintf("XXX: finishBatch, result of endTranscation %d\n", iRet);
switch(iRet) {
case RS_RET_OK:
actionCommitted(pThis);
diff --git a/doc/action_state.dot b/doc/action_state.dot
index d56d9da0..2f36d8da 100644
--- a/doc/action_state.dot
+++ b/doc/action_state.dot
@@ -20,6 +20,7 @@ digraph msgState {
susp [label="suspended"]
rdy -> itx [label="transaction begins"]
+ rdy -> rtry [label="begin tx\nerror"]
itx -> itx [label="success"]
itx -> comm [label="commit\n(caller or auto)"]
itx -> rtry [label="error"]
diff --git a/doc/rsyslog_conf_actions.html b/doc/rsyslog_conf_actions.html
index 2ef3f4b0..8c4b9cfc 100644
--- a/doc/rsyslog_conf_actions.html
+++ b/doc/rsyslog_conf_actions.html
@@ -98,18 +98,14 @@ done, same with /dev/console.</p>
messages to a remote host running rsyslogd(8) and to receive messages
from remote hosts. Using this feature you're able to control all syslog
messages on one host, if all other machines will log remotely to that.
-This tears down<br>
-administration needs.<br>
-<br>
-<b>Please note that this version of rsyslogd by default does NOT
-forward messages it has received from the network to another host.
-Specify the "-h" option to enable this.</b></p>
+This tears down administration needs.</p>
<p>To forward messages to another host, prepend the hostname with
the at sign ("@"). A single at sign means that messages will
be forwarded via UDP protocol (the standard for syslog). If you prepend
two at signs ("@@"), the messages will be transmitted via TCP. Please
note that plain TCP based syslog is not officially standardized, but
-most major syslogds support it (e.g. syslog-ng or WinSyslog). The
+most major syslogds support it (e.g. syslog-ng or
+<a href="http://www.winsyslog.com/">WinSyslog</a>). The
forwarding action indicator (at-sign) can be followed by one or more
options. If they are given, they must be immediately (without a space)
following the final at sign and be enclosed in parenthesis. The
diff --git a/plugins/ompgsql/ompgsql.c b/plugins/ompgsql/ompgsql.c
index 784a722d..c13f58e9 100644
--- a/plugins/ompgsql/ompgsql.c
+++ b/plugins/ompgsql/ompgsql.c
@@ -65,6 +65,8 @@ typedef struct _instanceData {
} instanceData;
+static rsRetVal writePgSQL(uchar *psz, instanceData *pData);
+
BEGINcreateInstance
CODESTARTcreateInstance
ENDcreateInstance
@@ -170,9 +172,6 @@ tryExec(uchar *pszCmd, instanceData *pData)
int bHadError = 0;
/* try insert */
-BEGINfunc
-RUNLOG_VAR("%p", pData->f_hpgsql);
-RUNLOG_VAR("%s", pszCmd);
pgRet = PQexec(pData->f_hpgsql, (char*)pszCmd);
execState = PQresultStatus(pgRet);
if(execState != PGRES_COMMAND_OK && execState != PGRES_TUPLES_OK) {
@@ -181,7 +180,6 @@ RUNLOG_VAR("%s", pszCmd);
}
PQclear(pgRet);
-ENDfunc
return(bHadError);
}
@@ -193,7 +191,8 @@ ENDfunc
* a sql format error - connection aborts were properly handled
* before my patch. -- rgerhards, 2009-04-17
*/
-rsRetVal writePgSQL(uchar *psz, instanceData *pData)
+static rsRetVal
+writePgSQL(uchar *psz, instanceData *pData)
{
int bHadError = 0;
DEFiRet;
@@ -231,6 +230,16 @@ BEGINtryResume
CODESTARTtryResume
if(pData->f_hpgsql == NULL) {
iRet = initPgSQL(pData, 1);
+ if(iRet == RS_RET_OK) {
+ /* the code above seems not to actually connect to the database. As such, we do a
+ * dummy statement (a pointless select...) to verify the connection and return
+ * success only when that statemetn succeeds. Note that I am far from being a
+ * PostgreSQL expert, so any patch that does the desired result in a more
+ * intelligent way is highly welcome. -- rgerhards, 2009-12-16
+ */
+ iRet = writePgSQL((uchar*)"select 'a' as a", pData);
+ }
+
}
ENDtryResume
diff --git a/tools/omfwd.c b/tools/omfwd.c
index 76beb486..0fac251b 100644
--- a/tools/omfwd.c
+++ b/tools/omfwd.c
@@ -483,6 +483,12 @@ CODESTARTdoAction
}
}
finalize_it:
+# ifdef USE_NETZIP
+ if(psz != (char*) ppString[0]) {
+ /* we need to free temporary buffer, alloced above - Naoya Nakazawa, 2010-01-11 */
+ free(psz);
+ }
+# endif
ENDdoAction