Skip to content

Commit 2c5e93f

Browse files
committed
Try to reinit dogma transports if there are several "BAD" inputs over long time
1 parent fa8f650 commit 2c5e93f

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

plugins/dogma/dogma/CombinerModule.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ namespace dogma {
127127
fResortIndx = -1;
128128
}
129129

130+
void ResetCounters()
131+
{
132+
fLastTotalDataSize = 0;
133+
fLastLostTrig = 0;
134+
fBadStateCount = 0;
135+
}
136+
130137
std::string TriggerRingAsStr(int RingSize)
131138
{
132139
std::string sbuf;
@@ -282,7 +289,7 @@ namespace dogma {
282289
bool ShiftToNextBuffer(unsigned ninp);
283290

284291
/* cleanup input buffers in case of too large eventnumber mismatch*/
285-
bool DropAllInputBuffers();
292+
bool DropAllInputBuffers(bool reinit_transports = false);
286293

287294
//uint32_t CurrEventId(unsigned int ninp) const { return fCfg[ninp].curr_evnt_num; }
288295

plugins/dogma/src/CombinerModule.cxx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ void dogma::CombinerModule::ProcessTimerEvent(unsigned timer)
245245
}
246246

247247
if (timer_name == "BadInputs") {
248+
249+
int num_really_bad = 0;
248250
for (auto &cfg : fCfg) {
249251
// lost rate in 1000..1000000
250252
// datarate in 1M..100M
@@ -258,7 +260,15 @@ void dogma::CombinerModule::ProcessTimerEvent(unsigned timer)
258260

259261
cfg.fLastLostTrig = cfg.fLostTrig;
260262
cfg.fLastTotalDataSize = cfg.fTotalDataSize;
263+
264+
if (cfg.fBadStateCount > 10)
265+
num_really_bad++;
261266
}
267+
268+
if ((num_really_bad > 2) && fLastDropTm.Expired((fEventBuildTimeout > 0) ? 1.5*fEventBuildTimeout : 5.))
269+
DropAllInputBuffers(true);
270+
271+
return;
262272
}
263273

264274
if ((fFlushTimeout > 0) && (++fFlushCounter > 2)) {
@@ -891,7 +901,7 @@ bool dogma::CombinerModule::ShiftToNextSubEvent(unsigned ninp, bool fast, bool d
891901
return true;
892902
}
893903

894-
bool dogma::CombinerModule::DropAllInputBuffers()
904+
bool dogma::CombinerModule::DropAllInputBuffers(bool reinit_transports)
895905
{
896906
DOUT0("DropAllInputBuffers()...");
897907

@@ -902,6 +912,12 @@ bool dogma::CombinerModule::DropAllInputBuffers()
902912
if (fBNETsend)
903913
fCheckBNETProblems = chkActive; // activate testing again
904914

915+
if (reinit_transports)
916+
for (unsigned n = 0; n < NumInputs(); n++) {
917+
dabc::Command subcmd("ReinitTransport");
918+
SubmitCommandToTransport(InputName(n), subcmd);
919+
}
920+
905921
unsigned maxnumsubev = 0, droppeddata = 0;
906922

907923
for (unsigned ninp = 0; ninp < fCfg.size(); ninp++) {
@@ -917,6 +933,7 @@ bool dogma::CombinerModule::DropAllInputBuffers()
917933

918934
fCfg[ninp].Reset();
919935
fCfg[ninp].Close();
936+
fCfg[ninp].ResetCounters();
920937
while (SkipInputBuffers(ninp, 100)); // drop input port queue buffers until no more there
921938
}
922939

@@ -1470,6 +1487,8 @@ int dogma::CombinerModule::ExecuteCommand(dabc::Command cmd)
14701487
fCfg[n].fHubSizeTmCnt = 0;
14711488
fCfg[n].fHubLastSize = 0;
14721489
fCfg[n].fHubPrevSize = 0;
1490+
fCfg[n].fTotalDataSize = 0;
1491+
fCfg[n].ResetCounters();
14731492
dabc::Command subcmd("ResetTransportStat");
14741493
SubmitCommandToTransport(InputName(n), subcmd);
14751494
}

0 commit comments

Comments
 (0)