in the ATLAS HLT, we are seeing occasional crashes in multi-threaded applications that seem to point to CINT in the stacktrace. Most of the crashes are correlated with TH1::Merge or TH1::Clone operations going on in one of the threads. Looking at the code of TH1::Merge, it seems that at some point ProcessLine is being called to perform the operation. I found this posting root.cern.ch/phpBB2/viewtopic.php?t=5673 that explicitly says that CINT is not thread safe. From this I would conclude that TH1::Merge, Clone or any ROOT operation using ProcessLine is not thread safe either?
Is there any global lock that can be used to synchronize CINT operations? (the platform is Linux in case it matters).
Could you post a piece of code showing how you call TH1::Merge or Clone?
None of these functions invoke gROOT->ProcessLine.
Which version of ROOT are you using?
This is root 5.22/00d. The code is as simple as myHist->Merge(&list). But the same happens if for example we add new bins to an existing histogram, which internally calls Clone once it runs out of bins.
Looking at the root source code (most recent version on the web), I would deduce the following call sequence:
The ProcessLine is called in this case only if the current ROOT directory (gDirectory) is not a file based TDirectory. You can solve this problem by making sure that it is a file based TDirectory. (i.e. myoutputfile->cd() for example).
thanks, that explains it. The issue is that the histograms don’t get saved into a ROOT file on the worker node. They are being serialized and sent across the network. Are you suggesting we should simply open a dummy ROOT file to avoid the ProcessLine() call? If we do so, will there be additional I/O from/to this file?
[quote]Are you suggesting we should simply open a dummy ROOT file to avoid the ProcessLine() call?[/quote]Yes.
[quote]If we do so, will there be additional I/O from/to this file? [/quote]No as long as you do not call Write on this file and make sure that the histograms are deleted (or you call myclone->SetDirectory(0) just after the cloning) before closing the dummy file.