Problem using TTimer

I have a problem while using TTimer to get a method executed after a given amount of time. To illustrate it I attached an archive file with a slightly modified version of the example from

ftp://root.cern.ch/root/doc/ROOTUsersGu … 25s04.html

The example should compile with a simple make command. Here I just added a TTimer which is enabled at the end of the DoDraw() method so that the method is called again after 10 seconds.

The whole system appears to work, but every time the method is called I get a segmentation violation and, in spite of this, the system keeps going. Please note that the Draw button works fine both with and without the TTimer. This is the segmentation violation dump:

*** Break *** segmentation violation

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

#0 0x00007ff03d4af65e in waitpid () from /lib64/libc.so.6
#1 0x00007ff03d441609 in do_system () from /lib64/libc.so.6
#2 0x00007ff041149f5a in TUnixSystem::StackTrace() () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#3 0x00007ff04114bf2c in TUnixSystem::DispatchSignals(ESignals) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#4
#5 0x00007ff04108b090 in TQConnection::ExecuteMethod() () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#6 0x00007ff04106e94a in TQObject::Emit(char const*) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#7 0x00007ff04107211c in TTimer::Notify() () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#8 0x00007ff041072071 in TTimer::CheckTimer(TTime const&) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#9 0x00007ff04114be69 in TUnixSystem::DispatchTimers(bool) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#10 0x00007ff04114c8e4 in TUnixSystem::DispatchOneEvent(bool) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#11 0x00007ff0410aa724 in TSystem::InnerLoop() () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#12 0x00007ff0410a8c91 in TSystem::Run() () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#13 0x00007ff04105dd0f in TApplication::Run(bool) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#14 0x0000000000408768 in main () at TestApp.cpp:13

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.

#5 0x00007ff04108b090 in TQConnection::ExecuteMethod() () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#6 0x00007ff04106e94a in TQObject::Emit(char const*) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#7 0x00007ff04107211c in TTimer::Notify() () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#8 0x00007ff041072071 in TTimer::CheckTimer(TTime const&) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#9 0x00007ff04114be69 in TUnixSystem::DispatchTimers(bool) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#10 0x00007ff04114c8e4 in TUnixSystem::DispatchOneEvent(bool) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#11 0x00007ff0410aa724 in TSystem::InnerLoop() () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#12 0x00007ff0410a8c91 in TSystem::Run() () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#13 0x00007ff04105dd0f in TApplication::Run(bool) () from /afs/cern.ch/sw/lcg/app/releases/ROOT/6.05.02/x86_64-slc6-gcc49-opt/root/lib/libCore.so
#14 0x0000000000408768 in main () at TestApp.cpp:13

I am running on lxplus at CERN using root 6.05.02 and gcc 4.9.

Does anyone have an idea of what I am doing wrong?

Thanks in advance for the help.

Emanuele Leonardi
TimerTest.tar.gz (2.56 KB)

Hi Emanuele,

I downloaded, built and ran your example (thanks for preparing such a nice reproducer!).
I executed TestApp.exe on kubuntu and obtained the window with a sinx/x plot. Is this supposed to crash?

Danilo

Hi Danilo.

Thanks for testing the code. I am running on lxplus, i.e. Scientific Linux. On a private machine, also running Scientific Linux, I get the same behaviour, i.e. the segmentation violation.

I’ll try and get a Ubuntu node to test.

Cheers

Emanuele

P.S. in any case, yes, you are supposed to see the sin(x)/x plot with a different plotting interval each time DoDraw() is called.

Hi Emanuele,

indeed I see the range changing. I will meanwhile try on lxplus with one of our root distributions on afs to really gather the maximum information.

Cheers,
Danilo