Hi, I have a function with fits a TH2 histogram with a TF2 object. This function is called from several threads simultaneously. The program crashes always at the line h2->Fit(f2,"QWWR0");
My workaround right now is to have a QMutex. This way, the program does not crash, but it is very very slow, as I am fitting 2800 2D histograms.
It should be thread safe, but you need to activate the internal locks in ROOT by calling
ROOT::EnableThreadSafety()
Otherwise in the master revision each single fit can be computed in multi-threads by calling ROOT::EnableImplicitMT() or using the fit option "MULTITHREAD"
Thanks for the fast reply. I had already enabled ROOT::EnableThreadSafety(), but it still crashes. If I use the additional QMutex, everything works fine (and slow). If I dont use the QMutex, I get this error:
THE COMMAND: MIGRAD IS UNKNOWN.
THE FORMAT OF THE SET COMMAND IS:
SET xxx [numerical arguments if any]
WHERE xxx MAY BE ONE OF THE FOLLOWING:
FCN value
PARameters
LIMits
COVariance
CORrelatio
PRInt levl
NOGradient
GRAdient
ERRor def
INPut file
WIDth page
LINes page
NOWarnings
WARnings
RANdom gen
TITle
STRategy
EIGenvalue
PAGe throw
MINos errs
EPSmachine
OUTputfile
BATch
INTeractiv
VERsion
*** Error in `/home/ferhue/Programs/build-pga-Desktop-Release/pga': corrupted size vs. prev_size: 0x00007f8260051480 ***
*** Error in `/home/ferhue/Programs/build-pga-Desktop-Release/pga': double free or corruption (fasttop): 0x00007f8238003450 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f847aaec7e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f847aaf537a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f847aaf953c]
/opt/root/lib/libCore.so(_ZN7TStringaSERKS_+0x46)[0x7f847e649166]
/opt/root/lib/libMinuit.so(_ZN7TMinuit6mnwarnEPKcS1_S1_+0x151)[0x7f847d035d91]
/opt/root/lib/libMinuit.so(_ZN7TMinuit6mnlineEPddS0_dd+0xd07)[0x7f847d02bfc7]
/opt/root/lib/libMinuit.so(_ZN7TMinuit6mnmigrEv+0x4be)[0x7f847d02923e]
/opt/root/lib/libMinuit.so(_ZN7TMinuit6mnexcmEPKcPdiRi+0x8c1)[0x7f847d03b481]
/opt/root/lib/libMinuit.so(_ZN16TMinuitMinimizer8MinimizeEv+0x272)[0x7f847d0424d2]
/opt/root/lib/libMathCore.so(_ZN4ROOT3Fit6Fitter14DoMinimizationEPKNS_4Math26IBaseFunctionMultiDimTemplIdEE+0x1e)[0x7f8478c07ffe]
/opt/root/lib/libMathCore.so(_ZN4ROOT3Fit6Fitter16DoLeastSquareFitEv+0x4ed)[0x7f8478c08c3d]
/opt/root/lib/libHist.so(_ZN4HFit3FitI3TH1EE13TFitResultPtrPT_P3TF1R9Foption_tRKN4ROOT4Math16MinimizerOptionsEPKcRNS9_3Fit9DataRangeE+0xe43)[0x7f847e027c03]
/opt/root/lib/libHist.so(_ZN4ROOT3Fit9FitObjectEP3TH1P3TF1R9Foption_tRKNS_4Math16MinimizerOptionsEPKcRNS0_9DataRangeE+0x3a)[0x7f847e01d53a]
/opt/root/lib/libHist.so(_ZN3TH13FitEP3TF1PKcS3_dd+0x1b3)[0x7f847e0ccc43]
/home/ferhue/Programs/build-pga-Desktop-Release/pga(_ZN9Histogram21backgroundSubtractionEv+0x543)[0x594273]
/home/ferhue/Programs/build-pga-Desktop-Release/pga(_Z25histogramPhaseShiftToPeakRP9Histogram+0x14)[0x4bee74]
/home/ferhue/Programs/build-pga-Desktop-Release/pga(_ZN12QtConcurrent9MapKernelIPP9HistogramNS_16FunctionWrapper1IvRS2_EEE13runIterationsES3_iiPv+0x37)[0x4ca047]
/home/ferhue/Programs/build-pga-Desktop-Release/pga(_ZN12QtConcurrent13IterateKernelIPP9HistogramvE14threadFunctionEv+0x211)[0x4cd541]
/usr/lib/x86_64-linux-gnu/libQt5Concurrent.so.5(_ZN12QtConcurrent16ThreadEngineBase3runEv+0x6d)[0x7f848037f6bd]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0xa22d3)[0x7f847b99f2d3]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0xa57be)[0x7f847b9a27be]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7f847b6e76ba]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f847ab7c3dd]
I always get a crash, but the error messages are each time slightly different. Another one is: