-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: do not config worker-threads and slave-threads, program will abnormal quit #286
Comments
Title: bug: |
这个 issue title 怎么是空的 |
Why is this issue title empty? |
|
|
或者运行的时候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::shared_ptr client) 函数中出现除0错误,auto pos = ++counter_ % worker_num_;使得程序异常退出
解决方案:
方案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
The text was updated successfully, but these errors were encountered: