Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-10397

[TTreeReaderArray] Segfault when accessing data from leaflist

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.22/00
    • Component/s: TTree
    • Labels:
      None
    • Environment:

      master on commit c53e1bc583920a8213ef6094e931adbac904fe60

      Description

      As pointed out in a forum post (https://root-forum.cern.ch/t/asnumpy-not-working-with-array-branches), RDF breaks with a segfault if you read data from a leaflist. Reproducer follows:

      Edit: Changed the reproducer to a TTreeReaderArray only impl and added the respective backtrace.
       

      #include "TFile.h"
      #include "TTree.h"
      #include "TTreeReader.h"
      #include "TTreeReaderArray.h"
       
      void make_file() {
          TFile f("file.root", "RECREATE");
          TTree t("tree", "tree");
          float x[10];
          int n;
          t.Branch("n", &n, "n/I");
          t.Branch("x", &x, "y[n]/F");
          for(int i = 0; i < 10; i++) {
              n = i;
              for(int j = 0; j < n; j++) {
                  x[j] = j;
              }
              t.Fill();
          };
          f.Write();
          f.Close();
      }
       
      int main() {
          make_file();
       
          auto f = TFile::Open("file.root");
          TTreeReader r("tree", f);
          TTreeReaderArray<float> x(r, "x.y");
       
          r.Next();
          x.GetSize();
          return 0;
      }
      

      The debugger tells us the following:

       

      #0  0x00007ffff4f2c508 in TTreeReaderValue<int>::Get (this=0x0)
          at /mnt/build/jenkins/workspace/lcg_release_latest/BUILDTYPE/Debug/COMPILER/gcc9binutils/LABEL/centos7/build/projects/ROOT-v6-18-00-patches/src/ROOT-v6-18-00-patches-build/include/TTreeReaderValue.h:156
      #1  0x00007ffff4f2bb2e in TTreeReaderValue<int>::operator* (this=0x0)
          at /mnt/build/jenkins/workspace/lcg_release_latest/BUILDTYPE/Debug/COMPILER/gcc9binutils/LABEL/centos7/build/projects/ROOT-v6-18-00-patches/src/ROOT-v6-18-00-patches-build/include/TTreeReaderValue.h:168
      #2  0x00007ffff4f27ea4 in (anonymous namespace)::TUIntOrIntReader<(anonymous namespace)::TLeafReader>::GetSize (this=0x15a9db0)
          at /mnt/build/jenkins/workspace/lcg_release_latest/BUILDTYPE/Debug/COMPILER/gcc9binutils/LABEL/centos7/build/projects/ROOT-v6-18-00-patches/src/ROOT/v6-18-00-patches/tree/treeplayer/src/TTreeReaderArray.cxx:230
      #3  0x00007ffff4f24a21 in (anonymous namespace)::TLeafParameterSizeReader::GetSize (this=0x15a9db0, 
          proxy=0x15a9c60)
          at /mnt/build/jenkins/workspace/lcg_release_latest/BUILDTYPE/Debug/COMPILER/gcc9binutils/LABEL/centos7/build/projects/ROOT-v6-18-00-patches/src/ROOT/v6-18-00-patches/tree/treeplayer/src/TTreeReaderArray.cxx:328
      #4  0x00000000004017a2 in ROOT::Internal::TTreeReaderArrayBase::GetSize (this=0x7fffffffbf90)
          at /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6-18-00-patches-00a33/x86_64-centos7-gcc9-dbg/include/TTreeReaderValue.h:108
      #5  main () at test.C:32
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                axel Axel Naumann
                Reporter:
                swunsch Stefan Wunsch
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: