]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commit
Fix deadlock when calling getMergedHistogram rocksdb-4.13 v4.13
authorChangli Gao <xiaosuo@gmail.com>
Mon, 21 Nov 2016 02:14:33 +0000 (18:14 -0800)
committerIslam AbdelRahman <tec@fb.com>
Fri, 9 Dec 2016 20:59:51 +0000 (12:59 -0800)
commit8e68ffb872f3ead8b0fc3bb6353c04008a049d8d
tree9aa5f8df774557d6521963baf4811b62b791fb2c
parent41526f44f6babf4201687c3f6efb11f59a10ab8c
Fix deadlock when calling getMergedHistogram

Summary:
When calling StatisticsImpl::HistogramInfo::getMergedHistogram(), if
there is a dying thread, which is calling
ThreadLocalPtr::StaticMeta::OnThreadExit() to merge its thread values to
HistogramInfo, deadlock will occur. Because the former try to hold
merge_lock then ThreadMeta::mutex_, but the later try to hold
ThreadMeta::mutex_ then merge_lock. In short, the locking order isn't
the same.

This patch addressed this issue by releasing merge_lock before folding
thread values.
Closes https://github.com/facebook/rocksdb/pull/1552

Differential Revision: D4211942

Pulled By: ajkr

fbshipit-source-id: ef89bcb
util/statistics.cc