-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[cont] Clear "C" TClonesArray: Remove object from TProcessID-table ; Allow removing without destructing #18439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Test Results 17 files 17 suites 3d 16h 10m 13s ⏱️ For more details on these failures, see this check. Results for commit 1348edd. ♻️ This comment has been updated with latest results. |
This seems to investigate both https://its.cern.ch/jira/browse/ROOT-7249 and https://its.cern.ch/jira/browse/ROOT-7473. If so please update the description and the tickets accordingly. Thanks :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will (of course :)) needs new tests checking that the new code does what we hope it does. Thanks.
It's already breaking some tests, so not sure if the JIRA issue should be close as won't fix. Or be an opt-in via a bool argument. |
I did not do a very deep investigation of the test failures, but at first glance, it might be related to a missing implementation for the second part of the suggestion in https://its.cern.ch/jira/browse/ROOT-7249 , i.e. clearing TRef / TRefArray references to objects which have been removed (given that the |
And of course, thanks for coming back to these issue reports 👍 . |
Co-authored-by: Philippe Canal <[email protected]>
… to be left to the user's discretion. In addition we need to record that the content was updated. Co-authored-by: Philippe Canal <[email protected]>
Test failires are gone, thanks pcanal! Not sure either though how to cleanup the TRefArrays mentioned by olifre. |
I collected together a testcase from 10 years ago, it's quite minimal, but still spread across different files it requires:
Sadly, my old code is not ready for copy and paste into a
will write out a small file I hope that helps — in the end, an |
That's already a huge help thanks a lot |
if (pruneSecondChildren && (e % 2 != 0)) { | ||
children.Clear("C"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@olifre could you explain at this line how your "second workaround" was working? I guess that, before calling dataTree.Fill(), you were walking in a for-loop the motherPart.GetChild() checking whether the stored process ID still existed in the static TProcess table ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ferdymercury Actually, since this was in an experiment-specific framework and I did not trust all users to do it right, I chose the following approach:
- Have two classes inheriting from
TRef
andTRefArray
. - Via an interface class (to prevent code duplication), these two classes had a hook when any reference was set, injecting themselves into a global static list of instances referencing objects.
- Before writeout, this static list of referencing instances is walked and each instance is asked to check the references, i.e. in the case of the class inheriting form
TRefArray
:
void CBTRefArray::fMaybePruned() {
for (Int_t i = 0; i < fSize; i++) {
if (fUIDs[i]) {
/* Re-check reference-target, might have become NULL due to pruning -
* in that case, store that in our UniqueID.
*/
if (At(i) == nullptr) {
fUIDs[i] = 0;
}
}
}
}
(and the same without loop for TRef
).
So in the end, it was the loop you described, but actually the TRef
classes themselves were checking their reference targets and in case these had become nullptr
they adapted their internally stored UID before writeout.
I'm not sure this can realistically be put into the Streamers, as the reference target may have been written out and deleted from memory already, which is why I used a "user hook before writeout" to trigger this check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
A bit related issue: https://its.cern.ch/jira/browse/ROOT-6077
This Pull request:
Changes or fixes:
Explores suggestion by @olifre in https://its.cern.ch/jira/browse/ROOT-7249 to see if it impacts CI tests
And also allow removing without destructing via new ClearSlot function https://its.cern.ch/jira/browse/ROOT-7473
Checklist: