summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-06-30 10:28:09 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-06-30 10:28:09 +0200
commit38e7f7852a9b82e055840dd1696a72db2c45f79c (patch)
tree9efe9692f9f354fb2b6b61cfd6b25bc13433def9
parent86225089f2d0e82deb368e1688464e8ba84d24cf (diff)
downloadrsyslog-38e7f7852a9b82e055840dd1696a72db2c45f79c.tar.gz
rsyslog-38e7f7852a9b82e055840dd1696a72db2c45f79c.tar.xz
rsyslog-38e7f7852a9b82e055840dd1696a72db2c45f79c.zip
reduced sporadic failures during make check
backport from v6
-rw-r--r--plugins/imdiag/imdiag.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/plugins/imdiag/imdiag.c b/plugins/imdiag/imdiag.c
index ed6ef509..912c7bbf 100644
--- a/plugins/imdiag/imdiag.c
+++ b/plugins/imdiag/imdiag.c
@@ -255,6 +255,8 @@ finalize_it:
/* This function waits until the main queue is drained (size = 0)
+ * To make sure it really is drained, we check three times. Otherwise we
+ * may just see races.
*/
static rsRetVal
waitMainQEmpty(tcps_sess_t *pSess)
@@ -264,19 +266,22 @@ waitMainQEmpty(tcps_sess_t *pSess)
DEFiRet;
CHKiRet(diagGetMainMsgQSize(&iMsgQueueSize));
- while(iMsgQueueSize > 0) {
- /* DEV DEBUG ONLY if(iPrint++ % 500)
- printf("imdiag: main msg queue size: %d\n", iMsgQueueSize);
- */
- if(iPrint++ % 500 == 0)
- dbgprintf("imdiag sleeping, wait mainq drain, curr size %d\n", iMsgQueueSize);
- srSleep(0,2); /* wait a little bit */
- CHKiRet(diagGetMainMsgQSize(&iMsgQueueSize));
+ while(1) {
if(iMsgQueueSize == 0) {
/* verify that queue is still empty (else it could just be a race!) */
- srSleep(1,5); /* wait a little bit */
+ srSleep(0,250000);/* wait a little bit */
CHKiRet(diagGetMainMsgQSize(&iMsgQueueSize));
+ if(iMsgQueueSize == 0) {
+ srSleep(0,500000);/* wait a little bit */
+ CHKiRet(diagGetMainMsgQSize(&iMsgQueueSize));
+ }
}
+ if(iMsgQueueSize == 0)
+ break;
+ if(iPrint++ % 500 == 0)
+ dbgprintf("imdiag sleeping, wait mainq drain, curr size %d\n", iMsgQueueSize);
+ srSleep(0,200000);/* wait a little bit */
+ CHKiRet(diagGetMainMsgQSize(&iMsgQueueSize));
}
CHKiRet(sendResponse(pSess, "mainqueue empty\n"));