summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-04-09 10:54:04 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2013-04-09 10:54:04 +0200
commit86e34c6985da29c62f13ab83e44548f1fd21849d (patch)
tree4bae37bc40854dc0d60a68cacc1a7cd488c83961
parentd9cde56eb8532bd660d6feb2249562afac0c40f6 (diff)
downloadrsyslog-86e34c6985da29c62f13ab83e44548f1fd21849d.tar.gz
rsyslog-86e34c6985da29c62f13ab83e44548f1fd21849d.tar.bz2
rsyslog-86e34c6985da29c62f13ab83e44548f1fd21849d.zip
make imrelp properly terminate on system shutdown
it didn't do so if it was inside a retry loop
-rw-r--r--action.c10
-rw-r--r--plugins/omrelp/omrelp.c1
-rw-r--r--runtime/queue.c5
-rw-r--r--tools/syslogd.c1
4 files changed, 13 insertions, 4 deletions
diff --git a/action.c b/action.c
index 42d0e0ad..4e1a8713 100644
--- a/action.c
+++ b/action.c
@@ -1284,8 +1284,11 @@ processBatchMain(action_t *pAction, batch_t *pBatch, int *pbShutdownImmediate)
assert(pBatch != NULL);
- pbShutdownImmdtSave = pBatch->pbShutdownImmediate;
- pBatch->pbShutdownImmediate = pbShutdownImmediate;
+ if(pbShutdownImmediate != NULL) {
+ pbShutdownImmdtSave = pBatch->pbShutdownImmediate;
+ pBatch->pbShutdownImmediate = pbShutdownImmediate;
+dbgprintf("DDDD: processBatchMain ShutdownImmediate is %p, was %p\n", pBatch->pbShutdownImmediate, pbShutdownImmdtSave);
+ }
CHKiRet(prepareBatch(pAction, pBatch, &activeSave, &bMustRestoreActivePtr));
/* We now must guard the output module against execution by multiple threads. The
@@ -1316,7 +1319,8 @@ processBatchMain(action_t *pAction, batch_t *pBatch, int *pbShutdownImmediate)
}
finalize_it:
- pBatch->pbShutdownImmediate = pbShutdownImmdtSave;
+ if(pbShutdownImmediate != NULL)
+ pBatch->pbShutdownImmediate = pbShutdownImmdtSave;
RETiRet;
}
#pragma GCC diagnostic warning "-Wempty-body"
diff --git a/plugins/omrelp/omrelp.c b/plugins/omrelp/omrelp.c
index 0374b697..c9e32444 100644
--- a/plugins/omrelp/omrelp.c
+++ b/plugins/omrelp/omrelp.c
@@ -190,6 +190,7 @@ ENDisCompatibleWithFeature
BEGINSetShutdownImmdtPtr
CODESTARTSetShutdownImmdtPtr
+ relpEngineSetShutdownImmdtPtr(pRelpEngine, pPtr);
DBGPRINTF("omrelp: shutdownImmediate ptr now is %p\n", pPtr);
ENDSetShutdownImmdtPtr
diff --git a/runtime/queue.c b/runtime/queue.c
index a464c2d7..5c736d2c 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -1032,7 +1032,8 @@ rsRetVal qqueueEnqObjDirectBatch(qqueue_t *pThis, batch_t *pBatch)
* We use our knowledge about the batch_t structure below, but without that, we
* pay a too-large performance toll... -- rgerhards, 2009-04-22
*/
- iRet = pThis->pConsumer(pThis->pUsr, pBatch, &pThis->bShutdownImmediate);
+dbgprintf("DDDD: qqueueEnqObjDirectBatch\n");
+ iRet = pThis->pConsumer(pThis->pUsr, pBatch, NULL);
RETiRet;
}
@@ -1191,6 +1192,7 @@ RUNLOG_STR("trying to shutdown workers within Action Timeout");
/* instruct workers to finish ASAP, even if still work exists */
DBGOPRINT((obj_t*) pThis, "setting EnqOnly mode\n");
pThis->bEnqOnly = 1;
+dbgprintf("DDDD: setting shutdownImmediate mode, ptr %p!\n", &pThis->bShutdownImmediate);
pThis->bShutdownImmediate = 1;
/* now DA queue */
if(pThis->bIsDA) {
@@ -1872,6 +1874,7 @@ ConsumerReg(qqueue_t *pThis, wti_t *pWti)
/* at this spot, we may be cancelled */
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &iCancelStateSave);
+dbgprintf("DDDD: calling consumer with shutdownImmeditate ptr %p\n", &pThis->bShutdownImmediate);
CHKiRet(pThis->pConsumer(pThis->pUsr, &pWti->batch, &pThis->bShutdownImmediate));
/* we now need to check if we should deliberately delay processing a bit
diff --git a/tools/syslogd.c b/tools/syslogd.c
index e2776c11..a0c01bf7 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -604,6 +604,7 @@ msgConsumer(void __attribute__((unused)) *notNeeded, batch_t *pBatch, int *pbShu
assert(pBatch != NULL);
pBatch->pbShutdownImmediate = pbShutdownImmediate; /* TODO: move this to batch creation! */
preprocessBatch(pBatch);
+dbgprintf("DDDD: batches ShutdownImmediate is %p\n", pBatch->pbShutdownImmediate);
ruleset.ProcessBatch(pBatch);
//TODO: the BATCH_STATE_COMM must be set somewhere down the road, but we
//do not have this yet and so we emulate -- 2010-06-10