Yuqi Du has posted comments on this change. ( http://gerrit.cloudera.org:8080/18867 )
Change subject: [threadpool] Fix unsafe behaviour when SchedulerThread shutdown ...................................................................... Patch Set 17: (1 comment) > Patch Set 17: > > (1 comment) Thank you for your advices. You are kind. http://gerrit.cloudera.org:8080/#/c/18867/16//COMMIT_MSG Commit Message: http://gerrit.cloudera.org:8080/#/c/18867/16//COMMIT_MSG@9 PS16, Line 9: When shutting down a thread pool with SchedulerThread, thread pool's variable : 'scheduler_' is deleted and set to nullptr, at the same time, if thread pool : token is not shutdown and a task is scheduled on the toke > Thanks for your clarification! I study the 'pool_status_' . At my called stacks after changes: 1. ThreadPoolToken::Schedule 2. ThreadPool::Schedule 3. scheduler_->Schedule 4. another thread run 'token->Submit(task.func());' At 1,2,3. 'pool_status_' can be used at 2. But 2's purpose is protect 'scheduler_'. and at this position check 'pool_status_' is ok, but I think it's still not enough. because 'scheduler_' shutdown before thread pool. So if the following orders: 1. check thread pool' 'pool_status_' is ok/ not ok. 2. scheduler_ shutdown 3. thread pool shutdown If 1's 'pool_status_' is not ok, we can return. If 1's 'pool_status_' is ok, then scheduler_->Scheduler, and aother thread 'scheduler_ shutdown'. only check 'pool_status_' is not enough. -- To view, visit http://gerrit.cloudera.org:8080/18867 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I021422f7e51e1007c5bdbc877ab445f70ba12357 Gerrit-Change-Number: 18867 Gerrit-PatchSet: 17 Gerrit-Owner: Yuqi Du <[email protected]> Gerrit-Reviewer: Alexey Serbin <[email protected]> Gerrit-Reviewer: Kudu Jenkins (120) Gerrit-Reviewer: Tidy Bot (241) Gerrit-Reviewer: Yifan Zhang <[email protected]> Gerrit-Reviewer: Yingchun Lai <[email protected]> Gerrit-Reviewer: Yuqi Du <[email protected]> Gerrit-Comment-Date: Sat, 12 Nov 2022 03:03:45 +0000 Gerrit-HasComments: Yes
