Skip to content

v622 Prevent Access of deleted object during hadd tear down#9027

Merged
pcanal merged 2 commits intoroot-project:v6-22-00-patchesfrom
pcanal:v622-issue-9017
Sep 24, 2021
Merged

v622 Prevent Access of deleted object during hadd tear down#9027
pcanal merged 2 commits intoroot-project:v6-22-00-patchesfrom
pcanal:v622-issue-9017

Conversation

@pcanal
Copy link
Copy Markdown
Member

@pcanal pcanal commented Sep 23, 2021

Prevent a TTree from calling its won RecursiveRemove.

Call RecursiveRemove early in the TTree destructor (rather than last thing), to remove the tree
from any list (like another TTree's list of clones) to avoid that the destructor's deletion of
item (eg. the list of friends), provoke a call to this same TTree's RecursiveRemove which
will try to call the RecursiveRemove on the item being deleted.  An alternative would be
to replace the pattern.  `delete fFriends; fFriends = nullptr;`
with `auto tmp = fFriends; fFriends = nullptr; delete tmp;`

This fixes issue #9017 where we had a tear down crash because:

   ~TTree call delete fFriends which call RecursiveRemove which reach another TTree's list of clone
   where its find the (original) TTree and call its RecursiveRemove which tries (and fail) to call
   RecursiveRemove on fFriends

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

Delaying is no longer necessary since the introduction of TFriendElement::fOwnFile in commit 115203c
Call RecursiveRemove early in the TTree destructor (rather than last thing), to remove the tree
from any list (like another TTree's list of clones) to avoid that the destructor's deletion of
item (eg. the list of friends), provoke a call to this same TTree's RecursiveRemove which
will try to call the RecursiveRemove on the item being deleted.  An alternative would be
to replace the pattern.  `delete fFriends; fFriends = nullptr;`
with `auto tmp = fFriends; fFriends = nullptr; delete tmp;`

This fixes issue root-project#9017 where we had a tear down crash because:

   ~TTree call delete fFriends which call RecursiveRemove which reach another TTree's list of clone
   where its find the (original) TTree and call its RecursiveRemove which tries (and fail) to call
   RecursiveRemove on fFriends
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@pcanal pcanal self-assigned this Sep 23, 2021
@pcanal pcanal added the in:I/O label Sep 23, 2021
@pcanal pcanal added this to the 6.22/10 milestone Sep 23, 2021
@phsft-bot
Copy link
Copy Markdown

Build failed on mac11.0/cxx17.
Running on macphsft23.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2021-09-23T22:35:28.243Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/graf2d/mathtext/src/../inc/mathrender.h:53:14: warning: definition of implicit copy assignment operator for 'point_t' is deprecated because it has a user-declared copy constructor [-Wdeprecated-copy]
  • [2021-09-23T22:35:29.040Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/graf2d/mathtext/src/../inc/mathrender.h:53:14: warning: definition of implicit copy assignment operator for 'point_t' is deprecated because it has a user-declared copy constructor [-Wdeprecated-copy]
  • [2021-09-23T22:35:29.040Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/graf2d/mathtext/src/../inc/mathrender.h:53:14: warning: definition of implicit copy assignment operator for 'point_t' is deprecated because it has a user-declared copy constructor [-Wdeprecated-copy]
  • [2021-09-23T22:38:37.451Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/graf2d/graf/src/../../../graf2d/mathtext/inc/mathrender.h:53:14: warning: definition of implicit copy assignment operator for 'point_t' is deprecated because it has a user-declared copy constructor [-Wdeprecated-copy]
  • [2021-09-23T22:44:40.232Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/test/stressHistoFit.cxx:176:4: warning: definition of implicit copy assignment operator for 'CompareResult' is deprecated because it has a user-declared copy constructor [-Wdeprecated-copy]
  • [2021-09-23T22:46:01.875Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/roofit/histfactory/inc/RooStats/HistFactory/Systematics.h:232:5: warning: definition of implicit copy assignment operator for 'ShapeSys' is deprecated because it has a user-declared copy constructor [-Wdeprecated-copy]

@pcanal pcanal merged commit 7e59ef7 into root-project:v6-22-00-patches Sep 24, 2021
@pcanal pcanal deleted the v622-issue-9017 branch September 24, 2021 11:16
@pcanal pcanal linked an issue Sep 24, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Access of deleted object during hadd tear down.

2 participants