[ROOT-6819] rs101_limitexample.C: problems at teardown time (unloading?) Created: 14/Oct/14  Updated: 30/Oct/14  Resolved: 30/Oct/14

Status: Closed
Project: ROOT
Component/s: Cling
Affects Version/s: 6.02.00
Fix Version/s: 6.04.00, 5.34/23, 6.02/02

Type: Bug Priority: High
Reporter: Danilo Piparo Assignee: Philippe Canal
Resolution: Fixed Votes: 0
Labels: None
Environment:

OSX 10.9


Development:

 Description   

When executing this macro in interpreted mode issues are present during the finalisation of the process. For example:

 *** Break *** segmentation violation
 Generating stack trace...
 0x000000010c2377e6 in TListOfEnums::Unload() (in libCore.so) (TListOfEnums.cxx:364)
 0x000000010c228f9f in TClass::SetUnloaded() (in libCore.so) (TClass.cxx:5563)
 0x000000010c1ec059 in ROOT::RemoveClass(char const*) (in libCore.so) (TClassTable.cxx:785)
 0x000000010c2330c6 in ROOT::TGenericClassInfo::~TGenericClassInfo() (in libCore.so) (vector:481)
 0x00007fff8393a7a1 in __cxa_finalize (in libsystem_c.dylib) + 177
 0x00007fff8393aa4c in exit (in libsystem_c.dylib) + 22
 0x000000010c26530c in TUnixSystem::Exit(int, bool) (in libCore.so) (TUnixSystem.cxx:2112)
 0x000000010c72d6b1 in TRint::Run(bool) (in libRint.so) (TRint.cxx:437)
 0x000000010c0e7e8f in main (in root.exe) (rmain.cxx:29)
 0x00007fff842ca5fd in start (in libdyld.dylib) + 1
root.exe(51959,0x7fff734fc310) malloc: *** error for object 0x7fd94d1bc270: pointer being freed was not allocated



 Comments   
Comment by Axel Naumann [ 28/Oct/14 ]

Before fixing the teardown let's make sure there are no other valgrind errors:

valgrind
--suppressions=/home/axel/build/root/trunk/obj/etc/valgrind-root.supp
root.exe -l -b -q rs101_limitexample.C
 
and this is what I got:
 
[#0] ERROR:InputArguments -- RooArgSet::checkForDup: ERROR argument with
name weight_MarkovChain_local_ is already in this set
plotting the chain data - nentries = 9150
==28051== Invalid write of size 8
==28051==    at 0xC8DC0AB: frombuf(char*&, double*) (Bytes.h:417)
==28051==    by 0xC8DD68E: TBufferFile::ReadDouble(double&)
(TBufferFile.h:501)
==28051==    by 0x14BDDA11: TLeafD::ReadBasket(TBuffer&) (TLeafD.cxx:121)
==28051==    by 0x14B80F36: TBranch::ReadLeavesImpl(TBuffer&)
(TBranch.cxx:1824)
==28051==    by 0x14B86B22: TBranch::GetEntry(long long, int)
(TBranch.cxx:1278)
==28051==    by 0x18ACDC4C: R__LoadBranch(TBranch*, long long, bool)
(TTreeFormula.cxx:96)
==28051==    by 0x18AE76D8: double
TTreeFormula::EvalInstance<double>(int, char const**)
(TTreeFormula.cxx:3914)
==28051==    by 0x18AE1022: TTreeFormula::EvalInstance(int, char
const**) (TTreeFormula.h:176)
==28051==    by 0x18AB6241: TSelectorDraw::ProcessFill(long long)
(TSelectorDraw.cxx:1152)
==28051==    by 0x18B03B64: TTreePlayer::Process(TSelector*, char
const*, long long, long long) (TTreePlayer.cxx:2199)
==28051==    by 0x18AF6E94: TTreePlayer::DrawSelect(char const*, char
const*, char const*, long long, long long) (TTreePlayer.cxx:411)
==28051==    by 0x14C0B223: TTree::Draw(char const*, char const*, char
const*, long long, long long) (TTree.cxx:4033)
==28051==  Address 0x12c93ee8 is 56 bytes inside a block of size 64 free'd
==28051==    at 0x402C363: operator delete(void*) (vg_replace_malloc.c:502)
==28051==    by 0x13E1F5FF:
__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<TString const,
double> > >::deallocate(std::_Rb_tree_node<std::pair<TString const,
double> >*, unsigned long) (new_allocator.h:110)
==28051==    by 0x13E1F5CE: std::_Rb_tree<TString, std::pair<TString
const, double>, std::_Select1st<std::pair<TString const, double> >,
std::less<TString>, std::allocator<std::pair<TString const, double> >
> ::_M_put_node(std::_Rb_tree_node<std::pair<TString const, double> >*)
(stl_tree.h:374)
==28051==    by 0x13E1F558: std::_Rb_tree<TString, std::pair<TString
const, double>, std::_Select1st<std::pair<TString const, double> >,
std::less<TString>, std::allocator<std::pair<TString const, double> >
> ::_M_destroy_node(std::_Rb_tree_node<std::pair<TString const, double>
> *) (stl_tree.h:422)
==28051==    by 0x13E1F4CA: std::_Rb_tree<TString, std::pair<TString
const, double>, std::_Select1st<std::pair<TString const, double> >,
std::less<TString>, std::allocator<std::pair<TString const, double> >
> ::_M_erase(std::_Rb_tree_node<std::pair<TString const, double> >*)
(stl_tree.h:1127)
==28051==    by 0x13E2343D: std::_Rb_tree<TString, std::pair<TString
const, double>, std::_Select1st<std::pair<TString const, double> >,
std::less<TString>, std::allocator<std::pair<TString const, double> >
> ::~_Rb_tree() (stl_tree.h:671)
==28051==    by 0x13E1DBD4: std::map<TString, double,
std::less<TString>, std::allocator<std::pair<TString const, double> >
> ::~map() (stl_map.h:96)
==28051==    by 0x1629D994: RooStats::BranchStore::~BranchStore()
(RooStatsUtils.cxx:191)
==28051==    by 0x1629D165: RooStats::FillTree(TTree&, RooDataSet
const&) (RooStatsUtils.cxx:265)
==28051==    by 0x1629D211: RooStats::GetAsTTree(TString, TString,
RooDataSet const&) (RooStatsUtils.cxx:270)
==28051==    by 0x40CF119: ???
==28051==    by 0x40CE3A1: ???
==28051==
==28051== Invalid read of size 8
==28051==    at 0x14BDE037: TLeafD::GetValue(int) const (TLeafD.h:58)
==28051==    by 0x18AAA811: TLeaf::GetValueHelper<double>::Exec(TLeaf
const*, int) (TLeaf.h:54)
==28051==    by 0x18AA2ABA: double TLeaf::GetTypedValue<double>(int)
const (TLeaf.h:86)
==28051==    by 0x18AE77A4: double
TTreeFormula::EvalInstance<double>(int, char const**)
(TTreeFormula.cxx:3915)
==28051==    by 0x18AE1022: TTreeFormula::EvalInstance(int, char
const**) (TTreeFormula.h:176)
==28051==    by 0x18AB6241: TSelectorDraw::ProcessFill(long long)
(TSelectorDraw.cxx:1152)
==28051==    by 0x18B03B64: TTreePlayer::Process(TSelector*, char
const*, long long, long long) (TTreePlayer.cxx:2199)
==28051==    by 0x18AF6E94: TTreePlayer::DrawSelect(char const*, char
const*, char const*, long long, long long) (TTreePlayer.cxx:411)
==28051==    by 0x14C0B223: TTree::Draw(char const*, char const*, char
const*, long long, long long) (TTree.cxx:4033)
==28051==    by 0x40CF1B8: ???
==28051==    by 0x40CE3A1: ???
==28051==    by 0x8EE066E:
cling::IncrementalExecutor::executeFunction(llvm::StringRef,
cling::Value*) (IncrementalExecutor.cpp:272)
==28051==  Address 0x12c93ee8 is 56 bytes inside a block of size 64 free'd
==28051==    at 0x402C363: operator delete(void*) (vg_replace_malloc.c:502)
==28051==    by 0x13E1F5FF:
__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<TString const,
double> > >::deallocate(std::_Rb_tree_node<std::pair<TString const,
double> >*, unsigned long) (new_allocator.h:110)
==28051==    by 0x13E1F5CE: std::_Rb_tree<TString, std::pair<TString
const, double>, std::_Select1st<std::pair<TString const, double> >,
std::less<TString>, std::allocator<std::pair<TString const, double> >
> ::_M_put_node(std::_Rb_tree_node<std::pair<TString const, double> >*)
(stl_tree.h:374)
==28051==    by 0x13E1F558: std::_Rb_tree<TString, std::pair<TString
const, double>, std::_Select1st<std::pair<TString const, double> >,
std::less<TString>, std::allocator<std::pair<TString const, double> >
> ::_M_destroy_node(std::_Rb_tree_node<std::pair<TString const, double>
> *) (stl_tree.h:422)
==28051==    by 0x13E1F4CA: std::_Rb_tree<TString, std::pair<TString
const, double>, std::_Select1st<std::pair<TString const, double> >,
std::less<TString>, std::allocator<std::pair<TString const, double> >
> ::_M_erase(std::_Rb_tree_node<std::pair<TString const, double> >*)
(stl_tree.h:1127)
==28051==    by 0x13E2343D: std::_Rb_tree<TString, std::pair<TString
const, double>, std::_Select1st<std::pair<TString const, double> >,
std::less<TString>, std::allocator<std::pair<TString const, double> >
> ::~_Rb_tree() (stl_tree.h:671)
==28051==    by 0x13E1DBD4: std::map<TString, double,
std::less<TString>, std::allocator<std::pair<TString const, double> >
> ::~map() (stl_map.h:96)
==28051==    by 0x1629D994: RooStats::BranchStore::~BranchStore()
(RooStatsUtils.cxx:191)
==28051==    by 0x1629D165: RooStats::FillTree(TTree&, RooDataSet
const&) (RooStatsUtils.cxx:265)
==28051==    by 0x1629D211: RooStats::GetAsTTree(TString, TString,
RooDataSet const&) (RooStatsUtils.cxx:270)
==28051==    by 0x40CF119: ???
==28051==    by 0x40CE3A1: ???
==28051==

Comment by Philippe Canal [ 29/Oct/14 ]

the valgrind report is solved (in v5.34 patches, v6.02 patches and master).

Comment by Philippe Canal [ 30/Oct/14 ]

Hi,

This problem has been solved in v5.34 and v6.02 patch branches and the master.

Cheers,
Philippe

Generated at Tue Sep 24 10:42:05 CEST 2019 using Jira 7.13.1#713001-sha1:5e06076c2d215a6f699b7e5c90ab2fae7ba5a1ce.