Skip to content

Commit

Permalink
Correct out-of order lock acquisition.
Browse files Browse the repository at this point in the history
Previously we had:

TFile::Open
 TFile::GetType
  TUnixSystem::IsPathLocal
   TSystem::FindHelper
    TPluginHandler::CheckForExecPlugin
     ** take the TPluginHandler lock **
      TPluginHandler::SetupCallEnv
       TClass::GetClass
        ** take the ROOT/Interpreter lock **
vs

TFile::Open
 TPluginHandler::ExecPluginImpl
  ** take the ROOT/Interpreter lock **
   TMethodCall::Execute
    ... interpreter layer
    TPluginManager::AddHandler
     ** take the TPluginHandler lock **
  • Loading branch information
pcanal committed Apr 17, 2017
1 parent af59257 commit 6eb83c4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/base/src/TPluginManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ Bool_t TPluginHandler::CheckForExecPlugin(Int_t nargs)

if (fCanCall == 0) {
// Not initialized yet.
// SetupCallEnv is likely to require/take the interpreter lock.
// Grab it now to avoid dead-lock. In particular TPluginHandler::ExecPluginImpl
// takes the gInterpreterMutex and *then* call (indirectly) code that
// take the gPluginManagerMutex.
R__LOCKGUARD2(gInterpreterMutex);
R__LOCKGUARD2(gPluginManagerMutex);

// Now check if another thread did not already do the work.
Expand Down

2 comments on commit 6eb83c4

@smuzaffar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pcanal , can you please include this for root v6-08-00-patches

@pcanal
Copy link
Member Author

@pcanal pcanal commented on 6eb83c4 May 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smuzaffar done.

Please sign in to comment.