facebook / facebook/rocksdb

ThreadPool WakeUpAllThreads behaviour

Open
#10,238 0 comments 0 reactions 0 assignees View on GitHub
question up-for-grabs
Dominant language
C++
Stars
32.1k
Forks
6.9k
Avg merge
32m
Merged PRs (30d)
1

Description

In ThreadPoolImpl.SubmitJob(...) function, after successfully pushed the job and before unlocking the mutex, it will wakeup all sleeping sub-threads when total_threads_limits_ has been shrinked (for example , 4 -> 2).
But when this situation happens, each "LastExcessiveThread" will wake up all sub-threads circularly until HasExcessiveThread() = == false. It leads that "WakeUpAllThreads() in Submit(...) is redundant". Is there any situation which can trigger the scene ?

Contributor guide

Open the contributing guide

Research direction

Start at ThreadPoolImpl::SubmitJob(...) and trace WakeUpAllThreads(), LastExcessiveThread, and HasExcessiveThread() while checking the mutex and thread-limit shrink path. Reproduce or reason about the described circular wakeups, then determine whether Submit(...) can reach a redundant wakeup; done means the behavior and any necessary cleanup are covered by an appropriate test or documented conclusion.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
databases
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.