Root file crashes on TFile Open

Hi I am using Root version 5.26 and I opened a root file (probably corrupted/ not closed) with the command:
TFile::Open(“myfile.root”,“update”)
The program crashes at this point. The stack trace is given below. It would be nice if a NULL pointer is returned instead of this crash. Could you please suggest some alternative. I cannot send the file as it is huge file.
Thanks,
Samcy

===========================================================
There was a crash (kSigSegmentationViolation).
This is the entire stack trace of all threads:

#0 0x00953422 in __kernel_vsyscall ()
#1 0x048e77d3 in waitpid () from /lib/tls/i686/cmov/libc.so.6
#2 0x04888de3 in ?? () from /lib/tls/i686/cmov/libc.so.6
#3 0x0091b27d in system () from /lib/tls/i686/cmov/libpthread.so.0
#4 0x00bc0821 in TUnixSystem::Exec (this=0x9e0d2d8,
shellcmd=0xa12b388 “/home/samuel/QtRoot/root/etc/gdb-backtrace.sh 5503 1>&2”) at core/unix/src/TUnixSystem.cxx:1978
#5 0x00bc1112 in TUnixSystem::StackTrace (this=0x9e0d2d8) at core/unix/src/TUnixSystem.cxx:2188
#6 0x00bbeb11 in TUnixSystem::DispatchSignals (this=0x9e0d2d8, sig=kSigSegmentationViolation)
at core/unix/src/TUnixSystem.cxx:1106
#7 0x00bbcaa5 in SigHandler (sig=kSigSegmentationViolation) at core/unix/src/TUnixSystem.cxx:350
#8 0x00bc4335 in sighandler (sig=11) at core/unix/src/TUnixSystem.cxx:3428
#9
#10 0x048c3785 in ?? () from /lib/tls/i686/cmov/libc.so.6
#11 0x00b089cc in Hash (str=0x1 <Address 0x1 out of bounds>) at core/base/src/TString.cxx:195
#12 0x00b58587 in THashTable::GetHashValue (this=0xa155a10, str=0x1 <Address 0x1 out of bounds>) at include/THashTable.h:51
#13 0x00b573c6 in THashTable::FindObject (this=0xa155a10, name=0x1 <Address 0x1 out of bounds>)
at core/cont/src/THashTable.cxx:194
#14 0x00b565fd in THashList::FindObject (this=0xa155338, name=0x1 <Address 0x1 out of bounds>)
at core/cont/src/THashList.cxx:222
#15 0x0584d538 in TDirectoryFile::FindObjectAnyFile (this=0xa12af50, name=0x1 <Address 0x1 out of bounds>)
at io/io/src/TDirectoryFile.cxx:389
#16 0x05861dfb in TFile::GetStreamerInfoList (this=0xa12bdf8) at io/io/src/TFile.cxx:1123
#17 0x05867599 in TFile::ReadStreamerInfo (this=0xa12bdf8) at io/io/src/TFile.cxx:2463
#18 0x05860c02 in TFile::Init (this=0xa12bdf8, create=false) at io/io/src/TFile.cxx:734
#19 0x0585e856 in TFile (this=0xa12bdf8, fname1=0xa12bfe0 “/home/samuel/error_file_use_for_debugging.fit”,
option=0x59cf560 “”, ftitle=0x59cf560 “”, compress=1) at io/io/src/TFile.cxx:441
#20 0x05869930 in TFile::Open (url=0xa1054e4 “/home/samuel/error_file_use_for_debugging.fit”, option=0x59cf560 “”,
ftitle=0x59cf560 “”, compress=1, netopt=0) at io/io/src/TFile.cxx:2959
#21 0x0597bf93 in G__G__IO_107_0_104(G__value*, char const*, G__param*, int) () from /home/samuel/QtRoot/root/lib/libRIO.so
#22 0x002fae89 in Cint::G__ExceptionWrapper (funcp=0x597b956 <G__G__IO_107_0_104(G__value*, char const*, G__param*, int)>,
result7=0xbfeee020, funcname=0xa121220 “”, libp=0xbfee39dc, hash=0) at cint/cint/src/Api.cxx:393
#23 0x003c2ccb in G__execute_call (result7=0xbfeee020, libp=0xbfee39dc, ifunc=0xa121220, ifn=0)
at cint/cint/src/newlink.cxx:2332
#24 0x003c3493 in G__call_cppfunc (result7=0xbfeee020, libp=0xbfee39dc, ifunc=0xa121220, ifn=0)
at cint/cint/src/newlink.cxx:2518
#25 0x0039f140 in G__interpret_func (result7=0xbfeee020, funcname=0xa1407c0 “Open”, libp=0xbfee39dc, hash=402,
p_ifunc=0xa121220, funcmatch=1, memfunc_flag=6) at cint/cint/src/ifunc.cxx:5243
#26 0x0037bd1a in G__getfunction (item=0xa13fba0 “TFile::Open(”/home/samuel/error_file_use_for_debugging.fit")",
known3=0xbfeee208, memfunc_flag=6) at cint/cint/src/func.cxx:2423
#27 0x0036bf57 in G__getitem (item=0xa13fba0 “TFile::Open(”/home/samuel/error_file_use_for_debugging.fit")")
at cint/cint/src/expr.cxx:1894
#28 0x00369914 in G__getexpr (expression=0xa0cfdd0 “TFile::Open(”/home/samuel/error_file_use_for_debugging.fit")")
at cint/cint/src/expr.cxx:1464
#29 0x0034a777 in G__define_var (tagnum=181, typenum=-1) at cint/cint/src/decl.cxx:2590
#30 0x003f927b in G__defined_type (type_name=…, len=5) at cint/cint/src/parse.cxx:4488
#31 0x003ff3a8 in G__exec_statement (mparen=0xbfef0cb4) at cint/cint/src/parse.cxx:6481
#32 0x003a21d4 in G__interpret_func (result7=0xbfefb8d0, funcname=0xa12cc90 “rootCheck”, libp=0xbfef128c, hash=930,
p_ifunc=0xa124f68, funcmatch=1, memfunc_flag=0) at cint/cint/src/ifunc.cxx:6082
#33 0x0037c95c in G__getfunction (item=0xa124080 “rootCheck()”, known3=0xbfefbab8, memfunc_flag=0)
at cint/cint/src/func.cxx:2639
#34 0x0036bf57 in G__getitem (item=0xa124080 “rootCheck()”) at cint/cint/src/expr.cxx:1894
#35 0x00369914 in G__getexpr (expression=0xa12b898 “rootCheck()”) at cint/cint/src/expr.cxx:1464
#36 0x003581a5 in G__calc_internal (exprwithspace=0x9e38730 “rootCheck()”) at cint/cint/src/expr.cxx:1066
#37 0x0040b943 in G__process_cmd (line=0x9ed5188 “.X /home/samuel/./rootCheck.C”, prompt=0x9e110a4 “”, more=0x9e1109c,
err=0xbfefeb84, rslt=0xbfefeb40) at cint/cint/src/pause.cxx:2301
#38 0x00ba7405 in TCint::ProcessLine (this=0x9e11080, line=0x9ed5188 “.X /home/samuel/./rootCheck.C”, error=0x0)
at core/meta/src/TCint.cxx:424
#39 0x00ba7968 in TCint::ProcessLineSynch (this=0x9e11080, line=0x9ed5188 “.X /home/samuel/./rootCheck.C”, error=0x0)
at core/meta/src/TCint.cxx:503
#40 0x00aaeeb5 in TApplication::ExecuteFile (file=0xa128383 “rootCheck.C”, error=0x0, keep=false)
at core/base/src/TApplication.cxx:977
#41 0x00aae5ac in TApplication::ProcessFile (this=0x9ec9ba8, file=0xa128383 “rootCheck.C”, error=0x0, keep=false)
at core/base/src/TApplication.cxx:853
#42 0x00aae4e4 in TApplication::ProcessLine (this=0x9ec9ba8, line=0xa128380 “.x rootCheck.C”, sync=false, err=0x0)
at core/base/src/TApplication.cxx:826
#43 0x0011fdbb in TRint::HandleTermInput (this=0x9ec9ba8) at core/rint/src/TRint.cxx:566
#44 0x0011d658 in TTermInputHandler::Notify (this=0xa0f19a0) at core/rint/src/TRint.cxx:128
#45 0x00120fe0 in TTermInputHandler::ReadNotify (this=0xa0f19a0) at core/rint/src/TRint.cxx:120
#46 0x00bbee4c in TUnixSystem::CheckDescriptors (this=0x9e0d2d8) at core/unix/src/TUnixSystem.cxx:1208
#47 0x00bbe235 in TUnixSystem::DispatchOneEvent (this=0x9e0d2d8, pendingOnly=false) at core/unix/src/TUnixSystem.cxx:915
#48 0x00b1dec5 in TSystem::InnerLoop (this=0x9e0d2d8) at core/base/src/TSystem.cxx:393
#49 0x00b1dca5 in TSystem::Run (this=0x9e0d2d8) at core/base/src/TSystem.cxx:343
#50 0x00aaf03c in TApplication::Run (this=0x9ec9ba8, retrn=false) at core/base/src/TApplication.cxx:993
#51 0x0011f612 in TRint::Run (this=0x9ec9ba8, retrn=false) at core/rint/src/TRint.cxx:438
#52 0x08048ef5 in main (argc=1, argv=0xbff01ad4) at main/src/rmain.cxx:29

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 0x048c3785 in ?? () from /lib/tls/i686/cmov/libc.so.6
#11 0x00b089cc in Hash (str=0x1 <Address 0x1 out of bounds>) at core/base/src/TString.cxx:195
#12 0x00b58587 in THashTable::GetHashValue (this=0xa155a10, str=0x1 <Address 0x1 out of bounds>) at include/THashTable.h:51
#13 0x00b573c6 in THashTable::FindObject (this=0xa155a10, name=0x1 <Address 0x1 out of bounds>)
at core/cont/src/THashTable.cxx:194
#14 0x00b565fd in THashList::FindObject (this=0xa155338, name=0x1 <Address 0x1 out of bounds>)
at core/cont/src/THashList.cxx:222
#15 0x0584d538 in TDirectoryFile::FindObjectAnyFile (this=0xa12af50, name=0x1 <Address 0x1 out of bounds>)
at io/io/src/TDirectoryFile.cxx:389
#16 0x05861dfb in TFile::GetStreamerInfoList (this=0xa12bdf8) at io/io/src/TFile.cxx:1123
#17 0x05867599 in TFile::ReadStreamerInfo (this=0xa12bdf8) at io/io/src/TFile.cxx:2463
#18 0x05860c02 in TFile::Init (this=0xa12bdf8, create=false) at io/io/src/TFile.cxx:734
#19 0x0585e856 in TFile (this=0xa12bdf8, fname1=0xa12bfe0 “/home/samuel/error_file_use_for_debugging.fit”,
option=0x59cf560 “”, ftitle=0x59cf560 “”, compress=1) at io/io/src/TFile.cxx:441
#20 0x05869930 in TFile::Open (url=0xa1054e4 “/home/samuel/error_file_use_for_debugging.fit”, option=0x59cf560 “”,
ftitle=0x59cf560 “”, compress=1, netopt=0) at io/io/src/TFile.cxx:2959

It looks like you have open your file in Update mode more than once and possibly overwritten some essential bloacks. TFile::Open returns null when a problem is encountered. See TFile::Recover for more details.
To tell you more we need a copy of your file somewhere in a public area.

Rene

I have uploaded the file here:
hecr.tifr.res.in/~ino/c217_daq/error.root
and just calling TFile::Open itself crashes and therefore I cannot proceed further and call Recover.
Thanks,
Samcy

See the result of a ROOT session on your file:

[quote]root [0] TFile::Open(“error.root”)
Error in TFile::Init: file error.root is truncated at 106529353 bytes: should be 148000340, trying to recover
Warning in TFile::Init: no keys recovered, file has been made a Zombie
(class TFile*)0x0
[/quote]

Your file has been truncated by some mechanism and in particular teh tree header is missing in your file. As a result, the recovery procedure has no way to assign the baskets buffers on the file to a Tree. for more details read the doc of TTree::AutoSave and TFile::Recover.

Rene