diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-11-26 17:30:58 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-11-26 17:30:58 +0100 |
commit | e5fe270bdbcfbdd22cf9dcc71e7a83b6cc88a979 (patch) | |
tree | 7b34ad99f4efcbc1c3445ea219dd51dec7c387fc | |
parent | 1f48ed19f369b7324c15c432d56258f22791761b (diff) | |
download | rsyslog-e5fe270bdbcfbdd22cf9dcc71e7a83b6cc88a979.tar.gz rsyslog-e5fe270bdbcfbdd22cf9dcc71e7a83b6cc88a979.tar.xz rsyslog-e5fe270bdbcfbdd22cf9dcc71e7a83b6cc88a979.zip |
bugfix: commit transaction was not properly conveyed to message layer,
potentially resulting in non-message destruction and thus hangs
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | action.c | 15 |
2 files changed, 13 insertions, 4 deletions
@@ -2,6 +2,8 @@ Version 5.3.6 [BETA] (rgerhards), 2009-11-?? - 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, + potentially resulting in non-message destruction and thus hangs - bugfix: enabling GSSServer crashes rsyslog startup Thanks to Tomas Kubina for the patch [imgssapi] - bugfix (kind of): check if TCP connection is still alive if using TLS @@ -760,8 +760,9 @@ finalize_it: * rgerhards, 2008-01-28 */ static rsRetVal -finishBatch(action_t *pThis) +finishBatch(action_t *pThis, batch_t *pBatch) { + int i; DEFiRet; ASSERT(pThis != NULL); @@ -772,9 +773,14 @@ finishBatch(action_t *pThis) 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); + /* flag messages as committed */ + for(i = 0 ; i < pBatch->nElem ; ++i) { + pBatch->pElem[i].state = BATCH_STATE_COMM; + } break; case RS_RET_SUSPENDED: actionRetry(pThis); @@ -842,11 +848,12 @@ tryDoAction(action_t *pAction, batch_t *pBatch, int *pnElem, int *pbShutdownImme pBatch->pElem[iCommittedUpTo++].state = BATCH_STATE_COMM; } pBatch->pElem[i].state = BATCH_STATE_SUB; - } else if(localRet == RS_RET_PREVIOUS_COMMITTED) { + } else if(localRet == RS_RET_DEFER_COMMIT) { pBatch->pElem[i].state = BATCH_STATE_SUB; } else if(localRet == RS_RET_DISCARDMSG) { pBatch->pElem[i].state = BATCH_STATE_DISC; } else { + dbgprintf("tryDoAction: unexpected error code %d, finalizing\n", localRet); iRet = localRet; FINALIZE; } @@ -892,7 +899,7 @@ submitBatch(action_t *pAction, batch_t *pBatch, int nElem, int *pbShutdownImmedi /* try commit transaction, once done, we can simply do so as if * that return state was returned from tryDoAction(). */ - localRet = finishBatch(pAction); + localRet = finishBatch(pAction, pBatch); // TODO: careful, do we need the elem counter? } if( localRet == RS_RET_OK @@ -942,7 +949,7 @@ processAction(action_t *pAction, batch_t *pBatch, int *pbShutdownImmediate) assert(pBatch != NULL); pBatch->iDoneUpTo = 0; CHKiRet(submitBatch(pAction, pBatch, pBatch->nElem, pbShutdownImmediate)); - iRet = finishBatch(pAction); + iRet = finishBatch(pAction, pBatch); finalize_it: RETiRet; |