summaryrefslogtreecommitdiffstats
path: root/database
diff options
context:
space:
mode:
authorStelios Fragkakis <52996999+stelfrag@users.noreply.github.com>2021-08-19 13:48:49 +0300
committerGitHub <noreply@github.com>2021-08-19 13:48:49 +0300
commit1e415e4a04efa1e8317403d4d9aa7125b31a3e39 (patch)
treeee6f984ca4018e96c4c2de9fb70028ab60810519 /database
parent2a96d78dab43800df55df634a54f2feb74f517eb (diff)
Fix list corruption in ACLK sync code and remove fatal (#11444)
* Make sure an element was found for removal * Remove fatal if async send fails Add newline
Diffstat (limited to 'database')
-rw-r--r--database/sqlite/sqlite_aclk.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/database/sqlite/sqlite_aclk.c b/database/sqlite/sqlite_aclk.c
index 49eb7d1321..6e22be80ed 100644
--- a/database/sqlite/sqlite_aclk.c
+++ b/database/sqlite/sqlite_aclk.c
@@ -47,9 +47,10 @@ void aclk_del_worker_thread(struct aclk_database_worker_config *wc)
uv_mutex_lock(&aclk_async_lock);
struct aclk_database_worker_config **tmp = &aclk_thread_head;
- while ((*tmp) != wc)
+ while (*tmp && (*tmp) != wc)
tmp = &(*tmp)->next;
- *tmp = wc->next;
+ if (*tmp)
+ *tmp = wc->next;
uv_mutex_unlock(&aclk_async_lock);
return;
}
@@ -134,7 +135,9 @@ void aclk_database_enq_cmd(struct aclk_database_worker_config *wc, struct aclk_d
uv_mutex_unlock(&wc->cmd_mutex);
/* wake up event loop */
- fatal_assert(0 == uv_async_send(&wc->async));
+ int rc = uv_async_send(&wc->async);
+ if (unlikely(rc))
+ debug(D_ACLK_SYNC, "Failed to wake up event loop");
}
struct aclk_database_cmd aclk_database_deq_cmd(struct aclk_database_worker_config* wc)
@@ -851,4 +854,4 @@ void aclk_data_rotated(RRDHOST *host)
}
uv_mutex_unlock(&aclk_async_lock);
return;
-} \ No newline at end of file
+}