Project

General

Profile

Bug #13063

Memory errors and leaks

Added by Paul Russo over 3 years ago. Updated almost 3 years ago.

Status:
Assigned
Priority:
Normal
Category:
Reconstruction
Target version:
-
Start date:
06/28/2016
Due date:
% Done:

0%

Estimated time:
Occurs In:
Experiment:
LArSoft
Co-Assignees:
Duration:

Description

The following 8 memory errors were detected by valgrind during a run of uboone reco stage 1, using this command:

time nice valgrind -v --leak-check=full --track-origins=yes --show-leak-kinds=all --keep-stacktraces=alloc-and-free --leak-check-heuristics=all --suppressions=/products/root/v6_06_04a/Linux64bit+2.6-2.12-e10-nu-debug/etc/valgrind-root.supp lar -c ~/mrb_uboone/srcs/uboonecode/fcl/reco/reco_uboone_mcc7_driver_stage1.fcl -S mydetsim.list -n 1 2>&1 | tee valgrind_2.log
==25406== Invalid read of size 8
==25406==    at 0x2D3438EA: pmtana::BinnedMaxOccurrence(std::vector<double, std::allocator<double> > const&, unsigned long) (UtilFunc.cxx:82)
==25406==    by 0x2D337764: pmtana::PedAlgoRollingMean::ComputePedestal(std::vector<short, std::allocator<short> > const&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&) (PedAlgoRollingMean.cxx:137)
==25406==    by 0x2D334242: pmtana::PMTPedestalBase::Evaluate(std::vector<short, std::allocator<short> > const&) (PMTPedestalBase.cxx:42)
==25406==    by 0x2D33951D: pmtana::PedAlgoUB::ComputePedestal(std::vector<short, std::allocator<short> > const&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&) (PedAlgoUB.cxx:61)
==25406==    by 0x2D334242: pmtana::PMTPedestalBase::Evaluate(std::vector<short, std::allocator<short> > const&) (PMTPedestalBase.cxx:42)
==25406==    by 0x2D346C56: pmtana::PulseRecoManager::Reconstruct(std::vector<short, std::allocator<short> > const&) const (PulseRecoManager.cxx:56)
==25406==    by 0x2D3449C6: opdet::RunHitFinder(std::vector<raw::OpDetWaveform, std::allocator<raw::OpDetWaveform> > const&, std::vector<recob::OpHit, std::allocator<recob::OpHit> >&, pmtana::PulseRecoManager const&, pmtana::PMTPulseRecoBase const&, geo::GeometryCore const&, float const&, detinfo::DetectorClocks const&, std::vector<double, std::allocator<double> > const&, bool const&) (OpHitAlg.cxx:39)
==25406==    by 0x2DD36B6D: opdet::OpHitFinder::produce(art::Event&) (OpHitFinder_module.cc:252)
==25406==    by 0xA6308D0: art::EDProducer::doEvent(art::EventPrincipal&, art::CurrentProcessingContext const*) (EDProducer.cc:28)
==25406==    by 0xA6D107D: art::WorkerT<art::EDProducer>::implDoBegin(art::EventPrincipal&, art::CurrentProcessingContext const*) (WorkerT.h:86)
==25406==    by 0x984AC4F: bool art::Worker::doWork<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&, art::CurrentProcessingContext const*) (Worker.h:221)
==25406==    by 0x9850FA9: bool art::WorkerInPath::runWorker<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&, art::CurrentProcessingContext const*) (WorkerInPath.h:80)
==25406==  Address 0x3b6cdda0 is 0 bytes after a block of size 8,000 alloc'd
==25406==    at 0x4A09E85: operator new(unsigned long) (vg_replace_malloc.c:333)
==25406==    by 0x4D9C9D9: __gnu_cxx::new_allocator<unsigned long>::allocate(unsigned long, void const*) (new_allocator.h:104)
==25406==    by 0x4D99F75: std::allocator_traits<std::allocator<unsigned long> >::allocate(std::allocator<unsigned long>&, unsigned long) (alloc_traits.h:357)
==25406==    by 0x4D97739: std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_M_allocate(unsigned long) (stl_vector.h:170)
==25406==    by 0x4DD0760: std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_M_create_storage(unsigned long) (stl_vector.h:185)
==25406==    by 0x4DCE1A2: std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_Vector_base(unsigned long, std::allocator<unsigned long> const&) (stl_vector.h:136)
==25406==    by 0x22F7AE7D: std::vector<unsigned long, std::allocator<unsigned long> >::vector(unsigned long, unsigned long const&, std::allocator<unsigned long> const&) (stl_vector.h:291)
==25406==    by 0x2D34379F: pmtana::BinnedMaxOccurrence(std::vector<double, std::allocator<double> > const&, unsigned long) (UtilFunc.cxx:74)
==25406==    by 0x2D337764: pmtana::PedAlgoRollingMean::ComputePedestal(std::vector<short, std::allocator<short> > const&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&) (PedAlgoRollingMean.cxx:137)
==25406==    by 0x2D334242: pmtana::PMTPedestalBase::Evaluate(std::vector<short, std::allocator<short> > const&) (PMTPedestalBase.cxx:42)
==25406==    by 0x2D33951D: pmtana::PedAlgoUB::ComputePedestal(std::vector<short, std::allocator<short> > const&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&) (PedAlgoUB.cxx:61)
==25406==    by 0x2D334242: pmtana::PMTPedestalBase::Evaluate(std::vector<short, std::allocator<short> > const&) (PMTPedestalBase.cxx:42)
==25406== 
==25406== Invalid write of size 8
==25406==    at 0x2D3438F1: pmtana::BinnedMaxOccurrence(std::vector<double, std::allocator<double> > const&, unsigned long) (UtilFunc.cxx:82)
==25406==    by 0x2D337764: pmtana::PedAlgoRollingMean::ComputePedestal(std::vector<short, std::allocator<short> > const&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&) (PedAlgoRollingMean.cxx:137)
==25406==    by 0x2D334242: pmtana::PMTPedestalBase::Evaluate(std::vector<short, std::allocator<short> > const&) (PMTPedestalBase.cxx:42)
==25406==    by 0x2D33951D: pmtana::PedAlgoUB::ComputePedestal(std::vector<short, std::allocator<short> > const&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&) (PedAlgoUB.cxx:61)
==25406==    by 0x2D334242: pmtana::PMTPedestalBase::Evaluate(std::vector<short, std::allocator<short> > const&) (PMTPedestalBase.cxx:42)
==25406==    by 0x2D346C56: pmtana::PulseRecoManager::Reconstruct(std::vector<short, std::allocator<short> > const&) const (PulseRecoManager.cxx:56)
==25406==    by 0x2D3449C6: opdet::RunHitFinder(std::vector<raw::OpDetWaveform, std::allocator<raw::OpDetWaveform> > const&, std::vector<recob::OpHit, std::allocator<recob::OpHit> >&, pmtana::PulseRecoManager const&, pmtana::PMTPulseRecoBase const&, geo::GeometryCore const&, float const&, detinfo::DetectorClocks const&, std::vector<double, std::allocator<double> > const&, bool const&) (OpHitAlg.cxx:39)
==25406==    by 0x2DD36B6D: opdet::OpHitFinder::produce(art::Event&) (OpHitFinder_module.cc:252)
==25406==    by 0xA6308D0: art::EDProducer::doEvent(art::EventPrincipal&, art::CurrentProcessingContext const*) (EDProducer.cc:28)
==25406==    by 0xA6D107D: art::WorkerT<art::EDProducer>::implDoBegin(art::EventPrincipal&, art::CurrentProcessingContext const*) (WorkerT.h:86)
==25406==    by 0x984AC4F: bool art::Worker::doWork<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&, art::CurrentProcessingContext const*) (Worker.h:221)
==25406==    by 0x9850FA9: bool art::WorkerInPath::runWorker<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&, art::CurrentProcessingContext const*) (WorkerInPath.h:80)
==25406==  Address 0x3b6cdda0 is 0 bytes after a block of size 8,000 alloc'd
==25406==    at 0x4A09E85: operator new(unsigned long) (vg_replace_malloc.c:333)
==25406==    by 0x4D9C9D9: __gnu_cxx::new_allocator<unsigned long>::allocate(unsigned long, void const*) (new_allocator.h:104)
==25406==    by 0x4D99F75: std::allocator_traits<std::allocator<unsigned long> >::allocate(std::allocator<unsigned long>&, unsigned long) (alloc_traits.h:357)
==25406==    by 0x4D97739: std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_M_allocate(unsigned long) (stl_vector.h:170)
==25406==    by 0x4DD0760: std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_M_create_storage(unsigned long) (stl_vector.h:185)
==25406==    by 0x4DCE1A2: std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_Vector_base(unsigned long, std::allocator<unsigned long> const&) (stl_vector.h:136)
==25406==    by 0x22F7AE7D: std::vector<unsigned long, std::allocator<unsigned long> >::vector(unsigned long, unsigned long const&, std::allocator<unsigned long> const&) (stl_vector.h:291)
==25406==    by 0x2D34379F: pmtana::BinnedMaxOccurrence(std::vector<double, std::allocator<double> > const&, unsigned long) (UtilFunc.cxx:74)
==25406==    by 0x2D337764: pmtana::PedAlgoRollingMean::ComputePedestal(std::vector<short, std::allocator<short> > const&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&) (PedAlgoRollingMean.cxx:137)
==25406==    by 0x2D334242: pmtana::PMTPedestalBase::Evaluate(std::vector<short, std::allocator<short> > const&) (PMTPedestalBase.cxx:42)
==25406==    by 0x2D33951D: pmtana::PedAlgoUB::ComputePedestal(std::vector<short, std::allocator<short> > const&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&) (PedAlgoUB.cxx:61)
==25406==    by 0x2D334242: pmtana::PMTPedestalBase::Evaluate(std::vector<short, std::allocator<short> > const&) (PMTPedestalBase.cxx:42)
==25406== 
==25406== Invalid read of size 8
==25406==    at 0x2D3438EA: pmtana::BinnedMaxOccurrence(std::vector<double, std::allocator<double> > const&, unsigned long) (UtilFunc.cxx:82)
==25406==    by 0x2D337788: pmtana::PedAlgoRollingMean::ComputePedestal(std::vector<short, std::allocator<short> > const&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&) (PedAlgoRollingMean.cxx:138)
==25406==    by 0x2D334242: pmtana::PMTPedestalBase::Evaluate(std::vector<short, std::allocator<short> > const&) (PMTPedestalBase.cxx:42)
==25406==    by 0x2D33951D: pmtana::PedAlgoUB::ComputePedestal(std::vector<short, std::allocator<short> > const&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&) (PedAlgoUB.cxx:61)
==25406==    by 0x2D334242: pmtana::PMTPedestalBase::Evaluate(std::vector<short, std::allocator<short> > const&) (PMTPedestalBase.cxx:42)
==25406==    by 0x2D346C56: pmtana::PulseRecoManager::Reconstruct(std::vector<short, std::allocator<short> > const&) const (PulseRecoManager.cxx:56)
==25406==    by 0x2D3449C6: opdet::RunHitFinder(std::vector<raw::OpDetWaveform, std::allocator<raw::OpDetWaveform> > const&, std::vector<recob::OpHit, std::allocator<recob::OpHit> >&, pmtana::PulseRecoManager const&, pmtana::PMTPulseRecoBase const&, geo::GeometryCore const&, float const&, detinfo::DetectorClocks const&, std::vector<double, std::allocator<double> > const&, bool const&) (OpHitAlg.cxx:39)
==25406==    by 0x2DD36B6D: opdet::OpHitFinder::produce(art::Event&) (OpHitFinder_module.cc:252)
==25406==    by 0xA6308D0: art::EDProducer::doEvent(art::EventPrincipal&, art::CurrentProcessingContext const*) (EDProducer.cc:28)
==25406==    by 0xA6D107D: art::WorkerT<art::EDProducer>::implDoBegin(art::EventPrincipal&, art::CurrentProcessingContext const*) (WorkerT.h:86)
==25406==    by 0x984AC4F: bool art::Worker::doWork<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&, art::CurrentProcessingContext const*) (Worker.h:221)
==25406==    by 0x9850FA9: bool art::WorkerInPath::runWorker<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&, art::CurrentProcessingContext const*) (WorkerInPath.h:80)
==25406==  Address 0x3b6cdda0 is 0 bytes after a block of size 8,000 alloc'd
==25406==    at 0x4A09E85: operator new(unsigned long) (vg_replace_malloc.c:333)
==25406==    by 0x4D9C9D9: __gnu_cxx::new_allocator<unsigned long>::allocate(unsigned long, void const*) (new_allocator.h:104)
==25406==    by 0x4D99F75: std::allocator_traits<std::allocator<unsigned long> >::allocate(std::allocator<unsigned long>&, unsigned long) (alloc_traits.h:357)
==25406==    by 0x4D97739: std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_M_allocate(unsigned long) (stl_vector.h:170)
==25406==    by 0x4DD0760: std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_M_create_storage(unsigned long) (stl_vector.h:185)
==25406==    by 0x4DCE1A2: std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_Vector_base(unsigned long, std::allocator<unsigned long> const&) (stl_vector.h:136)
==25406==    by 0x22F7AE7D: std::vector<unsigned long, std::allocator<unsigned long> >::vector(unsigned long, unsigned long const&, std::allocator<unsigned long> const&) (stl_vector.h:291)
==25406==    by 0x2D34379F: pmtana::BinnedMaxOccurrence(std::vector<double, std::allocator<double> > const&, unsigned long) (UtilFunc.cxx:74)
==25406==    by 0x2D337764: pmtana::PedAlgoRollingMean::ComputePedestal(std::vector<short, std::allocator<short> > const&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&) (PedAlgoRollingMean.cxx:137)
==25406==    by 0x2D334242: pmtana::PMTPedestalBase::Evaluate(std::vector<short, std::allocator<short> > const&) (PMTPedestalBase.cxx:42)
==25406==    by 0x2D33951D: pmtana::PedAlgoUB::ComputePedestal(std::vector<short, std::allocator<short> > const&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&) (PedAlgoUB.cxx:61)
==25406==    by 0x2D334242: pmtana::PMTPedestalBase::Evaluate(std::vector<short, std::allocator<short> > const&) (PMTPedestalBase.cxx:42)
==25406== 
==25406== Invalid write of size 8
==25406==    at 0x2D3438F1: pmtana::BinnedMaxOccurrence(std::vector<double, std::allocator<double> > const&, unsigned long) (UtilFunc.cxx:82)
==25406==    by 0x2D337788: pmtana::PedAlgoRollingMean::ComputePedestal(std::vector<short, std::allocator<short> > const&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&) (PedAlgoRollingMean.cxx:138)
==25406==    by 0x2D334242: pmtana::PMTPedestalBase::Evaluate(std::vector<short, std::allocator<short> > const&) (PMTPedestalBase.cxx:42)
==25406==    by 0x2D33951D: pmtana::PedAlgoUB::ComputePedestal(std::vector<short, std::allocator<short> > const&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&) (PedAlgoUB.cxx:61)
==25406==    by 0x2D334242: pmtana::PMTPedestalBase::Evaluate(std::vector<short, std::allocator<short> > const&) (PMTPedestalBase.cxx:42)
==25406==    by 0x2D346C56: pmtana::PulseRecoManager::Reconstruct(std::vector<short, std::allocator<short> > const&) const (PulseRecoManager.cxx:56)
==25406==    by 0x2D3449C6: opdet::RunHitFinder(std::vector<raw::OpDetWaveform, std::allocator<raw::OpDetWaveform> > const&, std::vector<recob::OpHit, std::allocator<recob::OpHit> >&, pmtana::PulseRecoManager const&, pmtana::PMTPulseRecoBase const&, geo::GeometryCore const&, float const&, detinfo::DetectorClocks const&, std::vector<double, std::allocator<double> > const&, bool const&) (OpHitAlg.cxx:39)
==25406==    by 0x2DD36B6D: opdet::OpHitFinder::produce(art::Event&) (OpHitFinder_module.cc:252)
==25406==    by 0xA6308D0: art::EDProducer::doEvent(art::EventPrincipal&, art::CurrentProcessingContext const*) (EDProducer.cc:28)
==25406==    by 0xA6D107D: art::WorkerT<art::EDProducer>::implDoBegin(art::EventPrincipal&, art::CurrentProcessingContext const*) (WorkerT.h:86)
==25406==    by 0x984AC4F: bool art::Worker::doWork<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&, art::CurrentProcessingContext const*) (Worker.h:221)
==25406==    by 0x9850FA9: bool art::WorkerInPath::runWorker<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&, art::CurrentProcessingContext const*) (WorkerInPath.h:80)
==25406==  Address 0x3b6cdda0 is 0 bytes after a block of size 8,000 alloc'd
==25406==    at 0x4A09E85: operator new(unsigned long) (vg_replace_malloc.c:333)
==25406==    by 0x4D9C9D9: __gnu_cxx::new_allocator<unsigned long>::allocate(unsigned long, void const*) (new_allocator.h:104)
==25406==    by 0x4D99F75: std::allocator_traits<std::allocator<unsigned long> >::allocate(std::allocator<unsigned long>&, unsigned long) (alloc_traits.h:357)
==25406==    by 0x4D97739: std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_M_allocate(unsigned long) (stl_vector.h:170)
==25406==    by 0x4DD0760: std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_M_create_storage(unsigned long) (stl_vector.h:185)
==25406==    by 0x4DCE1A2: std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_Vector_base(unsigned long, std::allocator<unsigned long> const&) (stl_vector.h:136)
==25406==    by 0x22F7AE7D: std::vector<unsigned long, std::allocator<unsigned long> >::vector(unsigned long, unsigned long const&, std::allocator<unsigned long> const&) (stl_vector.h:291)
==25406==    by 0x2D34379F: pmtana::BinnedMaxOccurrence(std::vector<double, std::allocator<double> > const&, unsigned long) (UtilFunc.cxx:74)
==25406==    by 0x2D337764: pmtana::PedAlgoRollingMean::ComputePedestal(std::vector<short, std::allocator<short> > const&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&) (PedAlgoRollingMean.cxx:137)
==25406==    by 0x2D334242: pmtana::PMTPedestalBase::Evaluate(std::vector<short, std::allocator<short> > const&) (PMTPedestalBase.cxx:42)
==25406==    by 0x2D33951D: pmtana::PedAlgoUB::ComputePedestal(std::vector<short, std::allocator<short> > const&, std::vector<double, std::allocator<double> >&, std::vector<double, std::allocator<double> >&) (PedAlgoUB.cxx:61)
==25406==    by 0x2D334242: pmtana::PMTPedestalBase::Evaluate(std::vector<short, std::allocator<short> > const&) (PMTPedestalBase.cxx:42)
==25406== 
==25406== Conditional jump or move depends on uninitialised value(s)
==25406==    at 0x2881E8BC: cmtool::CBAlgoArray::Bool(cluster::ClusterParamsAlg const&, cluster::ClusterParamsAlg const&) (CBAlgoArray.cxx:75)
==25406==    by 0x2914A2CB: cmtool::CMergeManager::RunSeparate(std::vector<cluster::ClusterParamsAlg, std::allocator<cluster::ClusterParamsAlg> > const&, cmtool::CMergeBookKeeper&) const (CMergeManager.cxx:381)
==25406==    by 0x291491CD: cmtool::CMergeManager::IterationProcess() (CMergeManager.cxx:180)
==25406==    by 0x29135EE4: cmtool::CMManagerBase::Process() (CMManagerBase.cxx:114)
==25406==    by 0x28EC6E9A: cmtool::CMergeHelper::Process(std::vector<std::vector<util::PxHit, std::allocator<util::PxHit> >, std::allocator<std::vector<util::PxHit, std::allocator<util::PxHit> > > > const&) (CMergeHelper.cxx:32)
==25406==    by 0x2B8F0981: cluster::FuzzyClusterMerger::produce(art::Event&) (FuzzyClusterMerger_module.cc:328)
==25406==    by 0xA6308D0: art::EDProducer::doEvent(art::EventPrincipal&, art::CurrentProcessingContext const*) (EDProducer.cc:28)
==25406==    by 0xA6D107D: art::WorkerT<art::EDProducer>::implDoBegin(art::EventPrincipal&, art::CurrentProcessingContext const*) (WorkerT.h:86)
==25406==    by 0x984AC4F: bool art::Worker::doWork<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&, art::CurrentProcessingContext const*) (Worker.h:221)
==25406==    by 0x9850FA9: bool art::WorkerInPath::runWorker<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&, art::CurrentProcessingContext const*) (WorkerInPath.h:80)
==25406==    by 0x984BD52: void art::Path::processOneOccurrence<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&) (Path.h:167)
==25406==    by 0x9850D37: _ZZN3art8Schedule16runTriggerPaths_INS_16OccurrenceTraitsINS_14EventPrincipalELNS_16BranchActionTypeE0EEEEEbRNT_11MyPrincipalEENKUlS6_E_clIPNS_4PathEEEDaT_ (Schedule.h:178)
==25406==  Uninitialised value was created by a heap allocation
==25406==    at 0x4A09E85: operator new(unsigned long) (vg_replace_malloc.c:333)
==25406==    by 0x2B8EFAE2: cluster::FuzzyClusterMerger::FuzzyClusterMerger(fhicl::ParameterSet const&) (FuzzyClusterMerger_module.cc:197)
==25406==    by 0x2B8F152D: make_worker (FuzzyClusterMerger_module.cc:457)
==25406==    by 0xA6D8C1B: art::detail::ModuleFactory::makeWorker(art::WorkerParams const&, art::ModuleDescription const&) (ModuleFactory.cc:53)
==25406==    by 0xA6ABE33: art::PathManager::makeWorker_(art::detail::ModuleConfigInfo const&, std::map<std::string, std::shared_ptr<art::Worker>, std::less<std::string>, std::allocator<std::pair<std::string const, std::shared_ptr<art::Worker> > > >&) (PathManager.cc:496)
==25406==    by 0xA6ABA81: art::PathManager::makeWorker_(art::detail::ModuleInPathInfo const&, std::map<std::string, std::shared_ptr<art::Worker>, std::less<std::string>, std::allocator<std::pair<std::string const, std::shared_ptr<art::Worker> > > >&, std::vector<art::WorkerInPath, std::allocator<art::WorkerInPath> >&) (PathManager.cc:470)
==25406==    by 0xA6AC2CC: art::PathManager::fillWorkers_(int, std::string const&, std::vector<art::detail::ModuleInPathInfo, std::allocator<art::detail::ModuleInPathInfo> > const&, cet::exempt_ptr<art::HLTGlobalStatus>, std::map<std::string, std::shared_ptr<art::Worker>, std::less<std::string>, std::allocator<std::pair<std::string const, std::shared_ptr<art::Worker> > > >&) (PathManager.cc:527)
==25406==    by 0xA6ACA18: _ZZN3art11PathManager16triggerPathsInfoENS_10ScheduleIDEENKUlRKT_E_clISt4pairIKSsSt6vectorINS_6detail16ModuleInPathInfoESaISB_EEEEEDaS4_ (PathManager.cc:176)
==25406==    by 0xA6ACAC3: _ZSt8for_eachISt17_Rb_tree_iteratorISt4pairIKSsSt6vectorIN3art6detail16ModuleInPathInfoESaIS6_EEEEZNS4_11PathManager16triggerPathsInfoENS4_10ScheduleIDEEUlRKT_E_ET0_SD_SD_SH_ (stl_algo.h:3756)
==25406==    by 0xA6A92BB: _ZN3cet7for_allISt3mapISsSt6vectorIN3art6detail16ModuleInPathInfoESaIS5_EESt4lessISsESaISt4pairIKSsS7_EEEZNS3_11PathManager16triggerPathsInfoENS3_10ScheduleIDEEUlRKT_E_EEDaRSH_T0_ (container_algorithms.h:114)
==25406==    by 0xA6A94A3: art::PathManager::triggerPathsInfo(art::ScheduleID) (PathManager.cc:182)
==25406==    by 0xA6CC5BA: art::Schedule::Schedule(art::ScheduleID, art::PathManager&, fhicl::ParameterSet const&, art::TriggerNamesService const&, art::MasterProductRegistry&, art::ActionTable&, art::ActivityRegistry&) (Schedule.cc:44)
==25406== 
==25406== Conditional jump or move depends on uninitialised value(s)
==25406==    at 0x2881E8BC: cmtool::CBAlgoArray::Bool(cluster::ClusterParamsAlg const&, cluster::ClusterParamsAlg const&) (CBAlgoArray.cxx:75)
==25406==    by 0x29149D6B: cmtool::CMergeManager::RunMerge(std::vector<cluster::ClusterParamsAlg, std::allocator<cluster::ClusterParamsAlg> > const&, std::vector<bool, std::allocator<bool> > const&, cmtool::CMergeBookKeeper&) const (CMergeManager.cxx:296)
==25406==    by 0x291491F8: cmtool::CMergeManager::IterationProcess() (CMergeManager.cxx:183)
==25406==    by 0x29135EE4: cmtool::CMManagerBase::Process() (CMManagerBase.cxx:114)
==25406==    by 0x28EC6E9A: cmtool::CMergeHelper::Process(std::vector<std::vector<util::PxHit, std::allocator<util::PxHit> >, std::allocator<std::vector<util::PxHit, std::allocator<util::PxHit> > > > const&) (CMergeHelper.cxx:32)
==25406==    by 0x2B8F0981: cluster::FuzzyClusterMerger::produce(art::Event&) (FuzzyClusterMerger_module.cc:328)
==25406==    by 0xA6308D0: art::EDProducer::doEvent(art::EventPrincipal&, art::CurrentProcessingContext const*) (EDProducer.cc:28)
==25406==    by 0xA6D107D: art::WorkerT<art::EDProducer>::implDoBegin(art::EventPrincipal&, art::CurrentProcessingContext const*) (WorkerT.h:86)
==25406==    by 0x984AC4F: bool art::Worker::doWork<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&, art::CurrentProcessingContext const*) (Worker.h:221)
==25406==    by 0x9850FA9: bool art::WorkerInPath::runWorker<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&, art::CurrentProcessingContext const*) (WorkerInPath.h:80)
==25406==    by 0x984BD52: void art::Path::processOneOccurrence<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&) (Path.h:167)
==25406==    by 0x9850D37: _ZZN3art8Schedule16runTriggerPaths_INS_16OccurrenceTraitsINS_14EventPrincipalELNS_16BranchActionTypeE0EEEEEbRNT_11MyPrincipalEENKUlS6_E_clIPNS_4PathEEEDaT_ (Schedule.h:178)
==25406==  Uninitialised value was created by a heap allocation
==25406==    at 0x4A09E85: operator new(unsigned long) (vg_replace_malloc.c:333)
==25406==    by 0x2B8EFBEA: cluster::FuzzyClusterMerger::FuzzyClusterMerger(fhicl::ParameterSet const&) (FuzzyClusterMerger_module.cc:212)
==25406==    by 0x2B8F152D: make_worker (FuzzyClusterMerger_module.cc:457)
==25406==    by 0xA6D8C1B: art::detail::ModuleFactory::makeWorker(art::WorkerParams const&, art::ModuleDescription const&) (ModuleFactory.cc:53)
==25406==    by 0xA6ABE33: art::PathManager::makeWorker_(art::detail::ModuleConfigInfo const&, std::map<std::string, std::shared_ptr<art::Worker>, std::less<std::string>, std::allocator<std::pair<std::string const, std::shared_ptr<art::Worker> > > >&) (PathManager.cc:496)
==25406==    by 0xA6ABA81: art::PathManager::makeWorker_(art::detail::ModuleInPathInfo const&, std::map<std::string, std::shared_ptr<art::Worker>, std::less<std::string>, std::allocator<std::pair<std::string const, std::shared_ptr<art::Worker> > > >&, std::vector<art::WorkerInPath, std::allocator<art::WorkerInPath> >&) (PathManager.cc:470)
==25406==    by 0xA6AC2CC: art::PathManager::fillWorkers_(int, std::string const&, std::vector<art::detail::ModuleInPathInfo, std::allocator<art::detail::ModuleInPathInfo> > const&, cet::exempt_ptr<art::HLTGlobalStatus>, std::map<std::string, std::shared_ptr<art::Worker>, std::less<std::string>, std::allocator<std::pair<std::string const, std::shared_ptr<art::Worker> > > >&) (PathManager.cc:527)
==25406==    by 0xA6ACA18: _ZZN3art11PathManager16triggerPathsInfoENS_10ScheduleIDEENKUlRKT_E_clISt4pairIKSsSt6vectorINS_6detail16ModuleInPathInfoESaISB_EEEEEDaS4_ (PathManager.cc:176)
==25406==    by 0xA6ACAC3: _ZSt8for_eachISt17_Rb_tree_iteratorISt4pairIKSsSt6vectorIN3art6detail16ModuleInPathInfoESaIS6_EEEEZNS4_11PathManager16triggerPathsInfoENS4_10ScheduleIDEEUlRKT_E_ET0_SD_SD_SH_ (stl_algo.h:3756)
==25406==    by 0xA6A92BB: _ZN3cet7for_allISt3mapISsSt6vectorIN3art6detail16ModuleInPathInfoESaIS5_EESt4lessISsESaISt4pairIKSsS7_EEEZNS3_11PathManager16triggerPathsInfoENS3_10ScheduleIDEEUlRKT_E_EEDaRSH_T0_ (container_algorithms.h:114)
==25406==    by 0xA6A94A3: art::PathManager::triggerPathsInfo(art::ScheduleID) (PathManager.cc:182)
==25406==    by 0xA6CC5BA: art::Schedule::Schedule(art::ScheduleID, art::PathManager&, fhicl::ParameterSet const&, art::TriggerNamesService const&, art::MasterProductRegistry&, art::ActionTable&, art::ActivityRegistry&) (Schedule.cc:44)
==25406== 
==25406== Conditional jump or move depends on uninitialised value(s)
==25406==    at 0x27BEE1CE: trkf::SeedFinderAlgorithm::ConsolidateSeed(recob::Seed&, art::PtrVector<recob::Hit> const&, std::vector<char, std::allocator<char> >&, std::vector<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >, std::allocator<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > > >&, bool) (SeedFinderAlgorithm.cxx:565)
==25406==    by 0x27BEC5D9: trkf::SeedFinderAlgorithm::FindSeeds(art::PtrVector<recob::Hit> const&, std::vector<art::PtrVector<recob::Hit>, std::allocator<art::PtrVector<recob::Hit> > >&, unsigned int) (SeedFinderAlgorithm.cxx:259)
==25406==    by 0x27BF2D7C: trkf::SeedFinderAlgorithm::GetSeedsFromUnSortedHits(art::PtrVector<recob::Hit> const&, std::vector<art::PtrVector<recob::Hit>, std::allocator<art::PtrVector<recob::Hit> > >&, unsigned int) (SeedFinderAlgorithm.cxx:1130)
==25406==    by 0x27D1E431: trkf::Track3DKalmanHitAlg::makeTracks(std::vector<trkf::KalmanInput, std::allocator<trkf::KalmanInput> >&) (Track3DKalmanHitAlg.cxx:139)
==25406==    by 0x32F30069: trkf::Track3DKalmanHit::produce(art::Event&) (Track3DKalmanHit_module.cc:216)
==25406==    by 0xA6308D0: art::EDProducer::doEvent(art::EventPrincipal&, art::CurrentProcessingContext const*) (EDProducer.cc:28)
==25406==    by 0xA6D107D: art::WorkerT<art::EDProducer>::implDoBegin(art::EventPrincipal&, art::CurrentProcessingContext const*) (WorkerT.h:86)
==25406==    by 0x984AC4F: bool art::Worker::doWork<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&, art::CurrentProcessingContext const*) (Worker.h:221)
==25406==    by 0x9850FA9: bool art::WorkerInPath::runWorker<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&, art::CurrentProcessingContext const*) (WorkerInPath.h:80)
==25406==    by 0x984BD52: void art::Path::processOneOccurrence<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&) (Path.h:167)
==25406==    by 0x9850D37: _ZZN3art8Schedule16runTriggerPaths_INS_16OccurrenceTraitsINS_14EventPrincipalELNS_16BranchActionTypeE0EEEEEbRNT_11MyPrincipalEENKUlS6_E_clIPNS_4PathEEEDaT_ (Schedule.h:178)
==25406==    by 0x9850DE6: _ZN3art8Schedule21doForAllEnabledPaths_IZNS0_16runTriggerPaths_INS_16OccurrenceTraitsINS_14EventPrincipalELNS_16BranchActionTypeE0EEEEEbRNT_11MyPrincipalEEUlS7_E_EEvS7_ (Schedule.h:205)
==25406==  Uninitialised value was created by a stack allocation
==25406==    at 0x27BED84B: trkf::SeedFinderAlgorithm::ConsolidateSeed(recob::Seed&, art::PtrVector<recob::Hit> const&, std::vector<char, std::allocator<char> >&, std::vector<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >, std::allocator<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > > >&, bool) (SeedFinderAlgorithm.cxx:453)
==25406== 
==25406== Conditional jump or move depends on uninitialised value(s)
==25406==    at 0x27BEE1CE: trkf::SeedFinderAlgorithm::ConsolidateSeed(recob::Seed&, art::PtrVector<recob::Hit> const&, std::vector<char, std::allocator<char> >&, std::vector<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >, std::allocator<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > > >&, bool) (SeedFinderAlgorithm.cxx:565)
==25406==    by 0x27BEC197: trkf::SeedFinderAlgorithm::FindSeeds(art::PtrVector<recob::Hit> const&, std::vector<art::PtrVector<recob::Hit>, std::allocator<art::PtrVector<recob::Hit> > >&, unsigned int) (SeedFinderAlgorithm.cxx:205)
==25406==    by 0x27BF2D7C: trkf::SeedFinderAlgorithm::GetSeedsFromUnSortedHits(art::PtrVector<recob::Hit> const&, std::vector<art::PtrVector<recob::Hit>, std::allocator<art::PtrVector<recob::Hit> > >&, unsigned int) (SeedFinderAlgorithm.cxx:1130)
==25406==    by 0x27D1E431: trkf::Track3DKalmanHitAlg::makeTracks(std::vector<trkf::KalmanInput, std::allocator<trkf::KalmanInput> >&) (Track3DKalmanHitAlg.cxx:139)
==25406==    by 0x32F30069: trkf::Track3DKalmanHit::produce(art::Event&) (Track3DKalmanHit_module.cc:216)
==25406==    by 0xA6308D0: art::EDProducer::doEvent(art::EventPrincipal&, art::CurrentProcessingContext const*) (EDProducer.cc:28)
==25406==    by 0xA6D107D: art::WorkerT<art::EDProducer>::implDoBegin(art::EventPrincipal&, art::CurrentProcessingContext const*) (WorkerT.h:86)
==25406==    by 0x984AC4F: bool art::Worker::doWork<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&, art::CurrentProcessingContext const*) (Worker.h:221)
==25406==    by 0x9850FA9: bool art::WorkerInPath::runWorker<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&, art::CurrentProcessingContext const*) (WorkerInPath.h:80)
==25406==    by 0x984BD52: void art::Path::processOneOccurrence<art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0> >(art::OccurrenceTraits<art::EventPrincipal, (art::BranchActionType)0>::MyPrincipal&) (Path.h:167)
==25406==    by 0x9850D37: _ZZN3art8Schedule16runTriggerPaths_INS_16OccurrenceTraitsINS_14EventPrincipalELNS_16BranchActionTypeE0EEEEEbRNT_11MyPrincipalEENKUlS6_E_clIPNS_4PathEEEDaT_ (Schedule.h:178)
==25406==    by 0x9850DE6: _ZN3art8Schedule21doForAllEnabledPaths_IZNS0_16runTriggerPaths_INS_16OccurrenceTraitsINS_14EventPrincipalELNS_16BranchActionTypeE0EEEEEbRNT_11MyPrincipalEEUlS7_E_EEvS7_ (Schedule.h:205)
==25406==  Uninitialised value was created by a stack allocation
==25406==    at 0x27BED84B: trkf::SeedFinderAlgorithm::ConsolidateSeed(recob::Seed&, art::PtrVector<recob::Hit> const&, std::vector<char, std::allocator<char> >&, std::vector<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >, std::allocator<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > > >&, bool) (SeedFinderAlgorithm.cxx:453)
==25406== 

Related issues

Related to art - Support #13450: Memory usage in merging art filesClosed08/04/2016

Related to LArSoft - Bug #14182: Memory errors and leaksAssigned10/19/2016

History

#1 Updated by Paul Russo over 3 years ago

As an additional note evidence for per-event memory hoarding in this job was found. Although the memory leak checker shows that this memory growth is released at the end of the job, so this is not a memory leak, there is a definite growth in memory use per-event (hoarding) for a subset of the LArSoft code modules in use in the uboone stage 1 reco:

MemoryTracker Per-module SUMMARY

 ( Numbers in '[...]' correspond to the event nos. in the general summary. )

Modules increasing Vsize (Mbytes)                       Vsize      \u0394 Vsize      RSS         \u0394 RSS
======================================================================================================
reco:mchitfinder:MCHitFinder
 [1]  run: 1 subRun: 1 event: 1                       2034.926     595.047    1093.086     583.879
 [2]  run: 1 subRun: 1 event: 2                       2606.211     16.000     1680.902     26.676   
------------------------------------------------------------------------------------------------------
reco:digitfilter:RawDigitFilterUBooNE
 [1]  run: 1 subRun: 1 event: 1                       2173.320     138.395    1231.012     137.289
------------------------------------------------------------------------------------------------------
reco:caldata:CalWireROI
 [1]  run: 1 subRun: 1 event: 1                       2193.246     19.926     1249.137     18.125 
------------------------------------------------------------------------------------------------------
reco:gaushit:GausHitFinder
 [1]  run: 1 subRun: 1 event: 1                       2203.738     10.492     1264.324     15.188
 [2]  run: 1 subRun: 1 event: 2                       2614.211      8.000     1682.176      0.262   
 [4]  run: 1 subRun: 1 event: 4                       2762.352      0.008     1832.809      1.062
------------------------------------------------------------------------------------------------------
reco:fuzzyclustermerger:FuzzyClusterMerger            
 [1]  run: 1 subRun: 1 event: 1                       2209.941      6.203     1271.637      6.664
------------------------------------------------------------------------------------------------------
reco:trackkalmanhit:Track3DKalmanHit
 [1]  run: 1 subRun: 1 event: 1                       2230.508     20.566     1293.391     21.754
------------------------------------------------------------------------------------------------------
reco:stitchkalmanhit:TrackStitcher
 [1]  run: 1 subRun: 1 event: 1                       2233.508      3.000     1296.840      3.449
------------------------------------------------------------------------------------------------------
reco:trackkalmanhitcalo:Calorimetry
 [1]  run: 1 subRun: 1 event: 1                       2241.602      8.094     1303.461      6.621
------------------------------------------------------------------------------------------------------
reco:stitchkalmanhitcalo:Calorimetry
 [1]  run: 1 subRun: 1 event: 1                       2246.605      5.004     1303.934      0.473
------------------------------------------------------------------------------------------------------
reco:stitchkalmanhitContTag:TrackContainmentTagger
 [1]  run: 1 subRun: 1 event: 1                       2251.629      5.023     1308.551      4.082

For these modules, the memory usage grows and grows and exceeds memory limits no matter what the limit is (eventually).
There are two patterns: some grow at input-file switch and some grow per-event.
Need to determine what the memory is being used for. It may be legitimate, but the memory should be released when the module has finished processing the file or the event. If you wait for the end of job cleanup, you may have exceeded the memory limit. This causes the job to run and crash.

#2 Updated by Gianluca Petrillo about 3 years ago

  • Category set to Reconstruction
  • Status changed from New to Feedback
  • Occurs In v06_00_01 added

Bout this last report by Paul, that seems to be extracted from a MicroBooNE reconstruction "stage 1": can MicroBooNE confirm and produce a relevant test case to be studied?
Given the type of problem, a grid-like job with many events (e.g. 100) would be the best starting point.

#3 Updated by Gianluca Petrillo about 3 years ago

#4 Updated by Katherine Lato about 3 years ago

  • Status changed from Feedback to Accepted
  • Assignee set to Katherine Lato

Need to break into subtasks and get code authors involved in fixing, some may be memory hoarding not a leak. Katherine will work with Erica on finding the code authors and what instructions to give. Paul met with Gianluca, then stopped by Katherine's desk--have updated the description above so it should be clear what code module owners are to do.

#5 Updated by Gianluca Petrillo about 3 years ago

Paul reminded me that this issue is not primarily about memory hoarding, but about the effective bugs (leaks) reported by valgrind.

The hints of memory hoarding may still be real, and they might deserve some exploration.
My comment was about MicroBooNE testing that there is actually steady memory increase, and if that is confirmed, we would need a way to clearly observe that, so that when we solve it we have as clear a way to see it is indeed fixed.
That should be a different issue than this one.

#6 Updated by Katherine Lato about 3 years ago

As mentioned at the 9/13/16 Coordination meeting, we will be dividing the ticket into a number of sub-tickets. These will be
assigned to code authors with tools and guidance to fix the problem.

#7 Updated by Katherine Lato almost 3 years ago

  • Related to Bug #14182: Memory errors and leaks added

#8 Updated by Katherine Lato almost 3 years ago

  • Assignee changed from Katherine Lato to Kazuhiro Terao
  • Priority changed from Low to Normal

Tracy Usher has an issue (#14182) for:
SeedFinderAlgorithm.cxx:565
SeedFinderAlgorithm.cxx:453

This is to fix
UtilFunc.cxx:82
CBAlgoArray.cxx:75

Please contact Erica or myself if you have any questions.

Here's the email chain for reference:

Hi Kazu,

It would be great if you could fix those bugs, because I doubt that that code is used in DUNE,
so it'd be difficult for me to test it after fixing the bugs.

Thank you!
Gleb
From: Kazuhiro Terao <>
Sent: Tuesday, October 18, 2016 12:56:41 PM
To: Gleb Sinev
Cc: Erica Snider; Katherine Lato; Alexander I. Himmel
Subject: Re: LArSoft code owner needed

Hi,

I didn’t look in details but a quick glance at it seems like what Erica suggested is correct.
But I am not the code author so cannot say for sure.
But I would not care about code author apriori and just run gdb w/ break point to check the hypothesis is correct.
Or run a unit test in python script.

For a reference, the original code repository is here: https://github.com/drinkingkazu/OpticalRecoTool/tree/master/OpHitFinder

If you want me to change/fix the code, I am happy to do that or happy to have anyone else does that.
I am seeing another definite bug (though a new one and may only concern UB), so will touch this code anyway.

Kazu

On Oct 14, 2016, at 12:43 PM, Gleb Sinev <> wrote:

Hi Erica,

Thanks for the explanation!
I think I understand it now.

Also, can't `ctr_v` be resized every time the function is called (between lines 74 and 75, for example)
in order to fix the potential bug you mentioned?

Gleb
From: Erica Snider <>
Sent: Friday, October 14, 2016 2:30:52 AM
To: Katherine Lato; Gleb Sinev; Alexander I. Himmel; Kazuhiro Terao
Subject: Re: LArSoft code owner needed

Hi Gleb,
I have taken a brief look at this code. (Gianluca was there for part of this too.) There is definitely a bug in BinnedMaxOccurrence (UtilFunc.cxx) that will cause this error, and a second potential problem that depends on the upstream code.

The definite bug is the following: the value of “index” which is used to access elements of “ctr_v” will always equal the value of “nbins” at least once during execution of the loop over v (lines 76 through 84). That happens when the value of mean_v[I] = the maximum value in the vector, which is also the value of *res.second. When “index” is equal to nbins,, then the operation at line 82 causes an out of bounds read and write of ctr_v.

Presumably, the fix is to check for this special value and then set index to nbins – 1. In any event, this is a bug. Kazu owns the code here, so should confirm that what I’ve said is correct.

The second problem is just a potential bug. Line 74 sets a static local vector variable “ctr_v” to length “nbins”, which is a call argument. If the function is ever called with a value of nbins greater than the value in the first call, then the length of ctr_v will be short, and there will be out of bounds reads and writes that would cause the observed error. I’ve not looked at the calling code yet to see whether this can happen.

Erica

#9 Updated by Katherine Lato almost 3 years ago

  • Status changed from Accepted to Assigned


Also available in: Atom PDF