Add missing lock in FreeObjects of object buffer pool (#3647)

Object manager uses multi-threading for transferring objects between different nodes, the plasma client used in object_buffer_pool_ needs to be protected by lock. We have met crashes caused by missing lock in FreeObjects() interface, this PR fixes that issue.
This commit is contained in:
Zhijun Fu
2018-12-28 11:47:31 -08:00
committed by Robert Nishihara
parent c59b506c6e
commit 3df1e1c471
2 changed files with 3 additions and 1 deletions
@@ -192,10 +192,12 @@ void ObjectBufferPool::FreeObjects(const std::vector<ObjectID> &object_ids) {
for (const auto &id : object_ids) {
plasma_ids.push_back(id.to_plasma_id());
}
std::lock_guard<std::mutex> lock(pool_mutex_);
ARROW_CHECK_OK(store_client_.Delete(plasma_ids));
}
std::string ObjectBufferPool::DebugString() const {
std::lock_guard<std::mutex> lock(pool_mutex_);
std::stringstream result;
result << "BufferPool:";
result << "\n- get buffer state map size: " << get_buffer_state_.size();
+1 -1
View File
@@ -182,7 +182,7 @@ class ObjectBufferPool {
/// Mutex on public methods for thread-safe operations on
/// get_buffer_state_, create_buffer_state_, and store_client_.
std::mutex pool_mutex_;
mutable std::mutex pool_mutex_;
/// Determines the maximum chunk size to be transferred by a single thread.
const uint64_t default_chunk_size_;
/// The state of a buffer that's currently being used.