fix: never lose a new-log wakeup dispatch in LogManagerImpl#1272
Closed
mayu-x wants to merge 1 commit into
Closed
Conversation
|
Hi @mayu-x, welcome to SOFAStack community, Please sign Contributor License Agreement! After you signed CLA, we will automatically sync the status of this pull request in 3 minutes. |
Contributor
|
这个问题其实不需要修改代码,ThreadPoolsFactory#registerThreadPool 提供注册自定义 executor,你自己注册合适的就好 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation:
当 JRAFT_GROUP_DEFAULT_EXECUTOR 线程池繁忙时,LogManagerImpl#wakeupAllWaiter 方法调用 ThreadPoolsFactory.runInThread 可能抛出 RejectedExecutionException 异常,这将导致waiter对象无法再被放回waitMap中,Replicator同步过程会永远被卡在 wakeupAllWaiter 方法开头的 if (this.waitMap.isEmpty()) 处,无法自愈。
问题背景详见:#1271
Modification:
在 wakeupAllWaiter 方法内捕获 ThreadPoolsFactory.runInThread 可能抛出的 RejectedExecutionException 异常,并使用独立线程池(采用LinkedBlockingQueue做workQueue,不会抛RejectedExecutionException)兜底重试。
Result:
Fixes #1271.
If there is no issue then describe the changes introduced by this PR.