Commit 2c503847 authored by romange's avatar romange

Update vlog_is_on.cc

SetVLOGLevel locks vmodule_lock however RAW_VLOG at the end also implicitly locks it via InitVLOG3__.

This causes deadlock/segfault.
parent 2a02db7a
...@@ -162,6 +162,7 @@ int SetVLOGLevel(const char* module_pattern, int log_level) { ...@@ -162,6 +162,7 @@ int SetVLOGLevel(const char* module_pattern, int log_level) {
int result = FLAGS_v; int result = FLAGS_v;
int const pattern_len = strlen(module_pattern); int const pattern_len = strlen(module_pattern);
bool found = false; bool found = false;
{
MutexLock l(&vmodule_lock); // protect whole read-modify-write MutexLock l(&vmodule_lock); // protect whole read-modify-write
for (const VModuleInfo* info = vmodule_list; for (const VModuleInfo* info = vmodule_list;
info != NULL; info = info->next) { info != NULL; info = info->next) {
...@@ -186,6 +187,7 @@ int SetVLOGLevel(const char* module_pattern, int log_level) { ...@@ -186,6 +187,7 @@ int SetVLOGLevel(const char* module_pattern, int log_level) {
info->next = vmodule_list; info->next = vmodule_list;
vmodule_list = info; vmodule_list = info;
} }
}
RAW_VLOG(1, "Set VLOG level for \"%s\" to %d", module_pattern, log_level); RAW_VLOG(1, "Set VLOG level for \"%s\" to %d", module_pattern, log_level);
return result; return result;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment