As explained in PR 842 I wrote a python script to check for correct use of root locks in plugins, based on this guidance. The summarized guidance is that
locks are not needed in init or fini as those functions are always run single-threaded.
write locks should be used for creating histograms or trees and filling trees (except in init or fini)
for best performance, local fill locks should be used for filling histograms
Also, if we use DTreeInterface for trees, that handles the locks for us.
The script is quite simple, it might generate false warnings but it does find real bugs. I already fixed the bugs that it found in my own plugins. I ran the script over all of the plugins in halld_recon's master branch at tag 4.51.0. The full output, with line numbers, is in the attached files. There were warnings/problems in the following (many of these are inefficiencies such as using locks in init or using a WriteLock where only a FillLock was needed):
As explained in PR 842 I wrote a python script to check for correct use of root locks in plugins, based on this guidance. The summarized guidance is that
The script is quite simple, it might generate false warnings but it does find real bugs. I already fixed the bugs that it found in my own plugins. I ran the script over all of the plugins in halld_recon's master branch at tag 4.51.0. The full output, with line numbers, is in the attached files. There were warnings/problems in the following (many of these are inefficiencies such as using locks in init or using a WriteLock where only a FillLock was needed):
monitoring
/home/njarvis/mywork/halld_recon/src/plugins/monitoring/BEAM_online/JEventProcessor_BEAM_online.cc /home/njarvis/mywork/halld_recon/src/plugins/monitoring/highlevel_online/JEventProcessor_highlevel_online.cc /home/njarvis/mywork/halld_recon/src/plugins/monitoring/RF_online/JEventProcessor_RF_online.cc /home/njarvis/mywork/halld_recon/src/plugins/monitoring/ST_ZEff/JEventProcessor_ST_ZEff.cc /home/njarvis/mywork/halld_recon/src/plugins/monitoring/pedestal_online/JEventProcessor_pedestal_online.cc /home/njarvis/mywork/halld_recon/src/plugins/monitoring/cppFMWPC_ana/JEventProcessor_cppFMWPC_ana.cc /home/njarvis/mywork/halld_recon/src/plugins/monitoring/BCAL_LED_time/JEventProcessor_BCAL_LED_time.cc /home/njarvis/mywork/halld_recon/src/plugins/monitoring/BCAL_Eff/JEventProcessor_BCAL_Eff.cc /home/njarvis/mywork/halld_recon/src/plugins/monitoring/TrackingPulls_straight/JEventProcessor_TrackingPulls_straight.cc /home/njarvis/mywork/halld_recon/src/plugins/monitoring/occupancy_online/JEventProcessor_occupancy_online.cc /home/njarvis/mywork/halld_recon/src/plugins/monitoring/TrackingPulls/JEventProcessor_TrackingPulls.cc /home/njarvis/mywork/halld_recon/src/plugins/monitoring/DAQ_online/JEventProcessor_DAQ_online.cc /home/njarvis/mywork/halld_recon/src/plugins/monitoring/cppFMWPC/JEventProcessor_cppFMWPC.cc /home/njarvis/mywork/halld_recon/src/plugins/monitoring/BCAL_LED/JEventProcessor_BCAL_LED.cc /home/njarvis/mywork/halld_recon/src/plugins/monitoring/FCAL_invmass/JEventProcessor_FCAL_invmass.cc /home/njarvis/mywork/halld_recon/src/plugins/monitoring/TOF_TDC_shift/JEventProcessor_TOF_TDC_shift.cc
Calibration
/home/njarvis/mywork/halld_recon/src/plugins/Calibration/BCAL_point_time/JEventProcessor_BCAL_point_time.cc /home/njarvis/mywork/halld_recon/src/plugins/Calibration/BCAL_attenlength_gainratio/JEventProcessor_BCAL_attenlength_gainratio.cc /home/njarvis/mywork/halld_recon/src/plugins/Calibration/FCAL_TimingOffsets/JEventProcessor_FCAL_TimingOffsets.cc /home/njarvis/mywork/halld_recon/src/plugins/Calibration/TOF_calib/JEventProcessor_TOF_calib.cc /home/njarvis/mywork/halld_recon/src/plugins/Calibration/HLDetectorTiming/JEventProcessor_HLDetectorTiming.cc /home/njarvis/mywork/halld_recon/src/plugins/Calibration/BCAL_SiPM_saturation/JEventProcessor_BCAL_SiPM_saturation.cc /home/njarvis/mywork/halld_recon/src/plugins/Calibration/BCAL_point_calib/JEventProcessor_BCAL_point_calib.cc /home/njarvis/mywork/halld_recon/src/plugins/Calibration/FCAL_TimingOffsets_Primex/JEventProcessor_FCAL_TimingOffsets_Primex.cc /home/njarvis/mywork/halld_recon/src/plugins/Calibration/BCAL_ADC_4ns/JEventProcessor_BCAL_ADC_4ns.cc /home/njarvis/mywork/halld_recon/src/plugins/Calibration/CCAL_ComptonGains/JEventProcessor_CCAL_ComptonGains.cc /home/njarvis/mywork/halld_recon/src/plugins/Calibration/FCAL_Pi0TOF/JEventProcessor_FCAL_Pi0TOF.cc /home/njarvis/mywork/halld_recon/src/plugins/Calibration/BCAL_TimeCalibration/JEventProcessor_BCAL_TimeCalibration.cc /home/njarvis/mywork/halld_recon/src/plugins/Calibration/FCAL_Pi0HFA/JEventProcessor_FCAL_Pi0HFA.cc /home/njarvis/mywork/halld_recon/src/plugins/Calibration/FCAL_LED_shifts/JEventProcessor_FCAL_LED_shifts.cc /home/njarvis/mywork/halld_recon/src/plugins/Calibration/FCALLEDTree/JEventProcessor_FCALLEDTree.cc /home/njarvis/mywork/halld_recon/src/plugins/Calibration/FCALgains/JEventProcessor_FCALgains.cc
Analysis
/home/njarvis/mywork/halld_recon/src/plugins/Analysis/DAQTree/JEventProcessor_DAQTree.cc /home/njarvis/mywork/halld_recon/src/plugins/Analysis/imaging/JEventProcessor_imaging.cc /home/njarvis/mywork/halld_recon/src/plugins/Analysis/F250_mode8_pedestal/JEventProcessor_F250_mode8_pedestal.cc /home/njarvis/mywork/halld_recon/src/plugins/Analysis/bcal_calib_cosmic_cdc/JEventProcessor_bcal_calib_cosmic_cdc.cc /home/njarvis/mywork/halld_recon/src/plugins/Analysis/compton/JEventProcessor_compton.cc /home/njarvis/mywork/halld_recon/src/plugins/Analysis/fcal_charged/JEventProcessor_fcal_charged.cc /home/njarvis/mywork/halld_recon/src/plugins/Analysis/TRD_hists/JEventProcessor_TRD_hists.cc /home/njarvis/mywork/halld_recon/src/plugins/Analysis/event_size/JEventProcessor_event_size.cc /home/njarvis/mywork/halld_recon/src/plugins/Analysis/F250_mode10_pedestal/JEventProcessor_F250_mode10_pedestal.cc /home/njarvis/mywork/halld_recon/src/plugins/Analysis/DAQTreeBCAL/JEventProcessor_DAQTreeBCAL.cc /home/njarvis/mywork/halld_recon/src/plugins/Analysis/pedestals/JEventProcessor_pedestals.cc
Utilities
/home/njarvis/mywork/halld_recon/src/plugins/Utilities/eta6g_primexd_skim/JEventProcessor_eta6g_skim.cc /home/njarvis/mywork/halld_recon/src/plugins/Utilities/cdc_scan/JEventProcessor_cdc_scan.cc /home/njarvis/mywork/halld_recon/src/plugins/Utilities/pi0fcaltofskim/JEventProcessor_pi0fcaltofskim.cc /home/njarvis/mywork/halld_recon/src/plugins/Utilities/compton_neutral_skim/JEventProcessor_compton_neutral_skim.cc /home/njarvis/mywork/halld_recon/src/plugins/Utilities/etapi0_primexd_skim/JEventProcessor_etapi0_skim.cc /home/njarvis/mywork/halld_recon/src/plugins/Utilities/l3bdt/JEventProcessor_L3BDTtree.cc /home/njarvis/mywork/halld_recon/src/plugins/Utilities/cdc_echo/JEventProcessor_cdc_echo.cc /home/njarvis/mywork/halld_recon/src/plugins/Utilities/pi0fcalskim/JEventProcessor_pi0fcalskim.cc /home/njarvis/mywork/halld_recon/src/plugins/Utilities/cdc_amp_t/JEventProcessor_cdc_amp_t.cc /home/njarvis/mywork/halld_recon/src/plugins/Utilities/cal_high_energy_skim/JEventProcessor_cal_high_energy_skim.cc /home/njarvis/mywork/halld_recon/src/plugins/Utilities/rawevent/JEventProcessor_rawevent.cc /home/njarvis/mywork/halld_recon/src/plugins/Utilities/syncskim/JEventProcessor_syncskim.cc /home/njarvis/mywork/halld_recon/src/plugins/Utilities/single_neutral_skim/JEventProcessor_single_neutral_skim.cc /home/njarvis/mywork/halld_recon/src/plugins/Utilities/eta2g_primexd_skim/JEventProcessor_eta2g_primexd_skim.cc /home/njarvis/mywork/halld_recon/src/plugins/Utilities/fmwpc_scan/JEventProcessor_fmwpc_scan.cc
Alignment
/home/njarvis/mywork/halld_recon/src/plugins/Alignment/FDC_InternalAlignment/JEventProcessor_FDC_InternalAlignment.cc
Full output
monitoring.txt Calibration.txt Analysis.txt Utilities.txt Alignment.txt