Home | News | Documentation | Download

TCanvas::WaitPrimitive crashes in python when TCanvas is closed

Hello,

TCanvas::WaitPrimitive crashes in python when TCanvas is closed (log file below). Attached is a small macro reproducing this problem with ROOT/6.08.06.

Would it be possible to update this function so that it does not crash and just exists gracefully?

Thank you,
Rustem

 $ python test.py 

 *** Break *** segmentation violation



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

Thread 2 (Thread 0x7f94b9e10700 (LWP 2602340)):
#0  0x00007f94cab61b3b in do_futex_wait.constprop () from /lib64/libpthread.so.0
#1  0x00007f94cab61bcf in __new_sem_wait_slow.constprop.0 () from /lib64/libpthread.so.0
#2  0x00007f94cab61c6b in sem_wait

GLIBC_2.2.5 () from /lib64/libpthread.so.0
#3  0x00007f94caeb7be8 in PyThread_acquire_lock (lock=lock
entry=0x1e82b30, waitflag=waitflag
entry=1) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Python/thread_pthread.h:324
#4  0x00007f94cae75206 in PyEval_RestoreThread (tstate=tstate
entry=0x50572d0) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Python/ceval.c:359
#5  0x00007f94b9e13218 in floatsleep (secs=<optimized out>) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Modules/timemodule.c:959
#6  time_sleep (self=<optimized out>, args=<optimized out>) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Modules/timemodule.c:206
#7  0x00007f94cae7c977 in call_function (oparg=<optimized out>, pp_stack=0x7f94b9e0f530) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Python/ceval.c:4352
#8  PyEval_EvalFrameEx (f=f
entry=0x7f94ba25d5f0, throwflag=throwflag
entry=0) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Python/ceval.c:2989
#9  0x00007f94cae7ff1c in PyEval_EvalCodeEx (co=<optimized out>, globals=<optimized out>, locals=locals
entry=0x0, args=args
entry=0x7f94ba257568, argcount=1, kws=kws
entry=0x7f94cb335068, kwcount=0, defs=0x0, defcount=0, closure=0x0) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Python/ceval.c:3584
#10 0x00007f94cadf5f5d in function_call (func=0x7f94ba8c9b18, arg=0x7f94ba257550, kw=0x7f94ba8a2398) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Objects/funcobject.c:523
#11 0x00007f94cadc4ee3 in PyObject_Call (func=func
entry=0x7f94ba8c9b18, arg=arg
entry=0x7f94ba257550, kw=kw
entry=0x7f94ba8a2398) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Objects/abstract.c:2547
#12 0x00007f94cae78953 in ext_do_call (nk=<optimized out>, na=<optimized out>, flags=<optimized out>, pp_stack=0x7f94b9e0f7d8, func=0x7f94ba8c9b18) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Python/ceval.c:4666
#13 PyEval_EvalFrameEx (f=f
entry=0x7f94ba255938, throwflag=throwflag
entry=0) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Python/ceval.c:3028
#14 0x00007f94cae7d0c8 in fast_function (nk=<optimized out>, na=1, n=<optimized out>, pp_stack=0x7f94b9e0f910, func=0x7f94ba250cf8) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Python/ceval.c:4437
#15 call_function (oparg=<optimized out>, pp_stack=0x7f94b9e0f910) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Python/ceval.c:4372
#16 PyEval_EvalFrameEx (f=f
entry=0x7f94b4000910, throwflag=throwflag
entry=0) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Python/ceval.c:2989
#17 0x00007f94cae7d0c8 in fast_function (nk=<optimized out>, na=1, n=<optimized out>, pp_stack=0x7f94b9e0fa50, func=0x7f94ba250e60) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Python/ceval.c:4437
#18 call_function (oparg=<optimized out>, pp_stack=0x7f94b9e0fa50) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Python/ceval.c:4372
#19 PyEval_EvalFrameEx (f=f
entry=0x7f94bb2e7e50, throwflag=throwflag
entry=0) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Python/ceval.c:2989
#20 0x00007f94cae7ff1c in PyEval_EvalCodeEx (co=<optimized out>, globals=<optimized out>, locals=locals
entry=0x0, args=args
entry=0x7f94ba257528, argcount=1, kws=kws
entry=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Python/ceval.c:3584
#21 0x00007f94cadf5e8c in function_call (func=0x7f94ba250d70, arg=0x7f94ba257510, kw=0x0) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Objects/funcobject.c:523
#22 0x00007f94cadc4ee3 in PyObject_Call (func=func
entry=0x7f94ba250d70, arg=arg
entry=0x7f94ba257510, kw=kw
entry=0x0) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Objects/abstract.c:2547
#23 0x00007f94cadd62ac in instancemethod_call (func=0x7f94ba250d70, arg=0x7f94ba257510, kw=0x0) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Objects/classobject.c:2602
#24 0x00007f94cadc4ee3 in PyObject_Call (func=func
entry=0x7f94cb1df550, arg=arg
entry=0x7f94cb335050, kw=<optimized out>) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Objects/abstract.c:2547
#25 0x00007f94cae758e7 in PyEval_CallObjectWithKeywords (func=0x7f94cb1df550, arg=0x7f94cb335050, kw=<optimized out>) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Python/ceval.c:4221
#26 0x00007f94caebdb22 in t_bootstrap (boot_raw=0x5059f50) at /var/build/jenkins/workspace/lcg_release_tar/BUILDTYPE/Release/COMPILER/gcc62/LABEL/slc6-physical/build/externals/Python-2.7.13/src/Python/2.7.13/Modules/threadmodule.c:620
#27 0x00007f94cab5bea5 in start_thread () from /lib64/libpthread.so.0
#28 0x00007f94ca17b9fd in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f94cb375740 (LWP 2602326)):
#0  0x00007f94ca142549 in waitpid () from /lib64/libc.so.6
#1  0x00007f94ca0bffb2 in do_system () from /lib64/libc.so.6
#2  0x00007f94ca0c0361 in system () from /lib64/libc.so.6
#3  0x00007f94c8327868 in TUnixSystem::StackTrace() () from /cvmfs/atlas.cern.ch/repo/sw/software/21.0/sw/lcg/releases/LCG_88/ROOT/6.08.06/x86_64-slc6-gcc62-opt/lib/libCore.so
#4  0x00007f94c8329d7c in TUnixSystem::DispatchSignals(ESignals) () from /cvmfs/atlas.cern.ch/repo/sw/software/21.0/sw/lcg/releases/LCG_88/ROOT/6.08.06/x86_64-slc6-gcc62-opt/lib/libCore.so
#5  <signal handler called>
#6  0x00007f94b93c34fa in TPad::WaitPrimitive(char const*, char const*) () from /cvmfs/atlas.cern.ch/repo/sw/software/21.0/sw/lcg/releases/ROOT/6.08.06-c8fb4/x86_64-slc6-gcc62-opt/lib/libGpad.so
#7  0x00007f94b800a054 in ?? ()
#8  0x00007f94c8056000 in (anonymous namespace)::num_put_c () from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-slc6/lib64/libstdc++.so.6
#9  0x0000000005500a00 in ?? ()
#10 0x00007ffd9267fa60 in ?? ()
#11 0x00000000055013a0 in ?? ()
#12 0x0000000005096910 in ?? ()
#13 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.
===========================================================
#6  0x00007f94b93c34fa in TPad::WaitPrimitive(char const*, char const*) () from /cvmfs/atlas.cern.ch/repo/sw/software/21.0/sw/lcg/releases/ROOT/6.08.06-c8fb4/x86_64-slc6-gcc62-opt/lib/libGpad.so
#7  0x00007f94b800a054 in ?? ()
#8  0x00007f94c8056000 in (anonymous namespace)::num_put_c () from /cvmfs/sft.cern.ch/lcg/releases/gcc/6.2.0-b9934/x86_64-slc6/lib64/libstdc++.so.6
#9  0x0000000005500a00 in ?? ()
#10 0x00007ffd9267fa60 in ?? ()
#11 0x00000000055013a0 in ?? ()
#12 0x0000000005096910 in ?? ()
#13 0x0000000000000000 in ?? ()
===========================================================


Traceback (most recent call last):
  File "test.py", line 8, in <module>
    c.WaitPrimitive()
SystemError: TObject* TPad::WaitPrimitive(const char* pname = "", const char* emode = "") =>
    problem in C++; program state has been reset

test.py (101 Bytes)


Please read tips for efficient and successful posting and posting code

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


Yes, I can confirm a problem.
It can be reproduced with hsimple.C macro. Just run it, then type c1->WaitPrimitive() and then close canvas. I will create PR for it soon.

Problem should be fixed now in master and 6.22 branch.
Thanks for reporting it!

Thank you for confirming and fixing this problem!