Closed hahahashen closed 4 months ago
Bot detected the issue body's language is not English, translate it automatically.
Title: bug:
这个 issue title 怎么是空的
Bot detected the issue body's language is not English, translate it automatically.
Why is this issue title empty?
这个 issue title 怎么是空的 刚刚编辑上了= =
Bot detected the issue body's language is not English, translate it automatically.
Why is this issue title empty? Just edited it = =
或者运行的时候conf指定worker-threads以及slave-threads为1时也会导致运行时程序异常退出
Is this a regression?
Yes
Description
当前有配置文件运行项目时,如果配置文件中没有指定worker-threads以及slave-threads,那么LoadPikiwiDBConfig函数的语句 cfg.worker_threads_num = parser.GetData("worker-threads", 1); cfg.slave_threads_num = parser.GetData("slave-threads", 1);就会设置.worker_threads_num、slave_threads_num 变量为1,而在IOThreadPool::SetWorkerNum函数处就会直接返回,导致IOThreadPool的成员变量worker_num_为初始值0,导致void WorkIOThreadPool::PushWriteTask(std::sharedptr client) 函数中出现除0错误,auto pos = ++counter % workernum;使得程序异常退出
解决方案: 方案1:设置默认值处,默认值设置为2 方案2:考虑IOThreadPool::SetWorkerNum函数if (num <= 1) 改为if (num <1)
Please provide a link to a minimal reproduction of the bug
No response
Screenshots or videos
Please provide the version you discovered this bug in (check about page for version information)
Anything else?
No response