diff options
author | Andre Lorbach <alorbach@adiscon.com> | 2013-07-15 08:17:08 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-07-15 08:17:08 +0200 |
commit | 495ae8752084b896f29d92e33028f44269e1d1b1 (patch) | |
tree | f4670880bd452ad248bd48e80ba7378a299097a0 /runtime/queue.c | |
parent | bcb090ab8ac53615a5995532ea9b245dc759af42 (diff) | |
download | rsyslog-495ae8752084b896f29d92e33028f44269e1d1b1.tar.gz rsyslog-495ae8752084b896f29d92e33028f44269e1d1b1.tar.bz2 rsyslog-495ae8752084b896f29d92e33028f44269e1d1b1.zip |
bugfix: 100% CPU utilization when DA queue became full
Diffstat (limited to 'runtime/queue.c')
-rw-r--r-- | runtime/queue.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/runtime/queue.c b/runtime/queue.c index 3ae74287..d5ad37a1 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -1913,8 +1913,16 @@ ConsumerDA(qqueue_t *pThis, wti_t *pWti) /* iterate over returned results and enqueue them in DA queue */ for(i = 0 ; i < pWti->batch.nElem && !pThis->bShutdownImmediate ; i++) { - CHKiRet(qqueueEnqMsg(pThis->pqDA, eFLOWCTL_NO_DELAY, - MsgAddRef(pWti->batch.pElem[i].pMsg))); + iRet = qqueueEnqMsg(pThis->pqDA, eFLOWCTL_NO_DELAY, MsgAddRef(pWti->batch.pElem[i].pMsg)); + if(iRet != RS_RET_OK) { + if(iRet == RS_RET_ERR_QUEUE_EMERGENCY) { + /* Queue emergency error occured */ + DBGOPRINT((obj_t*) pThis, "ConsumerDA:qqueueEnqMsg caught RS_RET_ERR_QUEUE_EMERGENCY, aborting loop.\n"); + FINALIZE; + } else { + DBGOPRINT((obj_t*) pThis, "ConsumerDA:qqueueEnqMsg item (%d) returned with error state: '%d'\n", i, iRet); + } + } pWti->batch.eltState[i] = BATCH_STATE_COMM; /* commited to other queue! */ } @@ -1922,10 +1930,14 @@ ConsumerDA(qqueue_t *pThis, wti_t *pWti) pthread_setcancelstate(iCancelStateSave, NULL); finalize_it: + if(iRet != RS_RET_OK && iRet != RS_RET_ERR_QUEUE_EMERGENCY) { + iRet = RS_RET_OK; + } + /* now we are done, but potentially need to re-aquire the mutex */ if(bNeedReLock) d_pthread_mutex_lock(pThis->mut); - DBGOPRINT((obj_t*) pThis, "DAConsumer returns with iRet %d\n", iRet); + RETiRet; } |