Skip to content

Commit

Permalink
Fix root-project#11383 (deadlock at initialization) (root-project#11384)
Browse files Browse the repository at this point in the history
Previously if a message (for example warning of duplicate dictionary)
happened during intialization, it would trigger the initialization of gROOT
and could trigger a nested Warning. for example due to the duplicate rootmap
file entry and would cause a dead lock (recursiverly taking the
non recursive lock GetErrorMutex().
  • Loading branch information
pcanal authored and vgvassilev committed Oct 1, 2022
1 parent 5fd86c9 commit 0194c9b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/base/src/TErrorDefaultHandler.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,14 @@ static void DebugPrint(const char *fmt, ...)
void DefaultErrorHandler(Int_t level, Bool_t abort_bool, const char *location, const char *msg)
{
if (gErrorIgnoreLevel == kUnset) {
std::lock_guard<std::mutex> guard(*GetErrorMutex());

gErrorIgnoreLevel = 0;
if (gEnv) {
std::string slevel;
// This can also print error messages, so we need to do it outside the lock
auto cstrlevel = gEnv->GetValue("Root.ErrorIgnoreLevel", "Print");

std::lock_guard<std::mutex> guard(*GetErrorMutex());

gErrorIgnoreLevel = 0;
std::string slevel;
while (cstrlevel && *cstrlevel) {
slevel.push_back(tolower(*cstrlevel));
cstrlevel++;
Expand Down

0 comments on commit 0194c9b

Please sign in to comment.