Skip to content

Commit 8c58f9b

Browse files
authored
Merge pull request #278 from sy-c/master
v2.23.3
2 parents b2ffd3b + fdebf1c commit 8c58f9b

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

doc/releaseNotes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,3 +621,6 @@ This file describes the main feature changes for each readout.exe released versi
621621

622622
## v2.23.2 - 15/05/2024
623623
- Monitoring: added rolename tag.
624+
625+
## v2.23.3 - 21/05/2024
626+
- Bookkeeping: updates are now disabled after 3 failures (1 before). Log messages changed (logbook -> bookkeeping).

src/ReadoutVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
#define READOUT_VERSION "2.23.2"
12+
#define READOUT_VERSION "2.23.3"
1313

src/mainReadout.cxx

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class LogbookThread {
229229
if (publishRequest.load()) return __LINE__; // fail if request already pending
230230
publishRequest = 1;
231231
if (this->verbose) {
232-
theLog.log(LogInfoDevel_(3210), "Requested to publish logbook stats");
232+
theLog.log(LogInfoDevel_(3210), "Requested to publish bookkeeping stats");
233233
}
234234
if (timeoutMilliseconds > 0) {
235235
// wait request completed and check status
@@ -251,6 +251,8 @@ class LogbookThread {
251251
std::atomic<int> publishRequest; // flag to ask thread to publish current values
252252
std::atomic<int> publishSuccess; // flag to report status of latest publish operation
253253
void run() {
254+
int nSuccessiveFailures = 0;
255+
const int maxSuccessiveFailures = 3;
254256
setThreadName("logbook");
255257
// thread loop, 10Hz
256258
while (!shutdownRequest && (logbookHandle != nullptr)) {
@@ -268,20 +270,25 @@ class LogbookThread {
268270
(int64_t)snapshot.numberOfSubtimeframes.load(), (int64_t)snapshot.bytesReadout.load(), (int64_t)snapshot.bytesRecorded.load(), (int64_t)snapshot.bytesFairMQ.load()
269271
);
270272
if (this->verbose) {
271-
theLog.log(LogInfoDevel_(3210), "Publishing logbook stats: tf = %llu, bytesReadout = %llu", (unsigned long long)snapshot.numberOfSubtimeframes.load(), (unsigned long long)snapshot.bytesReadout.load());
273+
theLog.log(LogInfoDevel_(3210), "Publishing bookkeeping stats: tf = %llu, bytesReadout = %llu", (unsigned long long)snapshot.numberOfSubtimeframes.load(), (unsigned long long)snapshot.bytesReadout.load());
272274
}
273275
publishSuccess = 1;
274276
} catch (const std::exception& ex) {
275-
theLog.log(LogErrorDevel_(3210), "Failed to update logbook: %s", ex.what());
277+
theLog.log(LogErrorDevel_(3210), "Failed to update bookkeeping: %s", ex.what());
276278
} catch (...) {
277-
theLog.log(LogErrorDevel_(3210), "Failed to update logbook: unknown exception");
279+
theLog.log(LogErrorDevel_(3210), "Failed to update bookkeeping: unknown exception");
278280
}
279281
if (!publishSuccess.load()) {
280-
// closing logbook immediately
281-
logbookHandle = nullptr;
282-
theLog.log(LogErrorSupport_(3210), "Logbook now disabled");
283-
break;
284-
}
282+
nSuccessiveFailures++;
283+
if (nSuccessiveFailures >= maxSuccessiveFailures) {
284+
// closing logbook immediately
285+
logbookHandle = nullptr;
286+
theLog.log(LogErrorSupport_(3210), "Bookkeeping updates now disabled, after %d consecutive failures", nSuccessiveFailures);
287+
break;
288+
}
289+
} else {
290+
nSuccessiveFailures = 0;
291+
}
285292
}
286293
publishRequest = 0;
287294
}
@@ -470,7 +477,7 @@ void Readout::publishLogbookStats(int timeout)
470477
if (theLogbookThread != nullptr) {
471478
int err = theLogbookThread->publishStats(timeout);
472479
if ((timeout > 0) && (err)) {
473-
theLog.log(LogErrorDevel_(3210), "Logbook publish failed within given time (%d ms)", timeout);
480+
theLog.log(LogErrorDevel_(3210), "Bookkeeping publish failed within given time (%d ms)", timeout);
474481
}
475482
}
476483
#endif
@@ -1072,15 +1079,15 @@ int Readout::_configure(const boost::property_tree::ptree& properties)
10721079

10731080
if (cfgLogbookEnabled) {
10741081
#ifndef WITH_LOGBOOK
1075-
theLog.log(LogErrorDevel_(3210), "Logbook enabled in configuration, but feature not available in this build");
1082+
theLog.log(LogErrorDevel_(3210), "Bookkeeping enabled in configuration, but feature not available in this build");
10761083
#else
10771084
// configuration parameter: | readout | logbookUrl | string | | The address to be used for the logbook API. |
10781085
cfg.getOptionalValue<std::string>("readout.logbookUrl", cfgLogbookUrl);
10791086

10801087
theLog.log(LogInfoDevel, "Logbook enabled, %ds update interval, using URL = %s", cfgLogbookUpdateInterval, cfgLogbookUrl.c_str());
10811088
auto logbookHandle = o2::bkp::api::BkpClientFactory::create(cfgLogbookUrl);
10821089
if (logbookHandle == nullptr) {
1083-
theLog.log(LogErrorSupport_(3210), "Failed to create handle to logbook");
1090+
theLog.log(LogErrorSupport_(3210), "Failed to create handle to bookkeeping");
10841091
} else {
10851092
theLogbookThread = std::make_unique<LogbookThread>(std::move(logbookHandle));
10861093
}

src/readoutErrorCodes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
{ 3103, "Inconsistent parameters in configuration.", nullptr},
3636
{ 3104, "Some valid but unsafe configuration parameters are used.", nullptr},
3737
38-
{ 3210, "Logbook problem", nullptr},
38+
{ 3210, "Bookkeeping problem", nullptr},
3939
{ 3220, "Timeframe server problem", nullptr},
4040
{ 3230, "Memory problem", nullptr},
4141
{ 3231, "Runtime problem", nullptr},

0 commit comments

Comments
 (0)