diff options
author | Andre Lorbach <alorbach@adiscon.com> | 2013-07-16 09:13:35 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-07-16 10:51:12 +0200 |
commit | d302fb7571dde5a929c5e80c2bdf4b2133b4f249 (patch) | |
tree | 150e78b1e9a89fa3ea060ff34f38d04e75262896 /runtime/queue.c | |
parent | b6d350ab9c212923dcfcf3b160af83b3c078f1bc (diff) | |
download | rsyslog-d302fb7571dde5a929c5e80c2bdf4b2133b4f249.tar.gz rsyslog-d302fb7571dde5a929c5e80c2bdf4b2133b4f249.tar.bz2 rsyslog-d302fb7571dde5a929c5e80c2bdf4b2133b4f249.zip |
Fixed return state handling in ConsumerDA
The queue full loop fix added a problem to the queue when
rsyslog was shutdown. This problem has been corrected now.
Conflicts:
runtime/queue.c
Diffstat (limited to 'runtime/queue.c')
-rw-r--r-- | runtime/queue.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/runtime/queue.c b/runtime/queue.c index d5ad37a1..5652efe2 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -1930,8 +1930,25 @@ 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; + /* Check the last return state of qqueueEnqMsg. If an error was returned, we acknowledge it only. + * Unless the error code is RS_RET_ERR_QUEUE_EMERGENCY, we resett the return state to RS_RET_OK. + * Otherwise the Caller functions would run into an infinite Loop trying to enqueue the + * same messages over and over again. + * + * However we do NOT overwrite positive return states like + * RS_RET_TERMINATE_NOW, + * RS_RET_NO_RUN, + * RS_RET_IDLE, + * RS_RET_TERMINATE_WHEN_IDLE + * These return states are important for Queue handling of the upper laying functions. + */ + if( iRet != RS_RET_OK && + iRet != RS_RET_ERR_QUEUE_EMERGENCY && + iRet < 0) { + DBGOPRINT((obj_t*) pThis, "ConsumerDA:qqueueEnqMsg Resetting iRet from %d back to RS_RET_OK\n", iRet); + iRet = RS_RET_OK; + } else { + DBGOPRINT((obj_t*) pThis, "ConsumerDA:qqueueEnqMsg returns with iRet %d\n", iRet); } /* now we are done, but potentially need to re-aquire the mutex */ |