Skip to content

Add flag for bthread priority queue, the default is false#3078

Merged
chenBright merged 2 commits intoapache:masterfrom
chenBright:fix_unexpected_priority_task
Sep 1, 2025
Merged

Add flag for bthread priority queue, the default is false#3078
chenBright merged 2 commits intoapache:masterfrom
chenBright:fix_unexpected_priority_task

Conversation

@chenBright
Copy link
Copy Markdown
Contributor

@chenBright chenBright commented Aug 30, 2025

What problem does this PR solve?

Issue Number: #3030

Problem Summary:

  1. epoll bthread deal first #2819 has bugs(在高并发场景下server直接hang死 #3030).
  2. Bugfix: Only event dispatcher thread has flag BTHREAD_GLOBAL_PRIORITY #3055 only fixes Socket IO,not all IO types.

What is changed and the side effects?

Changed:

Side effects:

  • Performance effects:

  • Breaking backward compatibility:


Check List:

Comment thread src/brpc/event_dispatcher_kqueue.cpp
@wwbmmm
Copy link
Copy Markdown
Contributor

wwbmmm commented Aug 30, 2025

LGTM

@chenBright chenBright force-pushed the fix_unexpected_priority_task branch from da7964c to 8485222 Compare August 31, 2025 13:27
@yanglimingcn
Copy link
Copy Markdown
Contributor

LGTM

@chenBright chenBright merged commit 018ce77 into apache:master Sep 1, 2025
16 checks passed
@chenBright chenBright deleted the fix_unexpected_priority_task branch September 1, 2025 06:09
@lhsoft
Copy link
Copy Markdown
Contributor

lhsoft commented Sep 9, 2025

@chenBright 看起来是通过flag暂时关闭这个功能?如果我设置enable_bthread_priority_queue为true,还是会hung死吧

@chenBright
Copy link
Copy Markdown
Contributor Author

@chenBright 看起来是通过flag暂时关闭这个功能?如果我设置enable_bthread_priority_queue为true,还是会hung死吧

现在只有epoll bthread才有BTHREAD_GLOBAL_PRIORITY,应该不会出现这个问题了吧。

@lhsoft
Copy link
Copy Markdown
Contributor

lhsoft commented Sep 9, 2025

@chenBright

现在只有epoll bthread才有BTHREAD_GLOBAL_PRIORITY,应该不会出现这个问题了吧。

FLAGS_event_dispatcher_num > 1 的情况下,应该还是会有多个吧

@chenBright
Copy link
Copy Markdown
Contributor Author

@chenBright

现在只有epoll bthread才有BTHREAD_GLOBAL_PRIORITY,应该不会出现这个问题了吧。

FLAGS_event_dispatcher_num > 1 的情况下,应该还是会有多个吧

是的,后续找时间修一下这个问题。

@ZhengweiZhu
Copy link
Copy Markdown
Contributor

_enable_priority_queue is not default initialized to false and may be true or false. I fixed it in #3096

@yannan-wyn
Copy link
Copy Markdown

@chenBright

现在只有epoll bthread才有BTHREAD_GLOBAL_PRIORITY,应该不会出现这个问题了吧。

FLAGS_event_dispatcher_num > 1 的情况下,应该还是会有多个吧

是的,后续找时间修一下这个问题。

https://github.com/apache/brpc/issues/3030提到的,
请问下 FLAGS_event_dispatcher_num > 1 的情况下, 用MPMC而不是WorkStealingQueue, 有没有修复。

@chenBright
Copy link
Copy Markdown
Contributor Author

chenBright commented Mar 11, 2026

@chenBright

现在只有epoll bthread才有BTHREAD_GLOBAL_PRIORITY,应该不会出现这个问题了吧。

FLAGS_event_dispatcher_num > 1 的情况下,应该还是会有多个吧

是的,后续找时间修一下这个问题。

https://github.com/apache/brpc/issues/3030提到的, 请问下 FLAGS_event_dispatcher_num > 1 的情况下, 用MPMC而不是WorkStealingQueue, 有没有修复。

还没。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants