Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

usleep returns ESTOP when schedule timer failed #2435

Merged
merged 1 commit into from
Dec 16, 2023

Conversation

chenBright
Copy link
Contributor

@chenBright chenBright commented Oct 31, 2023

What problem does this PR solve?

Issue Number:

Problem Summary:

_add_sleep_event失败后,bthread_usleep并没有真正sleep,只是重新调度了,这时候应该返回错误。一些场景下会有死循环风险,例如:

if (bthread_usleep(GetNamingServiceAccessIntervalMs() * 1000UL) < 0) {
if (errno == ESTOP) {
RPC_VLOG << "Quit NamingServiceThread=" << bthread_self();
return 0;
}
PLOG(FATAL) << "Fail to sleep";
return -1;
}

What is changed and the side effects?

Changed:

Side effects:

  • Performance effects(性能影响):

  • Breaking backward compatibility(向后兼容性):


Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

@chenBright chenBright marked this pull request as draft November 1, 2023 02:29
@chenBright chenBright marked this pull request as ready for review November 1, 2023 03:42
@wwbmmm
Copy link
Contributor

wwbmmm commented Nov 10, 2023

LGTM

@lorinlee lorinlee merged commit 9b15c3b into apache:master Dec 16, 2023
@chenBright chenBright deleted the fix_usleep branch December 17, 2023 07:06
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants