I am facing a problem which I never experienced and I don’t even understand the log.
As an example, I am trying to run a simple macro which just get some values from a TTree and print them
But when I execute the code with .x, I get a segmentation fault (after the execution of the code), and a message which i cannot understand.
I share both the log and the code, because I have no hint on what could be the problem.
Any help is really appreciated.
Here is the (brief) code:
{
TRandom r(4321);
class Track{
public:
float posX,posY;
float dirX,dirY;
};
//crea il file di output. Gli alberi sono anch'essi dentro file '.root'
TFile *outFile = TFile::Open("AlberoProva.root", "RECREATE");
//crea il Tree
TTree barbalbero("t","albero");
//crea il buffer, codice da cui vengono i presi i dati da mettere nel tree, che sono la traccia della particella e l'dentità
Track lamiatraccia;
int IDparticella;
// creo i rami dell'albero, uno per ogni buffer col metodo '.Branch'
barbalbero.Branch("traccia", &lamiatraccia);
barbalbero.Branch("pid",&IDparticella);
//loop sugli eventi per pienare l'alberello: con questo loop metto i dati dentro ai buffers:
for (int iEv=0; iEv<50; iEv++){
lamiatraccia.posX=iEv;
lamiatraccia.posY=lamiatraccia.posX+1;
lamiatraccia.dirX=iEv+2;
lamiatraccia.posY=2*iEv;
IDparticella=iEv%2;
//pieno l'albero ad ogni evento con:
barbalbero.Fill();
}
//infine salvo il tree sul file col metodo write e chiudo il file di output
barbalbero.Write();
outFile->Close();
}
And here I share the log:
1004
2538
1696
1186
920
1409
1265
922
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00007f371c9dddba in __GI___wait4 (pid=17958, stat_loc=stat_loc
entry=0x7ffe8ac68028, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:27
#1 0x00007f371c9ddd7b in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7ffe8ac68028, options=options
entry=0) at waitpid.c:38
#2 0x00007f371c94d0e7 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:172
#3 0x00007f371d05287e in TUnixSystem::Exec (shellcmd=<optimized out>, this=0x5610daf90800) at /opt/applications/Root/root-6.14.04/core/unix/src/TUnixSystem.cxx:2119
#4 TUnixSystem::StackTrace (this=0x5610daf90800) at /opt/applications/Root/root-6.14.04/core/unix/src/TUnixSystem.cxx:2413
#5 0x00007f371d04f55c in TUnixSystem::DispatchSignals (this=0x5610daf90800, sig=kSigSegmentationViolation) at /opt/applications/Root/root-6.14.04/core/unix/src/TUnixSystem.cxx:3644
#6 <signal handler called>
#7 0xfffffc19fffffc19 in ?? ()
.
.
.
#356 0x0000000000000000 in ?? ()
===========================================================
The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum http://root.cern.ch/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at http://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.
===========================================================
#7 0xfffffc19fffffc19 in ?? ()
#8 0xfffffc19fffffc19 in ?? ()
#9 0x0000000400000005 in ?? ()
.
.
.
#356 0x0000000000000000 in ?? ()
===========================================================
Root >
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00007f371c9dddba in __GI___wait4 (pid=19070, stat_loc=stat_loc
entry=0x7ffe8ac68a68, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:27
#1 0x00007f371c9ddd7b in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7ffe8ac68a68, options=options
entry=0) at waitpid.c:38
#2 0x00007f371c94d0e7 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:172
#3 0x00007f371d05287e in TUnixSystem::Exec (shellcmd=<optimized out>, this=0x5610daf90800) at /opt/applications/Root/root-6.14.04/core/unix/src/TUnixSystem.cxx:2119
#4 TUnixSystem::StackTrace (this=0x5610daf90800) at /opt/applications/Root/root-6.14.04/core/unix/src/TUnixSystem.cxx:2413
#5 0x00007f371d04f55c in TUnixSystem::DispatchSignals (this=0x5610daf90800, sig=kSigSegmentationViolation) at /opt/applications/Root/root-6.14.04/core/unix/src/TUnixSystem.cxx:3644
#6 <signal handler called>
#7 0x00007f371d1bd4c6 in TRint::HandleTermInput (this=0xfffffc19fffffc19) at /opt/applications/Root/root-6.14.04/core/rint/src/TRint.cxx:605
#8 0xfffffc19fffffc19 in ?? ()
#9 0xfffffc19fffffc19 in ?? ()
#10 0xfffffc19fffffc19 in ?? ()
#11 0xfffffc19fffffc19 in ?? ()
#12 0xfffffc19fffffc19 in ?? ()
#13 0xfffffc19fffffc19 in ?? ()
#14 0xfffffc19fffffc19 in ?? ()
#15 0xfffffc19fffffc19 in ?? ()
#16 0xfffffc19fffffc19 in ?? ()
#17 0x00000000fffffc19 in ?? ()
#18 0x0000000000000001 in ?? ()
#19 0x0000000000000000 in ?? ()
===========================================================
Thanks in Advance for any help
Lorenzo
_ROOT Version: I tried to execute the code with both ROOT 6.14 and with ROOT 6.22, both built by source code
_Platform: Ubuntu 20.04
_Compiler: g++ 9.3.0