diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-05-26 12:43:43 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-05-26 12:43:43 +0200 |
commit | aa9426f683fa6af9280bc63050ee0187ba4c57e1 (patch) | |
tree | 5ba68517cc2661ab3de4afb417592ed67bdab183 /runtime/wti.c | |
parent | 210f43137d6a077abbd8b77c1f72193dcd81cc99 (diff) | |
download | rsyslog-aa9426f683fa6af9280bc63050ee0187ba4c57e1.tar.gz rsyslog-aa9426f683fa6af9280bc63050ee0187ba4c57e1.tar.xz rsyslog-aa9426f683fa6af9280bc63050ee0187ba4c57e1.zip |
solved design issue with queue termination
... and also improved the test suite. There is a design issue in the
v3 queue engine that manifested to some serious problems with the new
processing mode. However, in v3 shutdown may take eternally if a queue
runs in DA mode, is configured to preserve data AND the action fails and
retries immediately. There is no cure available for v3, it would
require doing much of the work we have done on the new engine. The window
of exposure, as one might guess from the description, is very small. That
is probably the reason why we have not seen it in practice.
Diffstat (limited to 'runtime/wti.c')
-rw-r--r-- | runtime/wti.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/runtime/wti.c b/runtime/wti.c index 1be008df..3b6bf1b9 100644 --- a/runtime/wti.c +++ b/runtime/wti.c @@ -380,6 +380,7 @@ wtiWorker(wti_t *pThis) wtp_t *pWtp; /* our worker thread pool */ int bInactivityTOOccured = 0; rsRetVal localRet; + rsRetVal terminateRet; DEFiRet; ISOBJ_TYPE_assert(pThis, wti); @@ -406,15 +407,21 @@ wtiWorker(wti_t *pThis) wtpSetInactivityGuard(pThis->pWtp, 0, LOCK_MUTEX); /* must be set before usr mutex is locked! */ BEGIN_MTX_PROTECTED_OPERATIONS(pWtp->pmutUsr, LOCK_MUTEX); - /* first check if we are in shutdown process */ - if(wtpChkStopWrkr(pWtp, LOCK_MUTEX, MUTEX_ALREADY_LOCKED)) { - break; /* end worker thread run */ + /* first check if we are in shutdown process (but evaluate a bit later) */ + terminateRet = wtpChkStopWrkr(pWtp, LOCK_MUTEX, MUTEX_ALREADY_LOCKED); + if(terminateRet == RS_RET_TERMINATE_NOW) { + // TODO: we need to free the old batch! -- rgerhards, 2009-05-26 MULTI + break; } /* try to execute and process whatever we have */ localRet = pWtp->pfDoWork(pWtp->pUsr, pThis, iCancelStateSave); if(localRet == RS_RET_IDLE) { + if(terminateRet == RS_RET_TERMINATE_WHEN_IDLE) { + break; /* end of loop */ + } + if(bInactivityTOOccured) { /* we had an inactivity timeout in the last run and are still idle, so it is time to exit... */ break; /* end worker thread run */ |