ttree->GetEntry() unhandled exception


_ROOT Version:5.34/38
_Platform:windows 11
_Compiler:VC++ 2022


Dear Rooters,
I am trying to make some older code more robust and less prone to crashing.

The code in question simply opens a file that contains a root tree and loops over its contents with GetEntry().

Occasionally the file we are reading from has a corrupt record.

One possible error I am getting is the following (I don’t know if in other corrupt files the error changes):

Error in <TBasket::Streamer>: The value of fObjlen is incorrect (-147523757) ; trying to recover by setting it to zero
Error in <TBasket::Streamer>: The value of fNbytes is incorrect (-1805846732) ; trying to recover by setting it to zero

After that the program crashes at GetEntry with a “bad alloc”.

NB the program works fine when there is no corruption. Also in that same corrupt file if I manually stop the GetEntry loop short, there is no crashing.

So what I wanted to do is somehow check for a corrupt record and handle it before it crashes.

Also note that I do check GetEntry() and have specified to do something if it returns <=0. But this doesn’t help at all as it crashes within GetEnetry so it never gets to the point of checking.

Any advice?
Thanks
Dimitris

Hi Dimitris,

did you try a recent version? For example ROOT 6.32.02?
We will not fix 5.34.

Best,
Danilo

ok I was suspecting that this might be the problem. I keep going in a loop around using root 6 because I don’t have time to deal with the issue of it not working straight out of the box when using visual studio. I tried compiling root 6 from source and almost got there but it did throw some problems and run out of time fixing them. I tried using cmake as was suggested but that seems to completely change the interface so I run out of time switching to that too.

What’s the problem you see? I downloaded the precompiled binary in Windows and it worked out of the box. No need to build from source. I just had to enable the checkbox “Desktop environment with C++” when installing Visual Studio. Then, I just call thisroot.ps1 from the Visual Studio terminal.

there may be some kind of mistery around this whole issue. Whenever I try to do this with root 6 it doesn’t work. Remember that I have been doing this with root 5 all the time so I must be missing something. It would be helpful if you told me the following:

Root version and exact subversion of the binary
Your version of visual studio
Exact compiler properties.
You would do me a big favour if you could send me a hello world vs c++ project with all properties correct.
Regards
Dimitris

One question first. Does opening ROOT6 work on Windows ? (Without any project). Just the ROOT interpreter.

I tried with https://root.cern/download/root_v6.32.02.win64.vc17.exe and VisualStudioInstaller 2022 (Visual Studio Code is version 17), and it works after selecting “Desktop development C++” checkbox. Then, call thisroot.ps1 and root.exe

Post here if there is any error message printed.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.