Skip to content
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

Closed
hahahashen opened this issue Apr 16, 2024 · 6 comments
Labels
☢️ Bug Something isn't working

Comments

@hahahashen
Copy link
Contributor

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

image
image
image
image

Please provide the version you discovered this bug in (check about page for version information)

commit hash:57248c3b612a5c2bf0a89586262b616eff1ffde4

Anything else?

No response

@hahahashen hahahashen added the ☢️ Bug Something isn't working label Apr 16, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: bug:

@AlexStocks
Copy link
Contributor

这个 issue title 怎么是空的

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Why is this issue title empty?

@hahahashen hahahashen changed the title bug: bug: do not config worker-threads and slave-threads, program will abnormal quit Apr 16, 2024
@hahahashen
Copy link
Contributor Author

这个 issue title 怎么是空的
刚刚编辑上了= =

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Why is this issue title empty?
Just edited it = =

@hahahashen
Copy link
Contributor Author

hahahashen commented Apr 17, 2024

或者运行的时候conf指定worker-threads以及slave-threads为1时也会导致运行时程序异常退出

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
☢️ Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants