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

ROOT's dictionary can get "confused" when asking for it with the "wrong name"

    XMLWordPrintable

Details

    Description

      Dear All,

      I'm in the process of unrolling a whole big of a mess in our analysis code that people started reporting recently. After some debugging, the issue boiled down to ROOT becoming unable to read std::vector<std::string> branches from a TTree under "certain circumstances".

      Attached is a demonstrator.

      The fileWriter application writes a simple file/tree with two std::vector<std::string> branches, and the fileReader application tries to read it. This by itself works correctly. But fileReader also calls TClass::GetClass with a "not-quite-correct" name. And when it does that, all hell breaks lose. It does this like:

      /// Function providing a "not quite right" name for types
      std::string typeName( const std::type_info& ti ) {
       
         // The result variable:
         std::string result = ti.name();
       
         // Demangle the name:
         int status = 0;
         char* tn = abi::__cxa_demangle( ti.name(), 0, 0, &status );
         if( status == 0 ) {
            result = tn;
            ::free( tn );
         }
       
         return result;
      }
      ...
         // Get the "type name" of vector<string>:
         const std::string className =
            typeName( typeid( std::vector< std::string > ) );
         Info( APP_NAME, "className = %s", className.c_str() );
         TClass::GetClass( className.c_str() );

      When building/running the code on top of "root-6.08.06-x86_64-slc6-gcc49-opt", this work as expected. I get the following output:

      Info in <fileReader>: className = std::vector<std::string, std::allocator<std::string> >
      Payload in entry 0:
      br1 = [element10]
      br2 = [element20]
      Payload in entry 1:
      br1 = [element10, element11]
      br2 = [element20, element21]
      ...

      But when I try to use "root-6.08.06-x86_64-slc6-gcc62-opt", or any newer version that we only have available with GCC 6.2, I get:

      Info in <fileReader>: className = std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >
      Error in <TBranchElement::InitInfo>: StreamerInfo is not compiled.
      Error in <TBranchElement::InitInfo>: StreamerInfo is not compiled.
      Error in <fileReader>: Failed to read entry 0 from: vecstring.root

      As you can imagine, we've just been seeing errors like this StreamerInfo one in our jobs, and it took quite a while to trace back the issue here.

      Now, we'll be working on resolving the issue from our side as well, but whatever the underlying issue is that gets ROOT so confused, should also be fixed in the meanwhile.

      Cheers,
      Attila

      Attachments

        Activity

          People

            pcanal Philippe Canal
            akraszna Attila Krasznahorkay
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Actual End: