-
Notifications
You must be signed in to change notification settings - Fork 482
Custom member streamer for CalArray<o2::tpc::PadFlags>::mData #14830
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
Conversation
This commit expands on AliceO2Group#14427 and fixes the issue brought up in https://its.cern.ch/jira/browse/O2-4671. After debugging/testing it turns out that the approach taken via a customer streamer for std::vector<o2::tpc::PadFlags> does not take effect in the ROOT/IO because apparently ROOT still prefers to use the CollectionProxy for std::vector and does not employ the custom streamer. Instead, after discussion with @pcanal, this commit proposes to implement a custom stream just for the mData data member of CalArray<o2::tpc::PadFlags>. This is the only place where we use o2::tpc::PadFlags in IO and it fixes the problem when reading CCDB objects containing such data. I have verified that the following code ``` o2-ccdb-downloadccdbfile -p TPC/Calib/IDC_PadStatusMap_A -t 1731274461770 -d ./ -o tpc_idc.root --no-preserve-path root tpc_idc.root gFile->Get<o2::tpc::CalDet<o2::tpc::PadFlags>>("ccdb_object") ``` correctly executes the custom streamer function. Note that there is also no need to make the code ROOT version dependent. We need to fix the reading in any case and the writing will just stay the same. Concerning situations, where future classes will write data containing std::vector<o2::tpc::PadFlags> we should be protected by the fact that this bug has been fixed >= ROOT 6.36 in any case. This commit relates also to root-project/root#17009 The commit also re-enables dictionary creation of related classes and adds a dictionary for CalArray<o2::tpc::PadFlags> previously missing.
|
REQUEST FOR PRODUCTION RELEASES: This will add The following labels are available |
|
As discussed privately, I think indeed the current code right now works by accident in certain builds due to the "static initialisation order fiasco" accidentally being the one we need. Given this improves over it, I am all for it. |
|
The problem is not related to static initialization but rather that ROOT ignores custom streamer functions on std C++ collections. The following code demonstrated this: because the writing of |
|
I am puzzled. I developed the code with a similar small case reproducer and there is a different behavior in O2Physics with my previous patch removed. Do you see the same without the |
|
Yes I tried with Philippe the cases with and without the |
A continuation of the CalDet<TPCFlags> saga, possibly related to https://its.cern.ch/jira/browse/O2-4671 Tests on ARM, even after deployment of the custom streamer in AliceO2Group#14830, still showed segfaults in TPC digitization. With the relevant code isolated into a unit test in AliceO2Group#14850, it was possible to do a valgrind study. This showed Invalid reads to the mData of CalArray. Thereafter, putting assert statements showed that we often access CalArray<PadFlags> data slightly out of bounds - irrespective of custom streamer or not. This then either indicates a problem in the code logic or a problem with the calibration CCDB objects. This should clearly be fixed. In the meantime, this commit adds a protection against invalid accesses and returns a trivial answer as well as an error message. This is in any case better than undefined behaviour. In addition, this commit introduces possibility to switch off the custom streamer for further studies.
A continuation of the CalDet<TPCFlags> saga, possibly related to https://its.cern.ch/jira/browse/O2-4671 Tests on ARM, even after deployment of the custom streamer in #14830, still showed segfaults in TPC digitization. With the relevant code isolated into a unit test in #14850, it was possible to do a valgrind study. This showed Invalid reads to the mData of CalArray. Thereafter, putting assert statements showed that we often access CalArray<PadFlags> data slightly out of bounds - irrespective of custom streamer or not. This then either indicates a problem in the code logic or a problem with the calibration CCDB objects. This should clearly be fixed. In the meantime, this commit adds a protection against invalid accesses and returns a trivial answer as well as an error message. This is in any case better than undefined behaviour. In addition, this commit introduces possibility to switch off the custom streamer for further studies.
A continuation of the CalDet<TPCFlags> saga, possibly related to https://its.cern.ch/jira/browse/O2-4671 Tests on ARM, even after deployment of the custom streamer in AliceO2Group#14830, still showed segfaults in TPC digitization. With the relevant code isolated into a unit test in AliceO2Group#14850, it was possible to do a valgrind study. This showed Invalid reads to the mData of CalArray. Thereafter, putting assert statements showed that we often access CalArray<PadFlags> data slightly out of bounds - irrespective of custom streamer or not. This then either indicates a problem in the code logic or a problem with the calibration CCDB objects. This should clearly be fixed. In the meantime, this commit adds a protection against invalid accesses and returns a trivial answer as well as an error message. This is in any case better than undefined behaviour. In addition, this commit introduces possibility to switch off the custom streamer for further studies.
This commit expands on #14427 and fixes the issue brought up in https://its.cern.ch/jira/browse/O2-4671.
After debugging/testing it turns out that the approach taken via a customer streamer for
std::vector<o2::tpc::PadFlags>does not take effect in the ROOT/IO because apparently ROOT still prefers to use the CollectionProxy for std::vector and does not employ the custom streamer.Instead, after discussion with @pcanal, this commit proposes to implement a custom stream just for the mData data member of
CalArray<o2::tpc::PadFlags>. This is the only place where we useo2::tpc::PadFlagsin IO and it fixes the problem when reading CCDB objects containing such data.I have verified that the following code
correctly executes the custom streamer function.
Note that there is also no need to make the code ROOT version dependent. We need to fix the reading in any case and the writing will just stay the same.
Concerning situations, where future classes will write data containing
std::vector<o2::tpc::PadFlags>we should be protected by the fact that this bug has been fixed >= ROOT 6.36 in any case.This commit relates also to
root-project/root#17009