Skip to content

Commit

Permalink
[fix] Fixed segment fault due to lambda may capture the thread_contex…
Browse files Browse the repository at this point in the history
…t reference with error address when high concurrency and server disconnection.
  • Loading branch information
MoFHeka authored and rhdong committed Jun 9, 2022
1 parent e2ddb73 commit 2ab0abd
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ class RedisWrapper<RedisInstance, K, V,
} catch (const std::exception &err) {
LOG(ERROR) << "RedisHandler error in PipeExecRead for slices "
<< hkey.data() << " -- " << err.what();
error_ptr = std::current_exception();
throw(err);
}
} else {
return nullptr;
Expand All @@ -194,8 +192,6 @@ class RedisWrapper<RedisInstance, K, V,
} catch (const std::exception &err) {
LOG(ERROR) << "RedisHandler error in PipeExecWrite for slices "
<< hkey.data() << " -- " << err.what();
error_ptr = std::current_exception();
throw(err);
}
} else {
return nullptr;
Expand Down Expand Up @@ -1004,7 +1000,7 @@ every bucket has its own BucketContext for sending data---for locating reply-
try {
for (unsigned i = 0; i < storage_slice; ++i) {
results.emplace_back(
network_worker_pool->enqueue([this, &cmd, &thread_context, i] {
network_worker_pool->enqueue([this, &cmd, thread_context, i] {
return PipeExecRead(cmd, 3U, thread_context->buckets[i]);
}));
}
Expand Down Expand Up @@ -1228,7 +1224,7 @@ every bucket has its own BucketContext for sending data---for locating reply-
try {
for (unsigned i = 0; i < storage_slice; ++i) {
results.emplace_back(
network_worker_pool->enqueue([this, &cmd, &thread_context, i] {
network_worker_pool->enqueue([this, &cmd, thread_context, i] {
return PipeExecWrite(cmd, 4U, thread_context->buckets[i]);
}));
}
Expand Down Expand Up @@ -1330,7 +1326,7 @@ every bucket has its own BucketContext for sending data---for locating reply-
try {
for (unsigned i = 0; i < storage_slice; ++i) {
results.emplace_back(
network_worker_pool->enqueue([this, &cmd, &thread_context, i] {
network_worker_pool->enqueue([this, &cmd, thread_context, i] {
return PipeExecWrite(cmd, 6U, thread_context->buckets[i]);
}));
}
Expand Down Expand Up @@ -1411,7 +1407,7 @@ every bucket has its own BucketContext for sending data---for locating reply-
try {
for (unsigned i = 0; i < storage_slice; ++i) {
results.emplace_back(
network_worker_pool->enqueue([this, &cmd, &thread_context, i] {
network_worker_pool->enqueue([this, &cmd, thread_context, i] {
return PipeExecWrite(cmd, 3U, thread_context->buckets[i]);
}));
}
Expand Down

0 comments on commit 2ab0abd

Please sign in to comment.