Skip to content

Commit 5db9495

Browse files
committed
Merge branch 'dev' into stable-sync
2 parents b3e2faa + 05e0d45 commit 5db9495

File tree

995 files changed

+38690
-12914
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

995 files changed

+38690
-12914
lines changed

.github/workflows/clean-test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ name: Clean PR checks
4343
description: build/O2/o2-dataflow-cs8
4444
type: boolean
4545
default: true
46+
'check_build/O2/o2/aarch64':
47+
description: build/O2/o2/aarch64
48+
type: boolean
49+
default: true
50+
'check_build/O2/o2_slc9':
51+
description: build/O2/o2_slc9
52+
type: boolean
53+
default: true
54+
4655

4756
permissions: {}
4857

.github/workflows/datamodel-doc.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
run: |
4949
python3 -m pip install --user -U numpy nltk
5050
python3 -m nltk.downloader -d ~/nltk_data punkt
51+
python3 -m nltk.downloader -d ~/nltk_data punkt_tab
5152
5253
- name: Generate documentation
5354
run: exec bash -exo pipefail O2/scripts/datamodel-doc/update-datamodel.sh
@@ -59,6 +60,7 @@ jobs:
5960
run: |
6061
# git diff --quiet exits with 1 if any tracked files have changed, and
6162
# with 0 otherwise.
63+
set -e
6264
if git diff --quiet; then
6365
exit # Nothing has changed, so no need to send a PR.
6466
fi
@@ -68,9 +70,10 @@ jobs:
6870
git push -f origin auto-datamodel-doc
6971
7072
# Send pull request
71-
# We need to use "hub" ourselves because alisw/pull-request gets
73+
# We need to use "gh" ourselves because alisw/pull-request gets
7274
# confused when multiple repos are checked out.
73-
hub pull-request -b AliceO2Group:master -h alibuild:auto-datamodel-doc \
74-
--no-edit --no-maintainer-edits -m 'Automatic data model update' \
75-
-m "This update to the data model documentation was automatically created from tonight's O2 dev branch." ||
76-
: # If the PR already exists, hub fails, but we've just force-pushed, so we don't need a new PR.
75+
GH_TOKEN="$GITHUB_TOKEN" gh pr create -R AliceO2Group/analysis-framework -B master \
76+
--no-maintainer-edit -t 'Automatic data model update' -b "This update \
77+
to the data model documentation was automatically created from \
78+
tonight's O2 dev branch." || true
79+
# If the PR already exists, hub fails, but we've just force-pushed, so we don't need a new PR.

.github/workflows/reports.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,6 @@ jobs:
126126
git config --global user.name "GitHub Action Bot"
127127
git commit -m "Updated README" -a || echo "No changes to commit"
128128
git push origin HEAD:changelog -f
129-
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
130-
hub pull-request -f -b dev -h changelog \
131-
--no-edit --no-maintainer-edits \
132-
'Auto-generated changelog' \
133-
-m 'The following changelog has been automatically generated.' ||
134-
# If the PR already exists, the force-push will have updated it.
135-
# It's fine if this step fails.
136-
true
129+
# If the PR already exists, the force-push will have updated it.
130+
# It's fine if this step fails.
131+
GH_TOKEN=${{ secrets.GITHUB_TOKEN }} gh pr create -B dev -H changelog -t 'Auto-generated changelog' -b 'The following changelog has been automatically generated.' || true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ compile_commands.json
6363
.vscode
6464
.ycm_extra_conf.py
6565
Session.vim
66+
CMakeLists.txt.user
6667

6768
# Datafiles
6869
gphysi.dat

CCDB/include/CCDB/CCDBDownloader.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ curl_socket_t opensocketCallback(void* clientp, curlsocktype purpose, struct cur
8787
*/
8888
void onUVClose(uv_handle_t* handle);
8989

90+
enum DownloaderErrorLevel {
91+
MINOR,
92+
SEVERE
93+
};
94+
9095
/// A class encapsulating and performing simple CURL requests in terms of a so-called CURL multi-handle.
9196
/// A multi-handle allows to use a connection pool (connection cache) in the CURL layer even
9297
/// with short-lived CURL easy-handles. Thereby the overhead of connection to servers can be

CCDB/include/CCDB/CcdbApi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,8 @@ class CcdbApi //: public DatabaseInterface
629629
static std::unique_ptr<TJAlienCredentials> mJAlienCredentials; // access JAliEn credentials
630630
int mCurlRetries = 3;
631631
int mCurlDelayRetries = 100000; // in microseconds
632+
size_t mCurlTimeoutDownload = 15; // download timeout in seconds, can be configured via ALICEO2_CCDB_CURL_TIMEOUT_DOWNLOAD, updated according to the deployment mode
633+
size_t mCurlTimeoutUpload = 15; // upload timeout in seconds, can be configured via ALICEO2_CCDB_CURL_TIMEOUT_UPLOAD, updated according to the deployment mode
632634

633635
ClassDefNV(CcdbApi, 1);
634636
};

CCDB/src/CCDBDownloader.cxx

Lines changed: 51 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <CCDB/CCDBDownloader.h>
1313
#include "CommonUtils/StringUtils.h"
1414
#include "CCDB/CCDBTimeStampUtils.h"
15+
#include "Framework/Signpost.h"
1516

1617
#include <curl/curl.h>
1718
#include <unordered_map>
@@ -29,29 +30,38 @@
2930
#include <fairlogger/Logger.h>
3031
#include <boost/asio/ip/host_name.hpp>
3132

33+
O2_DECLARE_DYNAMIC_STACKTRACE_LOG(ccdb_downloader);
34+
3235
namespace o2::ccdb
3336
{
3437

35-
void uvErrorCheck(int code)
38+
void uvErrorCheck(int code, DownloaderErrorLevel level)
3639
{
3740
if (code != 0) {
3841
char buf[1000];
3942
uv_strerror_r(code, buf, 1000);
40-
LOG(error) << "CCDBDownloader: UV error - " << buf;
43+
O2_SIGNPOST_ID_GENERATE(sid, ccdb_downloader);
44+
if (level == SEVERE) {
45+
O2_SIGNPOST_EVENT_EMIT_ERROR(ccdb_downloader, sid, "CCDBDownloader", "UV error - %{public}s", buf);
46+
} else {
47+
O2_SIGNPOST_EVENT_EMIT_WARN(ccdb_downloader, sid, "CCDBDownloader", "UV minor error - %{public}s", buf);
48+
}
4149
}
4250
}
4351

4452
void curlEasyErrorCheck(CURLcode code)
4553
{
4654
if (code != CURLE_OK) {
47-
LOG(error) << "CCDBDownloader: CURL error - " << curl_easy_strerror(code);
55+
O2_SIGNPOST_ID_GENERATE(sid, ccdb_downloader);
56+
O2_SIGNPOST_EVENT_EMIT_ERROR(ccdb_downloader, sid, "CCDBDownloader", "CURL error - %{public}s", curl_easy_strerror(code));
4857
}
4958
}
5059

5160
void curlMultiErrorCheck(CURLMcode code)
5261
{
5362
if (code != CURLM_OK) {
54-
LOG(error) << "CCDBDownloader: CURL error - " << curl_multi_strerror(code);
63+
O2_SIGNPOST_ID_GENERATE(sid, ccdb_downloader);
64+
O2_SIGNPOST_EVENT_EMIT_ERROR(ccdb_downloader, sid, "CCDBDownloader", "CURL error - %{public}s", curl_multi_strerror(code));
5565
}
5666
}
5767
namespace
@@ -80,9 +90,9 @@ CCDBDownloader::CCDBDownloader(uv_loop_t* uv_loop)
8090
}
8191

8292
// Preparing timer to be used by curl
83-
mTimeoutTimer = new uv_timer_t();
93+
mTimeoutTimer = (uv_timer_t*)malloc(sizeof(*mTimeoutTimer));
8494
mTimeoutTimer->data = this;
85-
uvErrorCheck(uv_timer_init(mUVLoop, mTimeoutTimer));
95+
uvErrorCheck(uv_timer_init(mUVLoop, mTimeoutTimer), SEVERE);
8696
mHandleMap[(uv_handle_t*)mTimeoutTimer] = true;
8797

8898
initializeMultiHandle();
@@ -91,7 +101,7 @@ CCDBDownloader::CCDBDownloader(uv_loop_t* uv_loop)
91101
void CCDBDownloader::setupInternalUVLoop()
92102
{
93103
mUVLoop = new uv_loop_t();
94-
uvErrorCheck(uv_loop_init(mUVLoop));
104+
uvErrorCheck(uv_loop_init(mUVLoop), SEVERE);
95105
}
96106

97107
void CCDBDownloader::initializeMultiHandle()
@@ -114,7 +124,7 @@ CCDBDownloader::~CCDBDownloader()
114124

115125
if (!mExternalLoop) {
116126
// Schedule all handles to close. Execute loop to allow them to execute their destructors.
117-
while (uv_loop_alive(mUVLoop) && uv_loop_close(mUVLoop) == UV_EBUSY) {
127+
while (uv_loop_alive(mUVLoop) || (uv_loop_close(mUVLoop) == UV_EBUSY)) {
118128
uv_walk(mUVLoop, closeHandles, this);
119129
uv_run(mUVLoop, UV_RUN_ONCE);
120130
}
@@ -136,7 +146,7 @@ void closeHandles(uv_handle_t* handle, void* arg)
136146
void onUVClose(uv_handle_t* handle)
137147
{
138148
if (handle != nullptr) {
139-
delete handle;
149+
free(handle);
140150
}
141151
}
142152

@@ -147,20 +157,22 @@ void CCDBDownloader::closesocketCallback(void* clientp, curl_socket_t item)
147157
// If external uv loop is used then the keepalive mechanism is active.
148158
if (CD->mSocketTimerMap.find(item) != CD->mSocketTimerMap.end()) {
149159
auto timer = CD->mSocketTimerMap[item];
150-
uvErrorCheck(uv_timer_stop(timer));
160+
uvErrorCheck(uv_timer_stop(timer), SEVERE);
151161
// we are getting rid of the uv_timer_t pointer ... so we need
152162
// to free possibly attached user data pointers as well. Counteracts action of opensocketCallback
153163
if (timer->data) {
154164
delete (DataForClosingSocket*)timer->data;
155165
}
156166
CD->mSocketTimerMap.erase(item);
157167
if (close(item) == -1) {
158-
LOG(error) << "CCDBDownloader: Socket failed to close";
168+
O2_SIGNPOST_ID_GENERATE(sid, ccdb_downloader);
169+
O2_SIGNPOST_EVENT_EMIT_ERROR(ccdb_downloader, sid, "CCDBDownloader", "CCDBDownloader: Socket failed to close");
159170
}
160171
}
161172
} else {
162173
if (close(item) == -1) {
163-
LOG(error) << "CCDBDownloader: Socket failed to close";
174+
O2_SIGNPOST_ID_GENERATE(sid, ccdb_downloader);
175+
O2_SIGNPOST_EVENT_EMIT_ERROR(ccdb_downloader, sid, "CCDBDownloader", "CCDBDownloader: Socket failed to close");
164176
}
165177
}
166178
}
@@ -170,12 +182,13 @@ curl_socket_t opensocketCallback(void* clientp, curlsocktype purpose, struct cur
170182
auto CD = (CCDBDownloader*)clientp;
171183
auto sock = socket(address->family, address->socktype, address->protocol);
172184
if (sock == -1) {
173-
LOG(error) << "CCDBDownloader: Socket failed to open";
185+
O2_SIGNPOST_ID_GENERATE(sid, ccdb_downloader);
186+
O2_SIGNPOST_EVENT_EMIT_ERROR(ccdb_downloader, sid, "CCDBDownloader", "CCDBDownloader: Socket failed to open");
174187
}
175188

176189
if (CD->mExternalLoop) {
177-
CD->mSocketTimerMap[sock] = new uv_timer_t();
178-
uvErrorCheck(uv_timer_init(CD->mUVLoop, CD->mSocketTimerMap[sock]));
190+
CD->mSocketTimerMap[sock] = (uv_timer_t*)malloc(sizeof(*CD->mSocketTimerMap[sock]));
191+
uvErrorCheck(uv_timer_init(CD->mUVLoop, CD->mSocketTimerMap[sock]), SEVERE);
179192
CD->mHandleMap[(uv_handle_t*)CD->mSocketTimerMap[sock]] = true;
180193

181194
auto data = new DataForClosingSocket();
@@ -194,10 +207,11 @@ void CCDBDownloader::closeSocketByTimer(uv_timer_t* handle)
194207
auto sock = data->socket;
195208

196209
if (CD->mSocketTimerMap.find(sock) != CD->mSocketTimerMap.end()) {
197-
uvErrorCheck(uv_timer_stop(CD->mSocketTimerMap[sock]));
210+
uvErrorCheck(uv_timer_stop(CD->mSocketTimerMap[sock]), SEVERE);
198211
CD->mSocketTimerMap.erase(sock);
199212
if (close(sock) == -1) {
200-
LOG(error) << "CCDBDownloader: Socket failed to close";
213+
O2_SIGNPOST_ID_GENERATE(sid, ccdb_downloader);
214+
O2_SIGNPOST_EVENT_EMIT_ERROR(ccdb_downloader, sid, "CCDBDownloader", "CCDBDownloader: Socket failed to close");
201215
}
202216
delete data;
203217
}
@@ -213,7 +227,7 @@ void CCDBDownloader::curlTimeout(uv_timer_t* handle)
213227

214228
void CCDBDownloader::curlPerform(uv_poll_t* handle, int status, int events)
215229
{
216-
uvErrorCheck(status);
230+
uvErrorCheck(status, MINOR);
217231
int running_handles;
218232
int flags = 0;
219233
if (events & UV_READABLE) {
@@ -252,20 +266,20 @@ int CCDBDownloader::handleSocket(CURL* easy, curl_socket_t s, int action, void*
252266
}
253267

254268
if (CD->mExternalLoop && CD->mSocketTimerMap.find(s) != CD->mSocketTimerMap.end()) {
255-
uvErrorCheck(uv_timer_stop(CD->mSocketTimerMap[s]));
269+
uvErrorCheck(uv_timer_stop(CD->mSocketTimerMap[s]), SEVERE);
256270
}
257271

258-
uvErrorCheck(uv_poll_start(curl_context->poll_handle, events, curlPerform));
272+
uvErrorCheck(uv_poll_start(curl_context->poll_handle, events, curlPerform), SEVERE);
259273
break;
260274
case CURL_POLL_REMOVE:
261275
if (socketp) {
262276
if (CD->mExternalLoop) {
263277
// If external loop is used then start the keepalive timeout.
264278
if (CD->mSocketTimerMap.find(s) != CD->mSocketTimerMap.end()) {
265-
uvErrorCheck(uv_timer_start(CD->mSocketTimerMap[s], closeSocketByTimer, CD->mKeepaliveTimeoutMS, 0));
279+
uvErrorCheck(uv_timer_start(CD->mSocketTimerMap[s], closeSocketByTimer, CD->mKeepaliveTimeoutMS, 0), SEVERE);
266280
}
267281
}
268-
uvErrorCheck(uv_poll_stop(((CCDBDownloader::curl_context_t*)socketp)->poll_handle));
282+
uvErrorCheck(uv_poll_stop(((CCDBDownloader::curl_context_t*)socketp)->poll_handle), SEVERE);
269283
CD->destroyCurlContext((CCDBDownloader::curl_context_t*)socketp);
270284
curlMultiErrorCheck(curl_multi_assign(socketData->curlm, s, nullptr));
271285
}
@@ -323,9 +337,9 @@ CCDBDownloader::curl_context_t* CCDBDownloader::createCurlContext(curl_socket_t
323337
context = (curl_context_t*)malloc(sizeof(*context));
324338
context->CD = this;
325339
context->sockfd = sockfd;
326-
context->poll_handle = new uv_poll_t();
340+
context->poll_handle = (uv_poll_t*)malloc(sizeof(*context->poll_handle));
327341

328-
uvErrorCheck(uv_poll_init_socket(mUVLoop, context->poll_handle, sockfd));
342+
uvErrorCheck(uv_poll_init_socket(mUVLoop, context->poll_handle, sockfd), SEVERE);
329343
mHandleMap[(uv_handle_t*)(context->poll_handle)] = true;
330344
context->poll_handle->data = context;
331345

@@ -335,7 +349,7 @@ CCDBDownloader::curl_context_t* CCDBDownloader::createCurlContext(curl_socket_t
335349
void CCDBDownloader::curlCloseCB(uv_handle_t* handle)
336350
{
337351
auto* context = (curl_context_t*)handle->data;
338-
delete context->poll_handle;
352+
free(context->poll_handle);
339353
free(context);
340354
}
341355

@@ -470,6 +484,10 @@ void CCDBDownloader::transferFinished(CURL* easy_handle, CURLcode curlCode)
470484
bool rescheduled = false;
471485
bool contentRetrieved = false;
472486

487+
if (curlCode != 0) {
488+
LOG(error) << "CCDBDownloader CURL transfer error - " << curl_easy_strerror(curlCode) << "\n";
489+
}
490+
473491
switch (performData->type) {
474492
case BLOCKING: {
475493
--(*performData->requestsLeft);
@@ -502,12 +520,17 @@ void CCDBDownloader::transferFinished(CURL* easy_handle, CURLcode curlCode)
502520
} else if (300 <= httpCode && httpCode < 400 && performData->locInd < locations.size()) {
503521
followRedirect(performData, easy_handle, locations, rescheduled, contentRetrieved);
504522
} else if (200 <= httpCode && httpCode < 300) {
505-
contentRetrieved = true;
523+
contentRetrieved = true; // Can be overruled by following error check
506524
}
507525
} else {
508526
LOG(error) << loggingMessage;
509527
}
510528

529+
// Check for errors
530+
if (curlCode != 0) {
531+
contentRetrieved = false;
532+
}
533+
511534
// Check if content was retrieved, or scheduled to be retrieved
512535
if (!rescheduled && !contentRetrieved && performData->locInd == locations.size()) {
513536
// Ran out of locations to redirect, try new host
@@ -579,12 +602,12 @@ int CCDBDownloader::startTimeout(CURLM* multi, long timeout_ms, void* userp)
579602
auto timeout = (uv_timer_t*)userp;
580603

581604
if (timeout_ms < 0) {
582-
uvErrorCheck(uv_timer_stop(timeout));
605+
uvErrorCheck(uv_timer_stop(timeout), SEVERE);
583606
} else {
584607
if (timeout_ms == 0) {
585608
timeout_ms = 1; // Calling curlTimeout when timeout = 0 could create an infinite loop
586609
}
587-
uvErrorCheck(uv_timer_start(timeout, curlTimeout, timeout_ms, 0));
610+
uvErrorCheck(uv_timer_start(timeout, curlTimeout, timeout_ms, 0), SEVERE);
588611
}
589612
return 0;
590613
}

0 commit comments

Comments
 (0)