CMS 3D CMS Logo

edmScanValgrind.py
Go to the documentation of this file.
1 #!/bin/env python
2 import sys
3 
4 fileName = sys.argv[1]
5 
6 f = open(fileName,'r')
7 
8 messageToIgnore = [
9  'edm::FunctorTask'
10  ,'edm::FunctorWaitingTask'
11  ,'edm::ModuleCallingContext::setContext'
12  ,'edm::SerialTaskQueue::'
13  ,'edm::SerialTaskQueueChain::'
14  ,'edm::WaitingTaskList'
15  ,'edm::Worker::RunModuleTask<'
16  ,'edm::Worker::beginStream'
17  ,'edm::eventsetup::EventSetupRecord::getFromProxy'
18  ,'edm::GlobalSchedule::processOneGlobalAsync'
19  ,'edm::SerialTaskQueueChain::push'
20  ,'edm::Worker::doWorkNoPrefetchingAsync'
21  ,'edm::ServiceRegistry::setContext'
22  ,'edm::ServiceRegistry::presentToken()'
23  ,'edm::service::InitRootHandlers::ThreadTracker::on_scheduler_entry'
24  ,'__TBB_machine_fetchstore4'
25  ,'__TBB_machine_cmpswp4'
26  ,'__TBB_machine_fetchstore1'
27  ,'acquire (spin_rw_mutex.h:118)'
28  ,'reset_extra_state ('
29  ,'priority (scheduler_common.h:130)'
30  ,'edm::service::MessageLogger::'
31 # ,'edm::service::MessageLogger::establishModule('
32 # ,'edm::Run::Run(edm::RunPrincipal const&,'
33  ,'edm::service::MessageLogger::unEstablishModule'
34  ,'tbb::'
35  ,'edm::RunForOutput::RunForOutput('
36  ,'edm::stream::EDAnalyzerAdaptor<'
37  ,'edm::EventSetup::find('
38  ,'edm::eventsetup::EventSetupRecord::find('
39  ,'edm::eventsetup::DataKey::operator<('
40  ,'edm::eventsetup::SimpleStringTag::operator<('
41  ,'std::__shared_ptr<edm::serviceregistry::ServicesManager'
42  ,'try_acquire (spin_mutex.h:109)'
43  ,'edm::Run::Run('
44  ,'FastTimerService::preStreamBeginRun('
45  ,'decltype ({parm#1}()) edm::convertException::wrap<bool edm::Worker::runModule'
46  ,'edm::Worker::reset()'
47  ,'edm::stream::ProducingModuleAdaptorBase<edm::stream::EDProducerBase>::doStreamBeginLuminosityBlock('
48  ,'edm::stream::ProducingModuleAdaptorBase<edm::stream::EDFilterBase>::doStreamBeginLuminosityBlock('
49  ,'edm::LuminosityBlock::LuminosityBlock(edm::LuminosityBlockPrincipal'
50  ,'edm::StreamSchedule::processOneStreamAsync<'
51  ,'edm::Worker::doWorkAsync<'
52  ,'edm::StreamSchedule::processOneEventAsync('
53  ,'edm::ParentContext::moduleCallingContext()'
54  ,'edm::ModuleCallingContext::getTopModuleCallingContext'
55  ,'edm::Event::Event('
56  ,'edm::Path::workerFinished('
57  ,'edm::Path::updateCounters('
58  ,'edm::Path::recordStatus('
59  ,'FastTimerService::postPathEvent('
60  ,'edm::hash_detail::isCompactForm_('
61  ,'edm::InputProductResolver::resolveProduct_'
62  ,'edm::NoProcessProductResolver::dataValidFromResolver('
63  ,'edm::DataManagingProductResolver::productWasFetchedAndIsValid_(bool)'
64  ,'FastTimerService::postModuleEvent('
65  ,'edm::UnscheduledProductResolver::prefetchAsync_'
66 # ,'edm::NoProcessProductResolver::prefetchAsync_'
67 # ,'edm::NoProcessProductResolver::resolveProduct_('
68  ,'edm::NoProcessProductResolver::'
69  ,'reco::Jet::detectorP4'
70  ,'edm::EarlyDeleteHelper::moduleRan'
71  ,'edm::clearLoggedErrorsSummary('
72  ,'edm::ProductProvenanceRetriever::branchIDToProvenance('
73  ,'HistogramProbabilityEstimator::probability' #protected by an atomic
74  ,'edm::EventPrincipal::setLuminosityBlockPrincipal'
75  ,'edm::DataManagingProductResolver::'
76 ]
77 
78 stackToIgnore = [
79  'edm::service::MessageLogger::'
80  ,'edm::MessageSender::ErrorObjDeleter'
81  ,'edm::Run::runPrincipal() const'
82  ,'edm::WaitingTaskList::'
83  ,'edm::EventProcessor::beginJob()'
84  ,'edm::StreamSchedule::processOneEventAsync'
85  ,'edm::WorkerManager::resetAll()'
86  ,'edm::ParentageRegistry::insertMapped('
87  ,'edm::one::EDFilterBase::doEvent('
88  ,'edm::one::EDProducerBase'
89  ,'edm::EventBase::triggerNames_'
90  ,'edm::EDFilter::doEvent('
91  ,'edm::EDAnalyzer::doEvent('
92  ,'edm::one::OutputModuleBase::doEvent'
93  ,'edm::EDProducer::doEvent'
94  ,'edm::Principal::clearPrincipal'
95  ,'edm::RootOutputFile::writeOne'
96  ,'edm::PrincipalCache::deleteRun('
97  ,'edm::eventsetup::EventSetupProvider::eventSetupForInstance'
98  ,'edm::EventPrincipal::clearEventPrincipal()'
99  ,'FastTimerService::Resources::operator+='
100  ,'FastTimerService::preSourceEvent(edm::StreamID)'
101  ,'edm::EventPrincipal::fillEventPrincipal('
102  ,'edm::InputProductResolver::putProduct_('
103 ]
104 
105 addressesToIgnore = [
106 # 'edm::eventsetup::makeEventSetupProvider('
107 # ,' edm::eventsetup::DataProxy::get('
108 # ,'cond::createPayload<'
109 # ,'edm::pset::Registry::getMapped('
110  'is in a rw- anonymous segment' #not sure about this one
111 # ,'edm::RootFile::fillRunAuxiliary'
112  ,'tbb::internal::arena::arena('
113 # ,'edm::EventPrincipal::fillEventPrincipal('
114 # ,'edm::Principal::addUnscheduledProduct('
115 # ,'edm::RootDelayedReader::getProduct_'
116 # ,'TBranchElement::GetEntry('
117 # ,'edm::Event::put<'
118 # ,'edm::stream::EDProducerAdaptorBase::doEvent'
119 # ,'edm::stream::EDFilterAdaptorBase::doEvent('
120 # ,'edm::EventProcessor::init(' #this may ignore too much, but needed to ignore member data of streams
121 # ,'edm::global::EDProducerBase::doEvent'
122 # ,'FastTimerService::postBeginJob()'
123 # ,'edm::EDProducer::doEvent('
124 # ,'_ZN3pat15PackedCandidate27covarianceParameterization_E'
125 # ,'edm::RootOutputFile::writeOne'
126  ,'DQMStore::book'
127  ,'L1TdeCSCTF::L1TdeCSCTF' #legacy
128  #,'MeasurementTrackerEventProducer::produce(' #MeasurementTrackerEvent ultimately hits edmNew::DetSetVector's lazy caching of DetSet which is supposed to be thread safe (but may not be?)
129  ,'std::vector<reco::TrackExtra' #this is the cache in Ref
130  ,'std::vector<reco::Track'
131  ,'std::vector<reco::PFConversion'
132 ]
133 
134 addressesToIgnoreIfRead = [
135  'edm::eventsetup::makeEventSetupProvider('
136  ,' edm::eventsetup::DataProxy::get('
137  ,'cond::createPayload<'
138  ,'edm::pset::Registry::getMapped('
139 # ,'is in a rw- anonymous segment' #not sure about this one
140  ,'edm::RootFile::fillRunAuxiliary'
141 # ,'tbb::internal::arena::arena('
142  ,'edm::EventPrincipal::fillEventPrincipal('
143  ,'edm::Principal::addUnscheduledProduct('
144  ,'edm::RootDelayedReader::getProduct_'
145  ,'TBranchElement::GetEntry('
146  ,'edm::Event::put<'
147  ,'edm::stream::EDProducerAdaptorBase::doEvent'
148  ,'edm::stream::EDFilterAdaptorBase::doEvent('
149  ,'edm::EventProcessor::init(' #this may ignore too much, but needed to ignore member data of streams
150  ,'edm::global::EDProducerBase::doEvent'
151  ,'FastTimerService::postBeginJob()'
152  ,'edm::EDProducer::doEvent('
153  ,'_ZN3pat15PackedCandidate27covarianceParameterization_E'
154  ,'edm::RootOutputFile::writeOne'
155  ,'BSS segment'
156  ,'bytes inside data symbol' #this shows the writes but will miss the reads
157  ,'FSQ::HandlerTemplate' #some function statics
158 # ,'DQMStore::book'
159  ,'TBufferFile::'
160  ,'edm::service::MessageLogger::'
161  ,'TClass::GetClass('
162 ]
163 
164 #startOfMessage ='-------------------'
165 endOfMessage ='-------------------'
166 startOfMessage = 'Possible data race'
167 startOfMessageLength = len(startOfMessage)
168 messageStarted = False
169 lineCount = 100
170 buffer = []
171 maxCount = 20
172 lookForAddress = False
173 foundAddress = False
174 addressCount = 100
175 possibleDataRaceRead = False
176 foundStartOfMessage = False
177 for l in f.readlines():
178  if l[:2] != '==':
179  continue
180  if l.find(endOfMessage) != -1:
181  foundAddress = False
182  addressCount = 100
183  if l.find(startOfMessage) != -1:
184  lookForAddress = False
185  foundAddress = False
186  possibleDataRaceRead = (l.find('data race during read') != -1)
187  if buffer:
188  #print buffer
189  print '---------------------'
190  for b in buffer:
191  print b[:-1]
192 
193  buffer=[l]
194  lineCount = 0
195  continue
196 # if lineCount == 2:
197 # if l.find('data race') == -1:
198 # buffer = []
199 # lineCount = 100
200 # possibleDataRaceRead = (l.find('data race during read') != -1)
201  if lineCount < maxCount:
202  skipThis = False
203  for i in stackToIgnore:
204  if l.find(i) != -1:
205  lineCount = 100
206  skipThis = True
207  buffer = []
208  break
209  if skipThis:
210  continue
211  buffer.append(l)
212  lineCount +=1
213  if ' at 0x' in l:
214  for i in messageToIgnore:
215  if l.find(i) != -1:
216  buffer = []
217  lineCount = 100
218  break
219  if lineCount == 100:
220  continue
221  if l.find('Address 0x') != -1:
222  lookForAddress = True
223  foundAddress = False
224  lineCount = 100
225  if lineCount == maxCount:
226  lookForAddress = True
227  foundAddress = False
228  lineCount = 100
229  if lookForAddress:
230  if l.find('Address 0x') != -1:
231  foundAddress = True
232  lookForAddress = False
233  addressCount = 0
234  lineCount = 100
235  if foundAddress:
236  addressCount +=1
237  if addressCount < maxCount:
238  buffer.append(l)
239  for i in addressesToIgnore:
240  if l.find(i) != -1:
241  buffer = []
242  foundAddress = False
243  addressCount = 100
244  break
245  if possibleDataRaceRead:
246  for i in addressesToIgnoreIfRead:
247  if l.find(i) != -1:
248  buffer = []
249  foundAddress = False
250  addressCount = 100
251  break
252  if l[-3:]=="== ":
253  foundAddress = False
254  addressCount = 100