Skip to content

Commit 1ff1138

Browse files
authored
CCDB: Ensure CCDBDownloader's libuv loop is properly deleted (#13238)
My valgrind checks were showing that the internal CCDBDownloader's libuv loop resources were not fully released. With this fix, valgrind is happy. The change is based on the following premises: - `uv_loop_alive` returns true if there are *active* handles - `uv_loop_close` returns `UV_EBUSY` if there are *open* handles. - we need to succesfully call `uv_loop_close` to clear `mUVLoop` resources Thus, in case that we would not have *active* handles, we would never close *open* ones, and consequently would not manage to call `uv_loop_close` without getting `UV_EBUSY`.
1 parent 4d2f4aa commit 1ff1138

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

CCDB/src/CCDBDownloader.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ CCDBDownloader::~CCDBDownloader()
114114

115115
if (!mExternalLoop) {
116116
// 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) {
117+
while (uv_loop_alive(mUVLoop) || (uv_loop_close(mUVLoop) == UV_EBUSY)) {
118118
uv_walk(mUVLoop, closeHandles, this);
119119
uv_run(mUVLoop, UV_RUN_ONCE);
120120
}

0 commit comments

Comments
 (0)