Todd Lipcon has submitted this change and it was merged. Change subject: threadpool: avoid calling task destructors while holding lock ......................................................................
threadpool: avoid calling task destructors while holding lock Currently, the ThreadPool calls task's destructors while holding its internal lock. This has two issues: 1) While it's not a great practice, some destructors themselves acquire locks. This can create lock cycles if those same locks are ever held concurrently with a submission to the threadpool. 2) Even well-written destructors can be heavy-weight, eg if they free a large graph of dependent objects. We should not block the threadpool's progress while running these destructors. This fixes the issue by being more explicit about where tasks are freed, both in the Shutdown() code path as well as the normal task dispatch code. Change-Id: I4cdc38c7db0a6a7fd640d82895ecaebe0718ee98 Reviewed-on: http://gerrit.cloudera.org:8080/5517 Tested-by: Kudu Jenkins Reviewed-by: Mike Percy <[email protected]> --- M src/kudu/util/threadpool-test.cc M src/kudu/util/threadpool.cc M src/kudu/util/threadpool.h 3 files changed, 48 insertions(+), 15 deletions(-) Approvals: Mike Percy: Looks good to me, approved Kudu Jenkins: Verified -- To view, visit http://gerrit.cloudera.org:8080/5517 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4cdc38c7db0a6a7fd640d82895ecaebe0718ee98 Gerrit-PatchSet: 2 Gerrit-Project: kudu Gerrit-Branch: master Gerrit-Owner: Todd Lipcon <[email protected]> Gerrit-Reviewer: Kudu Jenkins Gerrit-Reviewer: Mike Percy <[email protected]> Gerrit-Reviewer: Tidy Bot Gerrit-Reviewer: Todd Lipcon <[email protected]>
