Looks good. Ack.
-----Original Message-----
From: Thien Minh Huynh <[email protected]>
Sent: Friday, April 7, 2023 2:22 PM
To: Thang Duc Nguyen <[email protected]>; Dat Tran Quoc Phan
<[email protected]>
Cc: [email protected]; Thien Minh Huynh
<[email protected]>
Subject: [PATCH 1/1] log: check the queue capacity before retrieving an item
[#3334]
Osaflogd occasionally fails to keep synchronization in a pair of nodes.
When received a pop request from active, standby will be coredump if retrieving
a piece from an empty queue.
This is done to avoid coredump by checking the queue capacity before retrieving
an item.
---
src/log/logd/lgs_mbcsv_v8.cc | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/log/logd/lgs_mbcsv_v8.cc b/src/log/logd/lgs_mbcsv_v8.cc index
289a4f610..97671cf40 100644
--- a/src/log/logd/lgs_mbcsv_v8.cc
+++ b/src/log/logd/lgs_mbcsv_v8.cc
@@ -205,6 +205,9 @@ uint32_t ckpt_proc_push_async(lgs_cb_t* cb, void* data) {
uint32_t ckpt_proc_pop_async(lgs_cb_t* cb, void* data) {
TRACE_ENTER();
assert(lgs_is_peer_v8() && "The peer should run with V8 or beyond!");
+ if (Cache::instance()->Size() == 0) {
+ return NCSCC_RC_FAILURE;
+ }
auto data_v8 = static_cast<lgsv_ckpt_msg_v8_t*>(data);
auto param = &data_v8->ckpt_rec.pop_async;
uint64_t seq_id = param->seq_id;
@@ -225,6 +228,11 @@ uint32_t ckpt_proc_pop_write_async(lgs_cb_t* cb, void*
data) {
assert(lgs_is_peer_v8() && "The peer should run with V8 or beyond!");
auto data_v8 = static_cast<lgsv_ckpt_msg_v8_t*>(data);
auto param = &data_v8->ckpt_rec.pop_and_write_async;
+ if (Cache::instance()->Size() == 0) {
+ lgs_free_edu_mem(param->log_record);
+ lgs_free_edu_mem(param->log_file);
+ return NCSCC_RC_FAILURE;
+ }
uint64_t seq_id = param->seq_id;
auto top = Cache::instance()->Front();
if (top->seq_id_ != seq_id) {
--
2.40.0
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel