From 57a944aefc52c98730ec8c0f8f1772fd6318624b Mon Sep 17 00:00:00 2001 From: zhengshuxin Date: Fri, 26 Jan 2024 09:18:27 +0800 Subject: [PATCH 1/2] Don't write log when messages are empty in redis_client_pipeline::flush_all(). --- lib_acl_cpp/src/redis/redis_client_pipeline.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_acl_cpp/src/redis/redis_client_pipeline.cpp b/lib_acl_cpp/src/redis/redis_client_pipeline.cpp index dd937f43e..d4c12f5c4 100644 --- a/lib_acl_cpp/src/redis/redis_client_pipeline.cpp +++ b/lib_acl_cpp/src/redis/redis_client_pipeline.cpp @@ -61,7 +61,7 @@ void redis_pipeline_channel::push(redis_pipeline_message* msg) bool redis_pipeline_channel::flush_all(void) { if (msgs_.empty()) { - logger("The messages are empty!"); + //logger("The messages are empty!"); return true; } From ae87f9e3c71b2e80d83ef16b82e68b2ed33746a7 Mon Sep 17 00:00:00 2001 From: zhengshuxin Date: Fri, 26 Jan 2024 18:34:42 +0800 Subject: [PATCH 2/2] Make acl_fiber_kill() more safety. --- lib_acl/src/master/template/acl_aio_server.c | 4 ++-- lib_fiber/c/src/fiber_io.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib_acl/src/master/template/acl_aio_server.c b/lib_acl/src/master/template/acl_aio_server.c index 2b1dd1557..2c2c5e377 100644 --- a/lib_acl/src/master/template/acl_aio_server.c +++ b/lib_acl/src/master/template/acl_aio_server.c @@ -925,9 +925,9 @@ static void dispatch_receive(int event_type acl_unused, ACL_EVENT *event, ret = acl_read_fd(ACL_VSTREAM_SOCK(conn), buf, sizeof(buf) - 1, &fd); if (ret <= 0 || fd < 0) { - acl_msg_warn("%s(%d), %s: read from master_dispatch(%s) error", + acl_msg_warn("%s(%d), %s: read from master_dispatch(%s) error %s", __FUNCTION__, __LINE__, myname, - acl_var_aio_dispatch_addr); + acl_var_aio_dispatch_addr, acl_last_serror()); acl_event_disable_read(event, conn); acl_vstream_close(conn); diff --git a/lib_fiber/c/src/fiber_io.c b/lib_fiber/c/src/fiber_io.c index 1b11016b4..edd27e501 100644 --- a/lib_fiber/c/src/fiber_io.c +++ b/lib_fiber/c/src/fiber_io.c @@ -432,8 +432,10 @@ static void read_callback(EVENT *ev, FILE_EVENT *fe) /* If the reader fiber has been set in ready status when the * other fiber killed the reader fiber, the reader fiber should * not be set in ready queue again. + * We should check if fe->fiber_r is NULL, which maybe set NULL if + * the other fiber acl_fiber_kill() the fiber_r before. */ - if (fe->fiber_r->status != FIBER_STATUS_READY) { + if (fe->fiber_r && fe->fiber_r->status != FIBER_STATUS_READY) { acl_fiber_ready(fe->fiber_r); } } @@ -497,7 +499,7 @@ static void write_callback(EVENT *ev, FILE_EVENT *fe) * other fiber killed the writer fiber, the writer fiber should * not be set in ready queue again. */ - if (fe->fiber_w->status != FIBER_STATUS_READY) { + if (fe->fiber_w && fe->fiber_w->status != FIBER_STATUS_READY) { acl_fiber_ready(fe->fiber_w); } }