Bug #42217
closedrgw:dmclock: When test rgw dmclock function, it cannot work well.
0%
Description
When I port the rgw dmclock code into our project and test it, I found it doesn't work. All rgw thread will be blocked, and rgw can not proccess any request anymore.
I track this issue, found the process thread is blocked in SyncScheduler::handle_request_cb function, and it is blocked by std::lock_guard<std::mutex> lg(req->req_mtx).
I continue track this issue and found the root cause is in rgw_dmclock_sync_scheduler.cc:line30.
- if (std::unique_lock<std::mutex> lk(req_mtx); rstate != ReqState::Wait) {
+ if (std::unique_lock<std::mutex> lk(req_mtx); rstate == ReqState::Wait) {
the restate initial value is ReqState::Wait, so when rgw_dmclock_sync_scheduler.cc:line 30 , it should wait the mutex lock and block the process request thread. the origin code is !=, it is unreasonable.
I changed it as above, and the dmclock function work well.