Re: [ROOT] segmentation violation in TBranch::GetEntry

From: Ruben Shahoian (Ruben.Shahoyan@cern.ch)
Date: Fri Mar 08 2002 - 15:41:39 MET


Hello Rene,
on both systems we are running with root_v3.01.06 
For the system which was crushing (bad.out) the root was taken
from root_v3.01.06.Linux.2.2.12-20smp.egcs.tar.gz, since it has
RedHat 6.2 with Red Hat Linux release 6.2 with gcc version egcs-2.91.66
19990314/Linux(egcs-1.1.2 release). The "good" system is running
root from root_v3.01.06.Linux.2.4.4-rh7.1.tar.gz, since it is has 
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)
These are the only differences between the systems. 
We don't use TTree::SetBranchStyle(mode);

Below is the output from "bad" system. 
Best regards,
	Ruben

[shahoian@lyopcs2 ~/NA60]# echo $ROOTSYS
/home/na50/shahoian/root
[shahoian@lyopcs2 ~/NA60]# echo $LD_LIBRARY_PATH
/home/na50/shahoian/NA60/lib/tgt_Linux:/home/na50/shahoian/NA60/lib/tgt_Linux:/home/na50/shahoian/root/lib:./
[shahoian@lyopcs2 ~/NA60]# na60root
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   3.01/06      12 July 2001   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

Compiled with thread support.

CINT/ROOT C/C++ Interpreter version 5.15.06, June 30 2001
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .x NaPyTrigXXX_test.C(1,"na60pyJpsi.root")
// creates the tree in the na60pyJpsi.root file
root [1] fl = new TFile("na60pyJpsi.root")         
(class TFile*)0x9588400
root [2] .ls                       
TFile**		na60pyJpsi.root	
 TFile*		na60pyJpsi.root	
  KEY: TTree	NA60Tree;1	NA60 Run Tree
root [3] tree = (TTree*) fl->Get("NA60Tree")
(class TTree*)0x962bfa8
root [4] tree->Print()
******************************************************************************
*Tree    :NA60Tree  : NA60 Run Tree                                          *
*Entries :        1 : Total =            3877 bytes  File  Size =       3877 *
*        :          : Tree compression factor =   1.00                       *
******************************************************************************
*Br    0 :VXTL      :                                                        *
*Entries :        1 : Total  Size=          0 bytes  File Size  =          0 *
*Baskets :        0 : Basket Size=      32000 bytes  Compression=   1.00     *
   ... deleted
..
root [5] tree->GetEntry(0)
Warning in <TExMap::Remove>: key 23 not found at 23
Warning in <TBuffer::CheckObject>: reference to object of unavailable
class TObject, pointer will be 0
Error in <TBuffer::CheckByteCount>: object of class TCollection read too
many bytes
Warning in <TBuffer::CheckByteCount>: TCollection::Streamer() not in sync
with data on file, fix Streamer()

 *** Break *** segmentation violation
Root > 



On Fri, 8 Mar 2002, Rene Brun wrote:

> Ruben,
> 
> I do not understand with which version you produced bad.out and good.out.
> I see that the main difference is that:
>   -good.out has a TBranchObject (old branch style)
>   -bad.out has a TBranchElement (new branch style)
> 
> If you are running on both systems with exactly the same version, this should
> not happen. It looks like you have a mismatch with your LD_LIBRARY_PATH.
> Are you calling somewhere
>   TTree::SetBranchStyle(mode); with mode = 0 or 1 ?
> 
> The default branch style was changed from 0 (old TBranchObject) to 1(new)
> between 3.01/06 and 3.02
> 
> Rene Brun
> 
> 
> Ruben Shahoian wrote:
> > 
> > Hello,
> > We are running the same program on the same root version (3.01.06)
> > but on different machines, and on one of them
> > (gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)) everything works
> > fine while on the other (Red Hat Linux release 6.2 (Zoot),
> > gcc version egcs-2.91.66 19990314/Linux(egcs-1.1.2 release))
> > we get a segmentation violation when trying to read the branch of the
> > tree from the file (created by the same program on the same machine).
> > The crush is preceded by the error message during reading of previous
> > branch (each branch is a TObjArray of TClonesArray's, written in
> > non-splitted mode).
> > 
> > The error is :
> > 
> > branch1->GetEntry(0);  //Read Branch for one detector
> > Warning in <TExMap::Remove>: key 23 not found at 23
> > Warning in <TBuffer::CheckObject>: reference to object of unavailable
> > class TObject, pointer will be 0
> > Error in <TBuffer::CheckByteCount>: object of class TCollection read too
> > many bytes
> > Warning in <TBuffer::CheckByteCount>: TCollection::Streamer() not in sync
> > with data on file, fix Streamer()
> > 
> > branch2->GetEntry(0);  //Read Branch for other detector
> > 
> >  *** Break *** segmentation violation
> > 
> > The problem is created at tree writing stage, since although the data in
> > the trees are the same in both cases, the trees are different:
> > when I do TFile::ShowStreamerInfo() for the files containing the trees,
> > the 'bad' file shows all StreamerInfo's present in the 'good' file PLUS
> > StreamerInfo's for TBranchElement and TLeafElement (absent in the
> > "good" file's ShowStreamerInfo output. I don't use TTree::Bronch method)
> > 
> > Does anybody know what can be the reason.
> > I attach the outputs of ShowStreamerInfo() for both files.
> > 
> > Regards,
> >         Ruben Shahoian
> > 
> > PS On both machines the program runs fine with root_3.02.07, but for
> > different reasons we would like to have backward compatibility at least
> > with 3.01.06
> > 
> > 
> > 
> >   --------------------------------------------------------------------------------
> > 
> >                              Name: StreamerInfo.tar.gz
> >    StreamerInfo.tar.gz       Type: Unix Tape Archive (application/x-tar)
> >                          Encoding: BASE64
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:45 MET