GetEntry segmentation violation

Hello,

I am getting a segmentation fault when I try to get an entry number NN from a tree created with the use of MakeClass.

It’s, probably, worth noting, that this is the second time I go through this tree in this program. First, I go over all the entries (w/out a trace of any segfaults), and then I go over it for the second time, only looking at events filtered by the first pass.

After I used advice from an older posting and did SetBranchStatus("*",0) followed by setting status 1 to some of the branches, and combined it with deleting the instance of the class (fcreated by MakeClass) used for the first iteration and using a new instance, it “improved” to crashing about 1000 entries later, entry MM.

Any ideas/comments/help would be greatly appreciated.

Slava

SOLVED

Hi,

could you go into a bit more detail into how you solved this problem? I think I am having the same issue, if not certainly one very similar.

The code I am using has definitely worked in the past, but since I have upgraded to a more recent version of root, I receive a segmentation fault when using the GetEntry(int); command to return an entry from my tree.
The error message is posted below for completeness.

I have also seen some advice using
SetBranchStatus("*",0);
this does remove the segmentation fault, but also the information in the branch.
Am I disabling it ?

Sorry for the silly questions, but I have not looked at setting a branch status before. Only an address.

Thanks in advance

Dave

===========================================================
There was a crash (#7 0x006c2eed in SigHandler(ESignals) () from /home/david/Programs/GATE/root/lib/libCore.so).
This is the entire stack trace of all threads:

#0 0x002e4422 in __kernel_vsyscall ()
#1 0x03a9c663 in waitpid () from /lib/tls/i686/cmov/libc.so.6
#2 0x03a3ed03 in ?? () from /lib/tls/i686/cmov/libc.so.6
#3 0x00242fad in system () from /lib/tls/i686/cmov/libpthread.so.0
#4 0x006bb4cd in TUnixSystem::Exec(char const*) () from /home/david/Programs/GATE/root/lib/libCore.so
#5 0x006c1add in TUnixSystem::StackTrace() () from /home/david/Programs/GATE/root/lib/libCore.so
#6 0x006c2de5 in TUnixSystem::DispatchSignals(ESignals) () from /home/david/Programs/GATE/root/lib/libCore.so
#7 0x006c2eed in SigHandler(ESignals) () from /home/david/Programs/GATE/root/lib/libCore.so
#8 0x006b8832 in sighandler(int) () from /home/david/Programs/GATE/root/lib/libCore.so
#9
#10 0x0426db24 in TBufferFile::ReadFloat(float&) () from /home/david/Programs/GATE/root/lib/libRIO.so
#11 0x04321e07 in int TStreamerInfo::ReadBuffer<char**>(TBuffer&, char** const&, int, int, int, int) () from /home/david/Programs/GATE/root/lib/libRIO.so
#12 0x014f762d in TBranchElement::ReadLeaves(TBuffer&) () from /home/david/Programs/GATE/root/lib/libTree.so
#13 0x014ec4f2 in TBranch::GetEntry(long long, int) () from /home/david/Programs/GATE/root/lib/libTree.so
#14 0x014f2fc2 in TBranchElement::GetEntry(long long, int) () from /home/david/Programs/GATE/root/lib/libTree.so
#15 0x014f2f55 in TBranchElement::GetEntry(long long, int) () from /home/david/Programs/GATE/root/lib/libTree.so
#16 0x0153d0a4 in TTree::GetEntry(long long, int) () from /home/david/Programs/GATE/root/lib/libTree.so
#17 0x0156bc22 in G__G__Tree_109_0_69(G__value*, char const*, G__param*, int) () from /home/david/Programs/GATE/root/lib/libTree.so
#18 0x00ee6937 in Cint::G__ExceptionWrapper(int ()(G__value, char const*, G__param*, int), G__value*, char*, G__param*, int) ()
from /home/david/Programs/GATE/root/lib/libCint.so
#19 0x00f91daf in G__execute_call () from /home/david/Programs/GATE/root/lib/libCint.so
#20 0x00f937b2 in G__call_cppfunc () from /home/david/Programs/GATE/root/lib/libCint.so
#21 0x00f6c964 in G__interpret_func () from /home/david/Programs/GATE/root/lib/libCint.so
#22 0x00f5d0d4 in G__getfunction () from /home/david/Programs/GATE/root/lib/libCint.so
#23 0x0105126d in G__getstructmem () from /home/david/Programs/GATE/root/lib/libCint.so
#24 0x0104525d in G__getvariable () from /home/david/Programs/GATE/root/lib/libCint.so
#25 0x00f35be8 in G__getitem () from /home/david/Programs/GATE/root/lib/libCint.so
#26 0x00f3bcf5 in G__getexpr () from /home/david/Programs/GATE/root/lib/libCint.so
#27 0x00fbf74c in G__exec_statement () from /home/david/Programs/GATE/root/lib/libCint.so
#28 0x00f217f4 in G__exec_tempfile_core () from /home/david/Programs/GATE/root/lib/libCint.so
#29 0x00f21af9 in G__exec_tempfile_fp () from /home/david/Programs/GATE/root/lib/libCint.so
#30 0x00fcbd84 in G__process_cmd () from /home/david/Programs/GATE/root/lib/libCint.so
#31 0x006ad76b in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /home/david/Programs/GATE/root/lib/libCore.so
#32 0x005cb95c in TApplication::ProcessLine(char const*, bool, int*) () from /home/david/Programs/GATE/root/lib/libCore.so
#33 0x0011e939 in TRint::HandleTermInput() () from /home/david/Programs/GATE/root/lib/libRint.so
#34 0x0011cad5 in TTermInputHandler::Notify() () from /home/david/Programs/GATE/root/lib/libRint.so
#35 0x0011f4b4 in TTermInputHandler::ReadNotify() () from /home/david/Programs/GATE/root/lib/libRint.so
#36 0x006bf5a7 in TUnixSystem::CheckDescriptors() () from /home/david/Programs/GATE/root/lib/libCore.so
#37 0x006bfbb5 in TUnixSystem::DispatchOneEvent(bool) () from /home/david/Programs/GATE/root/lib/libCore.so
#38 0x0062f091 in TSystem::InnerLoop() () from /home/david/Programs/GATE/root/lib/libCore.so
#39 0x00631e89 in TSystem::Run() () from /home/david/Programs/GATE/root/lib/libCore.so
#40 0x005c99b7 in TApplication::Run(bool) () from /home/david/Programs/GATE/root/lib/libCore.so
#41 0x0011ed41 in TRint::Run(bool) () from /home/david/Programs/GATE/root/lib/libRint.so
#42 0x08048ecf in main ()

The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.

#10 0x0426db24 in TBufferFile::ReadFloat(float&) () from /home/david/Programs/GATE/root/lib/libRIO.so
#11 0x04321e07 in int TStreamerInfo::ReadBuffer<char**>(TBuffer&, char** const&, int, int, int, int) () from /home/david/Programs/GATE/root/lib/libRIO.so
#12 0x014f762d in TBranchElement::ReadLeaves(TBuffer&) () from /home/david/Programs/GATE/root/lib/libTree.so
#13 0x014ec4f2 in TBranch::GetEntry(long long, int) () from /home/david/Programs/GATE/root/lib/libTree.so
#14 0x014f2fc2 in TBranchElement::GetEntry(long long, int) () from /home/david/Programs/GATE/root/lib/libTree.so
#15 0x014f2f55 in TBranchElement::GetEntry(long long, int) () from /home/david/Programs/GATE/root/lib/libTree.so
#16 0x0153d0a4 in TTree::GetEntry(long long, int) () from /home/david/Programs/GATE/root/lib/libTree.so

[quote]Am I disabling it ? [/quote]Yes.

[quote] I receive a segmentation fault when using the GetEntry(int); command to return an entry from my tree. [/quote]Usually this indicates that the branch address is set incorrectly (or the memory buffer being passed is too small). Can you try using valgrind (via valgrind root.exe) to pin point where the problem is?

Cheers,
Philippe.

Unfortunately, I do not remember it for sure any more, but if you are satisfied with 80% confidence, I think this is the case when I used valgrind and found memory being overwritten at some point, which caught up with me later when I was "GetEntry"ing

Slava