From: hadaq Date: Tue, 16 Aug 2011 10:54:41 +0000 (+0000) Subject: Try: flush all queues when encountering too many discarded subevents at synchronizati... X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=ba3b9ab17a8edf46c29c8551bd10a4176baa193f;p=daqdata.git Try: flush all queues when encountering too many discarded subevents at synchronization with master channel. May help system to recover when driven with high data rate? JAM --- diff --git a/hadaq/evtbuild.c b/hadaq/evtbuild.c index d8efa84..c4fb600 100644 --- a/hadaq/evtbuild.c +++ b/hadaq/evtbuild.c @@ -1,4 +1,4 @@ -static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.153 2011-08-14 14:18:39 hadaq Exp $"; +static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.154 2011-08-16 10:54:41 hadaq Exp $"; #define _POSIX_C_SOURCE 199309L #define SYSLOG_NAMES @@ -53,8 +53,8 @@ static RFILE *fRemote = NULL; #define DAQVERSION 2 /* needed by Hydra unpackers */ #define RUNID_INFO_DT 600 /* time in s until not available runid info is logged */ -#define LOST_SUBEVT_LIMIT 50000 /* number of popped subevents per trigger sequence until warning */ -#define LOST_SUBEVT_TERM 20 /* terminate after this number of lost sub warnings per trigger sequence */ +#define LOST_SUBEVT_LIMIT 10000 /* number of popped subevents per trigger sequence until warning */ +#define LOST_SUBEVT_DROP 2 /* drop all queue contents after this number of lost sub warnings per trigger sequence */ #define NEVTIDS 64UL /* must be 2^n */ #define NEVTIDS_IN_FILE 0UL /* must be 2^n */ @@ -296,7 +296,7 @@ int isMismatchCritical(TheArgs *theArgs, TheStats *my) int retVal = 0; if (theArgs->maxTrigMismatch == -1) { - theArgs->maxTrigMismatch = 30; /* JAM: set reasonable default if not specified */ + theArgs->maxTrigMismatch = 90; /* JAM: set reasonable default if not specified */ sprintf(msglog, " Critical trigger mismatch ratio takes default of %d %% ", theArgs->maxTrigMismatch); storeLogInfo(theArgs, msglog); /*return retVal; */ @@ -874,7 +874,7 @@ static int rfio_closeConnection(TheArgs *theArgs) /* BUGBUG bailOut not proper yet */ int main(int argc, char *argv[]) { - int i; + int i, q; TheArgs theArgsS, *theArgs = &theArgsS; TheStats theStatsS, *theStats = &theStatsS; TheDebug theDebugS, *theDebug = &theDebugS; @@ -1302,9 +1302,21 @@ int main(int argc, char *argv[]) storeLogInfo(theArgs, msglog); popTermCnt++; } - if (popTermCnt > LOST_SUBEVT_TERM) { - storeLogInfo(theArgs, " too many lost subevents. Exiting now!"); - goto bailOut1; + if (popTermCnt > LOST_SUBEVT_DROP) { + /* storeLogInfo(theArgs, " too many lost subevents. Exiting now!"); + goto bailOut1; */ + + /* throw away all queues and start again: */ + storeLogInfo(theArgs, " too many lost subevents. Dropping all queues!"); + for (q = 0; q < theArgs->nrOfMsgs; q++) { + HadTuQueue_clear(hadTuQueue[q]); + desHadTuQueue(hadTuQueue[q]); + free(hadTuQueue[q]); + hadTuQueue[q] = NULL; + ShmTrans_free(shmTrans[q]); + } + i = 0; /* start again with evaluating other double buffer */ + step = 1; } } } else {