ROOT fails recovering a file


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hi. I think I have accidentally made ROOT crash. I downloaded a .root file with some TH2, but when I tried to open it with a macro to get a histogram I found a strange error.

Warning in <TFile::Init>: file 737.root probably not closed, trying to recover
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod0Sid0 at address 224
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod0Sid1 at address 1683
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod1Sid0 at address 3142
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod1Sid1 at address 37397
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod2Sid0 at address 71936
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod2Sid1 at address 99589
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod3Sid0 at address 126873
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod3Sid1 at address 154765
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod4Sid0 at address 182884
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod4Sid1 at address 184343
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod5Sid0 at address 185802
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod5Sid1 at address 222180
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod6Sid0 at address 258469
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod6Sid1 at address 295695
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod7Sid0 at address 333363
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod7Sid1 at address 362991
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod8Sid0 at address 364450
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod8Sid1 at address 403499
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod9Sid0 at address 441046
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod9Sid1 at address 442504
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod10Sid0 at address 443962
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod10Sid1 at address 482724
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod11Sid0 at address 521014
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv10Mod11Sid1 at address 560383
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod0Sid0 at address 599555
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod0Sid1 at address 601014
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod1Sid0 at address 602473
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod1Sid1 at address 636700
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod2Sid0 at address 671115
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod2Sid1 at address 698723
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod3Sid0 at address 726131
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod3Sid1 at address 753756
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod4Sid0 at address 781539
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod4Sid1 at address 782998
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod5Sid0 at address 784457
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod5Sid1 at address 820950
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod6Sid0 at address 857125
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod6Sid1 at address 894366
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod7Sid0 at address 931803
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod7Sid1 at address 961942
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod8Sid0 at address 963401
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod8Sid1 at address 1002159
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod9Sid0 at address 1039335
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod9Sid1 at address 1040793
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod10Sid0 at address 1042252
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod10Sid1 at address 1080939
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod11Sid0 at address 1119180
Info in <TFile::Recover>: 737.root, recovered key TH2F:hEv11Mod11Sid1 at address 1158122
Warning in <TFile::Init>: successfully recovered 48 keys
Warning in <TFile::Init>: no StreamerInfo found in 737.root therefore preventing schema evolution when reading this file.
 Generating stack trace...
 0x00007f55767f872f in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) + 0x26f from /home/Elisa/root/lib/libCling.so
 0x00007f55767fa18d in cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) + 0x18d from /home/Elisa/root/lib/libCling.so
 0x00007f55767fa440 in cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*, cling::Transaction**) + 0x160 from /home/Elisa/root/lib/libCling.so
 0x00007f55768832ee in cling::MetaProcessor::process(char const*, cling::Interpreter::CompilationResult&, cling::Value*) + 0x22e from /home/Elisa/root/lib/libCling.so
 0x00007f557678a486 in <unknown> from /home/Elisa/root/lib/libCling.so
 0x00007f557679b46a in TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) + 0xd8a from /home/Elisa/root/lib/libCling.so
 0x00007f557a9a7386 in TApplication::ProcessLine(char const*, bool, int*) + 0x486 from /home/Elisa/root/lib/libCore.so
 0x00007f557adeb5ee in TRint::ProcessLineNr(char const*, char const*, int*) + 0x9e from /home/Elisa/root/lib/libRint.so
 0x00007f557adeb975 in TRint::HandleTermInput() + 0x215 from /home/Elisa/root/lib/libRint.so
 0x00007f557aa75a8c in TUnixSystem::CheckDescriptors() + 0x17c from /home/Elisa/root/lib/libCore.so
 0x00007f557aa76eca in TUnixSystem::DispatchOneEvent(bool) + 0xea from /home/Elisa/root/lib/libCore.so
 0x00007f557a97d194 in TSystem::InnerLoop() + 0x44 from /home/Elisa/root/lib/libCore.so
 0x00007f557a97bccf in TSystem::Run() + 0x6f from /home/Elisa/root/lib/libCore.so
 0x00007f557a9a48df in TApplication::Run(bool) + 0x1f from /home/Elisa/root/lib/libCore.so
 0x00007f557aded057 in TRint::Run(bool) + 0x527 from /home/Elisa/root/lib/libRint.so
 0x00000000004010dc in main + 0x4c from /home/Elisa/root/bin/root.exe
 0x00007f5579e40840 in __libc_start_main + 0xf0 from /lib/x86_64-linux-gnu/libc.so.6
 0x0000000000401139 in _start + 0x29 from /home/Elisa/root/bin/root.exe
Error in <HandleInterpreterException>: Trying to dereference null pointer or trying to call routine taking non-null arguments.
Execution of your code was aborted.
In file included from input_line_8:1:
/mnt/c/Users/Asus pc/Desktop/SDD/cluster.cpp:23:2: warning: null passed to a callee that
      requires a non-null argument [-Wnonnull]
        h->Draw ();

	TFile *file = new TFile("737.root");
	//isto misure TH2 h
	TH2D *h =(TH2D*)file->Get("hEv10Mod10Sid0"); 

	h->Draw (); 
		file->Close();  

I don’t know why ROOT must get stuck on a file recovery because the file is “new”. I even tried downloading it again. I tried opening it with a write option, too (I read this in the forum). In TBrowser there aren’t open files within root.
Maybe is there a way to “fix” the file?
Thanks a lot

Root 6.08/04 on WLS (Linux 16.06.7on Windows 10, gcc 5.4.0)

From that output, it doesn’t look like ROOT “got stuck recovering the file”. It may not have been able to recover everything, but the error is only at the end "Trying to dereference null pointer or trying to call routine taking non-null arguments." at the line h->Draw(). Apparently, hEv10Mod10Sid0 may have been recovered, but you are trying to get " hEv10Mod10Sid0 " with many extra spaces; are you sure that’s the actual name? In any case, I think it’s better to create again and properly save the ROOT file, instead of trying to fix it.

The TH2 name in the macro is without spaces, I did not notice it was copied in the forum with all these spaces, sorry. Same error (without the last lines obviously) if I write in my macro only

TFile *file = new TFile("737.root");
   	file->Close();  

The file was in a .zip. Maybe file compression/extraction can cause this? I have not the raw data which where used to fill the histograms so I can’t create again the TH2, I only can try to download it differently
Thanks

Hi @EVTO ,
as per the error message, that ROOT file has not being closed correctly, i.e. it’s corrupted.

Cheers,
Enrico

Hi @eguiraud . Thanks. Happily another PC managed to open it. But if I will find again this error at least now I know what it means and I won’t try again installing 4 ROOT versions to open a file when the file can’t be opened.
Have a nice day.

1 Like