Crash with threadsh1.C

Hello,

I get a crash (please see below) with threadsh1.C from the tutorials,
if I try closing one of the windows while the program is running.
The crash occurs with root_5.28 and root_5.22.

Thank You,

Bertrand Roessli

===========================================================
There was a crash (#8 0xb7237f1d in SigHandler () from /usr/local/lib/root/libCore.so).
This is the entire stack trace of all threads:

Thread 6 (Thread 0xb4e65b90 (LWP 13038)):
#0 0xb778d430 in __kernel_vsyscall ()
#1 0xb66023eb in waitpid () from /lib/tls/i686/cmov/libc.so.6
#2 0xb659c57b in ?? () from /lib/tls/i686/cmov/libc.so.6
#3 0xb659c922 in system () from /lib/tls/i686/cmov/libc.so.6
#4 0xb66d44fd in system () from /lib/tls/i686/cmov/libpthread.so.0
#5 0xb72322bd in TUnixSystem::Exec () from /usr/local/lib/root/libCore.so
#6 0xb72385a5 in TUnixSystem::StackTrace ()
from /usr/local/lib/root/libCore.so
#7 0xb7237e07 in TUnixSystem::DispatchSignals ()
from /usr/local/lib/root/libCore.so
#8 0xb7237f1d in SigHandler () from /usr/local/lib/root/libCore.so
#9 0xb722f232 in sighandler () from /usr/local/lib/root/libCore.so
#10
#11 0xb503ab0a in handle ()
from /home/broessli/root_v5.28/root/tutorials/thread/./threadsh1_C.so
#12 0xb4fe233e in TThread::Function () from /usr/local/lib/root/libThread.so
#13 0xb66cc4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#14 0xb66475ee in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 5 (Thread 0xb4664b90 (LWP 13039)):
#0 0xb778d430 in __kernel_vsyscall ()
#1 0xb663f8d1 in select () from /lib/tls/i686/cmov/libc.so.6
#2 0xb7230670 in TUnixSystem::Sleep () from /usr/local/lib/root/libCore.so
#3 0xb503ab2b in handle ()
from /home/broessli/root_v5.28/root/tutorials/thread/./threadsh1_C.so
#4 0xb4fe233e in TThread::Function () from /usr/local/lib/root/libThread.so
#5 0xb66cc4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#6 0xb66475ee in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 4 (Thread 0xb3e63b90 (LWP 13040)):
#0 0xb778d430 in __kernel_vsyscall ()
#1 0xb663f8d1 in select () from /lib/tls/i686/cmov/libc.so.6
#2 0xb7230670 in TUnixSystem::Sleep () from /usr/local/lib/root/libCore.so
#3 0xb503ab2b in handle ()
from /home/broessli/root_v5.28/root/tutorials/thread/./threadsh1_C.so
#4 0xb4fe233e in TThread::Function () from /usr/local/lib/root/libThread.so
#5 0xb66cc4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#6 0xb66475ee in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 3 (Thread 0xb3662b90 (LWP 13041)):
#0 0xb778d430 in __kernel_vsyscall ()
#1 0xb663f8d1 in select () from /lib/tls/i686/cmov/libc.so.6
#2 0xb7230670 in TUnixSystem::Sleep () from /usr/local/lib/root/libCore.so
#3 0xb503ab2b in handle ()
from /home/broessli/root_v5.28/root/tutorials/thread/./threadsh1_C.so
#4 0xb4fe233e in TThread::Function () from /usr/local/lib/root/libThread.so
#5 0xb66cc4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#6 0xb66475ee in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 2 (Thread 0xb2e61b90 (LWP 13042)):
#0 0xb778d430 in __kernel_vsyscall ()
#1 0xb66ccbe7 in pthread_join () from /lib/tls/i686/cmov/libpthread.so.0
#2 0xb4fe5b37 in TPosixThread::Join () from /usr/local/lib/root/libThread.so
#3 0xb4fe3d4a in TThread::Join () from /usr/local/lib/root/libThread.so
#4 0xb503a1bb in joiner ()
from /home/broessli/root_v5.28/root/tutorials/thread/./threadsh1_C.so
#5 0xb4fe233e in TThread::Function () from /usr/local/lib/root/libThread.so
#6 0xb66cc4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#7 0xb66475ee in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 1 (Thread 0xb64e76d0 (LWP 13013)):
#0 0xb778d430 in __kernel_vsyscall ()
#1 0xb659c531 in ?? () from /lib/tls/i686/cmov/libc.so.6
#2 0xb659c922 in system () from /lib/tls/i686/cmov/libc.so.6
#3 0xb66d44fd in system () from /lib/tls/i686/cmov/libpthread.so.0
#4 0xb72322bd in TUnixSystem::Exec () from /usr/local/lib/root/libCore.so
#5 0xb72385a5 in TUnixSystem::StackTrace ()
from /usr/local/lib/root/libCore.so
#6 0xb7237e07 in TUnixSystem::DispatchSignals ()
from /usr/local/lib/root/libCore.so
#7 0xb7237f1d in SigHandler () from /usr/local/lib/root/libCore.so
#8 0xb722f232 in sighandler () from /usr/local/lib/root/libCore.so
#9
#10 0x08414003 in ?? ()
#11 0xb503a977 in G__threadsh1_C_ACLiC_dict__0_1480 ()
from /home/broessli/root_v5.28/root/tutorials/thread/./threadsh1_C.so
#12 0xb6a86f86 in Cint::G__ExceptionWrapper ()
from /usr/local/lib/root/libCint.so
#13 0xb6b40c6c in G__execute_call () from /usr/local/lib/root/libCint.so
#14 0xb6b41a4f in G__call_cppfunc () from /usr/local/lib/root/libCint.so
#15 0xb6b1d870 in G__interpret_func () from /usr/local/lib/root/libCint.so
#16 0xb6b08aab in G__getfunction () from /usr/local/lib/root/libCint.so
#17 0xb6ad9928 in G__getitem () from /usr/local/lib/root/libCint.so
#18 0xb6adde94 in G__getexpr () from /usr/local/lib/root/libCint.so
#19 0xb6aec485 in G__calc_internal () from /usr/local/lib/root/libCint.so
#20 0xb6b826ef in G__process_cmd () from /usr/local/lib/root/libCint.so
#21 0xb71f321c in TCint::ProcessLine () from /usr/local/lib/root/libCore.so
#22 0xb71f0bdf in TCint::ProcessLineSynch ()
from /usr/local/lib/root/libCore.so
#23 0xb713c56d in TApplication::ExecuteFile ()
from /usr/local/lib/root/libCore.so
#24 0xb713c85c in TApplication::ProcessFile ()
from /usr/local/lib/root/libCore.so
#25 0xb7139ea6 in TApplication::ProcessLine ()
from /usr/local/lib/root/libCore.so
#26 0xb681571e in TRint::HandleTermInput () from /usr/local/lib/root/libRint.so
#27 0xb68151e5 in TTermInputHandler::Notify ()
from /usr/local/lib/root/libRint.so
#28 0xb6818134 in TTermInputHandler::ReadNotify ()
from /usr/local/lib/root/libRint.so
#29 0xb7236009 in TUnixSystem::CheckDescriptors ()
from /usr/local/lib/root/libCore.so
#30 0xb7236366 in TUnixSystem::DispatchOneEvent ()
from /usr/local/lib/root/libCore.so
#31 0xb71a47f1 in TSystem::InnerLoop () from /usr/local/lib/root/libCore.so
#32 0xb71a760b in TSystem::Run () from /usr/local/lib/root/libCore.so
#33 0xb7137947 in TApplication::Run () from /usr/local/lib/root/libCore.so
#34 0xb6817bf0 in TRint::Run () from /usr/local/lib/root/libRint.so
#35 0x08048eb5 in main ()
#0 0xb778d430 in __kernel_vsyscall ()

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.

#11 0xb503ab0a in handle ()
from /home/broessli/root_v5.28/root/tutorials/thread/./threadsh1_C.so
#12 0xb4fe233e in TThread::Function () from /usr/local/lib/root/libThread.so
#13 0xb66cc4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#14 0xb66475ee in clone () from /lib/tls/i686/cmov/libc.so.6

===========================================================

Root >
*** Break *** segmentation violation

===========================================================
There was a crash (#8 0xb7237f1d in SigHandler () from /usr/local/lib/root/libCore.so).
This is the entire stack trace of all threads:

Thread 6 (Thread 0xb4e65b90 (LWP 13038)):
#0 0xb778d430 in __kernel_vsyscall ()
#1 0xb663f8d1 in select () from /lib/tls/i686/cmov/libc.so.6
#2 0xb72305a9 in TUnixSystem::UnixSelect ()
from /usr/local/lib/root/libCore.so
#3 0xb7236500 in TUnixSystem::DispatchOneEvent ()
from /usr/local/lib/root/libCore.so
#4 0xb71a47f1 in TSystem::InnerLoop () from /usr/local/lib/root/libCore.so
#5 0xb71a760b in TSystem::Run () from /usr/local/lib/root/libCore.so
#6 0xb7137947 in TApplication::Run () from /usr/local/lib/root/libCore.so
#7 0xb6817bf0 in TRint::Run () from /usr/local/lib/root/libRint.so
#8 0x08048eb5 in main ()

Thread 5 (Thread 0xb4664b90 (LWP 13039)):
#0 0xb778d430 in __kernel_vsyscall ()
#1 0xb663f8d1 in select () from /lib/tls/i686/cmov/libc.so.6
#2 0xb7230670 in TUnixSystem::Sleep () from /usr/local/lib/root/libCore.so
#3 0xb503ab2b in handle ()
from /home/broessli/root_v5.28/root/tutorials/thread/./threadsh1_C.so
#4 0xb4fe233e in TThread::Function () from /usr/local/lib/root/libThread.so
#5 0xb66cc4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#6 0xb66475ee in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 4 (Thread 0xb3e63b90 (LWP 13040)):
#0 0xb778d430 in __kernel_vsyscall ()
#1 0xb663f8d1 in select () from /lib/tls/i686/cmov/libc.so.6
#2 0xb7230670 in TUnixSystem::Sleep () from /usr/local/lib/root/libCore.so
#3 0xb503ab2b in handle ()
from /home/broessli/root_v5.28/root/tutorials/thread/./threadsh1_C.so
#4 0xb4fe233e in TThread::Function () from /usr/local/lib/root/libThread.so
#5 0xb66cc4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#6 0xb66475ee in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 3 (Thread 0xb3662b90 (LWP 13041)):
#0 0xb778d430 in __kernel_vsyscall ()
#1 0xb663f8d1 in select () from /lib/tls/i686/cmov/libc.so.6
#2 0xb7230670 in TUnixSystem::Sleep () from /usr/local/lib/root/libCore.so
#3 0xb503ab2b in handle ()
from /home/broessli/root_v5.28/root/tutorials/thread/./threadsh1_C.so
#4 0xb4fe233e in TThread::Function () from /usr/local/lib/root/libThread.so
#5 0xb66cc4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#6 0xb66475ee in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 2 (Thread 0xb2e61b90 (LWP 13042)):
#0 0xb778d430 in __kernel_vsyscall ()
#1 0xb66ccbe7 in pthread_join () from /lib/tls/i686/cmov/libpthread.so.0
#2 0xb4fe5b37 in TPosixThread::Join () from /usr/local/lib/root/libThread.so
#3 0xb4fe3d4a in TThread::Join () from /usr/local/lib/root/libThread.so
#4 0xb503a1bb in joiner ()
from /home/broessli/root_v5.28/root/tutorials/thread/./threadsh1_C.so
#5 0xb4fe233e in TThread::Function () from /usr/local/lib/root/libThread.so
#6 0xb66cc4ff in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#7 0xb66475ee in clone () from /lib/tls/i686/cmov/libc.so.6

Thread 1 (Thread 0xb64e76d0 (LWP 13013)):
#0 0xb778d430 in __kernel_vsyscall ()
#1 0xb66023eb in waitpid () from /lib/tls/i686/cmov/libc.so.6
#2 0xb659c57b in ?? () from /lib/tls/i686/cmov/libc.so.6
#3 0xb659c922 in system () from /lib/tls/i686/cmov/libc.so.6
#4 0xb66d44fd in system () from /lib/tls/i686/cmov/libpthread.so.0
#5 0xb72322bd in TUnixSystem::Exec () from /usr/local/lib/root/libCore.so
#6 0xb72385a5 in TUnixSystem::StackTrace ()
from /usr/local/lib/root/libCore.so
#7 0xb7237e07 in TUnixSystem::DispatchSignals ()
from /usr/local/lib/root/libCore.so
#8 0xb7237f1d in SigHandler () from /usr/local/lib/root/libCore.so
#9 0xb722f232 in sighandler () from /usr/local/lib/root/libCore.so
#10
#11 0xb5747015 in ?? () from /usr/local/lib/root/libGui.so
#12 0xb7236500 in TUnixSystem::DispatchOneEvent ()
from /usr/local/lib/root/libCore.so
#13 0xb71a47f1 in TSystem::InnerLoop () from /usr/local/lib/root/libCore.so
#14 0xb71a760b in TSystem::Run () from /usr/local/lib/root/libCore.so
#15 0xb7137947 in TApplication::Run () from /usr/local/lib/root/libCore.so
#16 0xb6817bf0 in TRint::Run () from /usr/local/lib/root/libRint.so
#17 0x08048eb5 in main ()
#0 0xb778d430 in __kernel_vsyscall ()

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.

#11 0xb5747015 in ?? () from /usr/local/lib/root/libGui.so
#12 0xb7236500 in TUnixSystem::DispatchOneEvent ()
from /usr/local/lib/root/libCore.so
#13 0xb71a47f1 in TSystem::InnerLoop () from /usr/local/lib/root/libCore.so
#14 0xb71a760b in TSystem::Run () from /usr/local/lib/root/libCore.so
#15 0xb7137947 in TApplication::Run () from /usr/local/lib/root/libCore.so
#16 0xb6817bf0 in TRint::Run () from /usr/local/lib/root/libRint.so
#17 0x08048eb5 in main ()
#0 0xb778d430 in __kernel_vsyscall ()

Root >
*** Break *** segmentation violation

*** Break *** segmentation violation

Hi Bertrand,

I added a protection in threadsh1.C (kill the corresponding thread when closing a canvas) and in threadsh2.C (prevent the canvas to be closed while the threads are running). Both protections are in svn trunk (rev. 37738 and 37739). Thanks for the report and sorry for the late reply.

Cheers, Bertrand.