From 5c6cff1ea3b77281e7179669882b3b2374164acf Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Tue, 20 Oct 2020 20:40:55 +0800 Subject: [PATCH] check and correct thread_stack_size --- src/idempotency/client/client_channel.c | 2 +- src/sf_define.h | 1 + src/sf_global.c | 12 ++++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/idempotency/client/client_channel.c b/src/idempotency/client/client_channel.c index c30b21f..537cc9b 100644 --- a/src/idempotency/client/client_channel.c +++ b/src/idempotency/client/client_channel.c @@ -197,7 +197,7 @@ struct fast_task_info *alloc_channel_task(IdempotencyClientChannel *channel, channel->in_ioevent = 1; channel->last_connect_time = g_current_time; if ((*err_no=sf_nio_notify(task, SF_NIO_STAGE_CONNECT)) != 0) { - channel->in_ioevent = 0; + channel->in_ioevent = 0; //rollback free_queue_push(task); return NULL; } diff --git a/src/sf_define.h b/src/sf_define.h index fe009d0..a3b1ce0 100644 --- a/src/sf_define.h +++ b/src/sf_define.h @@ -21,6 +21,7 @@ #include "fastcommon/sockopt.h" #define SF_DEF_THREAD_STACK_SIZE (64 * 1024) +#define SF_MIN_THREAD_STACK_SIZE (64 * 1024) #define SF_DEF_MAX_PACKAGE_SIZE (64 * 1024) #define SF_DEF_MIN_BUFF_SIZE (64 * 1024) #define SF_DEF_MAX_BUFF_SIZE (64 * 1024) diff --git a/src/sf_global.c b/src/sf_global.c index 93f6634..cb28172 100644 --- a/src/sf_global.c +++ b/src/sf_global.c @@ -267,15 +267,19 @@ int sf_load_global_config_ex(const char *server_name, g_sf_global_vars.sync_log_buff_interval = SYNC_LOG_BUFF_DEF_INTERVAL; } - pThreadStackSize = iniGetStrValue(ini_ctx->section_name, - "thread_stack_size", ini_ctx->context); + pThreadStackSize = iniGetStrValueEx(ini_ctx->section_name, + "thread_stack_size", ini_ctx->context, true); if (pThreadStackSize == NULL) { thread_stack_size = SF_DEF_THREAD_STACK_SIZE; - } - else if ((result=parse_bytes(pThreadStackSize, 1, + } else if ((result=parse_bytes(pThreadStackSize, 1, &thread_stack_size)) != 0) { return result; + } else if (thread_stack_size < SF_MIN_THREAD_STACK_SIZE) { + logWarning("file: "__FILE__", line: %d, " + "thread_stack_size : %d is too small, set to %d", + __LINE__, (int)thread_stack_size, SF_MIN_THREAD_STACK_SIZE); + thread_stack_size = SF_MIN_THREAD_STACK_SIZE; } g_sf_global_vars.thread_stack_size = (int)thread_stack_size;