Home | News | Documentation | Download

Root on python Multithreading

Hello,
I’m actually working on a python multithreading project and i need to give two Threads two different TGeoManager instances , but when a create a deep copy of a TGeoManager object i run into a segmentation error

Hi @EMed,

Could you please attach a reproducer and a stack trace? Otherwise it´s imposible for us to help you.

Cheers,
J.

here is what i get by just creating a deep copy inside a thread.

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

Thread 4 (Thread 0x7f699f923700 (LWP 28482)):
#0 futex_abstimed_wait_cancelable (private=128, abstime=0x0, clockid=0, expected=0, futex_word=0x7f697b359000) at …/sysdeps/nptl/futex-internal.h:320
#1 do_futex_wait (sem=sem
entry=0x7f697b359000, abstime=0x0, clockid=0) at sem_waitcommon.c:112
#2 0x00007f69a2db54e8 in __new_sem_wait_slow (sem=0x7f697b359000, abstime=0x0, clockid=0) at sem_waitcommon.c:184
#3 0x00007f698d994a5e in ?? () from /usr/lib/python3.8/lib-dynload/_multiprocessing.cpython-38-x86_64-linux-gnu.so
#4 0x00000000005f5e79 in PyCFunction_Call ()
#5 0x00000000005f6a46 in _PyObject_MakeTpCall ()
#6 0x0000000000570a1f in _PyEval_EvalFrameDefault ()
#7 0x00000000005f6226 in _PyFunction_Vectorcall ()
#8 0x000000000050b271 in ?? ()
#9 0x00000000005f55f2 in PyObject_Call ()
#10 0x000000000056cbfb in _PyEval_EvalFrameDefault ()
#11 0x00000000005f6226 in _PyFunction_Vectorcall ()
#12 0x000000000056b5e0 in _PyEval_EvalFrameDefault ()
#13 0x00000000005f6226 in _PyFunction_Vectorcall ()
#14 0x000000000056b5e0 in _PyEval_EvalFrameDefault ()
#15 0x00000000005f6226 in _PyFunction_Vectorcall ()
#16 0x000000000050ad5c in ?? ()
#17 0x00000000005f55f2 in PyObject_Call ()
#18 0x00000000006564ec in ?? ()
#19 0x0000000000676148 in ?? ()
#20 0x00007f69a2dab609 in start_thread (arg=) at pthread_create.c:477
#21 0x00007f69a2ee7293 in clone () at …/sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 3 (Thread 0x7f699f122700 (LWP 28481)):
#0 0x00007f69a2eaadff in __GI___wait4 (pid=29514, stat_loc=stat_loc
entry=0x7f699f11dac8, options=options
entry=0, usage=usage
entry=0x0) at …/sysdeps/unix/sysv/linux/wait4.c:27
#1 0x00007f69a2eaad7b in __GI___waitpid (pid=, stat_loc=stat_loc
entry=0x7f699f11dac8, options=options
entry=0) at waitpid.c:38
#2 0x00007f69a2e1a0e7 in do_system (line=) at …/sysdeps/posix/system.c:172
#3 0x00007f69958e1a6e in TUnixSystem::StackTrace() () from /home/mehdi/root-6.24.06-install/lib/libCore.so
#4 0x00007f6995b7319e in (anonymous namespace)::TExceptionHandlerImp::HandleException(int) () from /home/mehdi/root-6.24.06-install/lib/libcppyy_backend3_8.so
#5 0x00007f69958de759 in TUnixSystem::DispatchSignals(ESignals) () from /home/mehdi/root-6.24.06-install/lib/libCore.so
#6
#7 0x0000000000000000 in ?? ()
#8 0x00007f699587f18c in TClass::GetActualClass(void const*) const () from /home/mehdi/root-6.24.06-install/lib/libCore.so
#9 0x00007f69950c7610 in TBufferIO::WriteObjectAny(void const*, TClass const*, bool) () from /home/mehdi/root-6.24.06-install/lib/libRIO.so
#10 0x00007f698f101427 in op_reduce(CPyCppyy::CPPInstance*, _object*) () from /home/mehdi/root-6.24.06-install/lib/libROOTPythonizations3_8.so
#11 0x00000000005c4706 in ?? ()
#12 0x00000000005f5bb8 in PyVectorcall_Call ()
#13 0x00007f6995bfed59 in CPyCppyy::im_call(_object*, _object*, _object*) () from /home/mehdi/root-6.24.06-install/lib/libcppyy3_8.so
#14 0x00000000005f6a46 in _PyObject_MakeTpCall ()
#15 0x00000000006a1918 in ?? ()
#16 0x00000000005c4860 in ?? ()
#17 0x000000000056b3fe in _PyEval_EvalFrameDefault ()
#18 0x00000000005696da in _PyEval_EvalCodeWithName ()
#19 0x00000000005f6403 in _PyFunction_Vectorcall ()
#20 0x000000000056b3fe in _PyEval_EvalFrameDefault ()
#21 0x00000000005696da in _PyEval_EvalCodeWithName ()
#22 0x00000000005f6403 in _PyFunction_Vectorcall ()
#23 0x000000000056b3fe in _PyEval_EvalFrameDefault ()
#24 0x00000000005696da in _PyEval_EvalCodeWithName ()
#25 0x00000000005f6403 in _PyFunction_Vectorcall ()
#26 0x000000000056b3fe in _PyEval_EvalFrameDefault ()
#27 0x00000000005696da in _PyEval_EvalCodeWithName ()
#28 0x00000000005f6403 in _PyFunction_Vectorcall ()
#29 0x00000000005f55f2 in PyObject_Call ()
#30 0x000000000056cbfb in _PyEval_EvalFrameDefault ()
#31 0x00000000005696da in _PyEval_EvalCodeWithName ()
#32 0x00000000005f6403 in _PyFunction_Vectorcall ()
#33 0x00000000005703e6 in _PyEval_EvalFrameDefault ()
#34 0x00000000005f6226 in _PyFunction_Vectorcall ()
#35 0x000000000050b271 in ?? ()
#36 0x00000000005f55f2 in PyObject_Call ()
#37 0x000000000056cbfb in _PyEval_EvalFrameDefault ()
#38 0x00000000005f6226 in _PyFunction_Vectorcall ()
#39 0x000000000056b5e0 in _PyEval_EvalFrameDefault ()
#40 0x00000000005f6226 in _PyFunction_Vectorcall ()
#41 0x000000000056b5e0 in _PyEval_EvalFrameDefault ()
#42 0x00000000005f6226 in _PyFunction_Vectorcall ()
#43 0x000000000050ad5c in ?? ()
#44 0x00000000005f55f2 in PyObject_Call ()
#45 0x00000000006564ec in ?? ()
#46 0x0000000000676148 in ?? ()
#47 0x00007f69a2dab609 in start_thread (arg=) at pthread_create.c:477
#48 0x00007f69a2ee7293 in clone () at …/sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7f699c921700 (LWP 28480)):
#0 futex_abstimed_wait_cancelable (private=, abstime=0x7f699c91f760, clockid=, expected=0, futex_word=0x93db4c <_PyRuntime+1228>) at …/sysdeps/nptl/futex-internal.h:320
#1 __pthread_cond_wait_common (abstime=0x7f699c91f760, clockid=, mutex=0x93db50 <_PyRuntime+1232>, cond=0x93db20 <_PyRuntime+1184>) at pthread_cond_wait.c:520
#2 __pthread_cond_timedwait (cond=0x93db20 <_PyRuntime+1184>, mutex=0x93db50 <_PyRuntime+1232>, abstime=0x7f699c91f760) at pthread_cond_wait.c:656
#3 0x000000000068df78 in ?? ()
#4 0x00000000005732bb in _PyEval_EvalFrameDefault ()
#5 0x00000000005f6226 in _PyFunction_Vectorcall ()
#6 0x00000000005f7127 in PyObject_CallObject ()
#7 0x00007f6995c1f1d0 in CPyCppyy::Pythonize(_object*, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) () from /home/mehdi/root-6.24.06-install/lib/libcppyy3_8.so
#8 0x00007f6995c17cbb in CPyCppyy::CreateScopeProxy(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, _object*) () from /home/mehdi/root-6.24.06-install/lib/libcppyy3_8.so
#9 0x00007f6995c1784f in CPyCppyy::CreateScopeProxy(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, _object*) () from /home/mehdi/root-6.24.06-install/lib/libcppyy3_8.so
#10 0x00007f6995bf9a48 in CPyCppyy::meta_getattro(_object*, _object*) () from /home/mehdi/root-6.24.06-install/lib/libcppyy3_8.so
#11 0x00000000004f654a in ?? ()
#12 0x00000000005c4ad0 in ?? ()
#13 0x000000000056b3fe in _PyEval_EvalFrameDefault ()
#14 0x00000000005f6226 in _PyFunction_Vectorcall ()
#15 0x000000000050ad5c in ?? ()
#16 0x00000000005f3991 in ?? ()
#17 0x00000000005f3c75 in PyObject_CallFunctionObjArgs ()
#18 0x0000000000598bd7 in ?? ()
#19 0x000000000059ba67 in ?? ()
#20 0x00000000005c1e02 in PyObject_GetAttr ()
#21 0x00000000005bf58b in _PyObject_GetMethod ()
#22 0x000000000056b4e4 in _PyEval_EvalFrameDefault ()
#23 0x00000000005f6226 in _PyFunction_Vectorcall ()
#24 0x000000000056b5e0 in _PyEval_EvalFrameDefault ()
#25 0x00000000005f6226 in _PyFunction_Vectorcall ()
#26 0x000000000050b271 in ?? ()
#27 0x00000000005f55f2 in PyObject_Call ()
#28 0x000000000056cbfb in _PyEval_EvalFrameDefault ()
#29 0x00000000005f6226 in _PyFunction_Vectorcall ()
#30 0x000000000056b5e0 in _PyEval_EvalFrameDefault ()
#31 0x00000000005f6226 in _PyFunction_Vectorcall ()
#32 0x000000000056b5e0 in _PyEval_EvalFrameDefault ()
#33 0x00000000005f6226 in _PyFunction_Vectorcall ()
#34 0x000000000050ad5c in ?? ()
#35 0x00000000005f55f2 in PyObject_Call ()
#36 0x00000000006564ec in ?? ()
#37 0x0000000000676148 in ?? ()
#38 0x00007f69a2dab609 in start_thread (arg=) at pthread_create.c:477
#39 0x00007f69a2ee7293 in clone () at …/sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7f69a2bf9740 (LWP 28449)):
#0 futex_abstimed_wait_cancelable (private=, abstime=0x7ffc82706180, clockid=, expected=0, futex_word=0x93db4c <_PyRuntime+1228>) at …/sysdeps/nptl/futex-internal.h:320
#1 __pthread_cond_wait_common (abstime=0x7ffc82706180, clockid=, mutex=0x93db50 <_PyRuntime+1232>, cond=0x93db20 <_PyRuntime+1184>) at pthread_cond_wait.c:520
#2 __pthread_cond_timedwait (cond=0x93db20 <_PyRuntime+1184>, mutex=0x93db50 <_PyRuntime+1232>, abstime=0x7ffc82706180) at pthread_cond_wait.c:656
#3 0x000000000057464d in PyEval_RestoreThread ()
#4 0x000000000052b302 in ?? ()
#5 0x0000000000503ec9 in ?? ()
#6 0x000000000056b5e0 in _PyEval_EvalFrameDefault ()
#7 0x00000000005696da in _PyEval_EvalCodeWithName ()
#8 0x00000000005f6403 in _PyFunction_Vectorcall ()
#9 0x000000000056b5e0 in _PyEval_EvalFrameDefault ()
#10 0x00000000005696da in _PyEval_EvalCodeWithName ()
#11 0x00000000005f6403 in _PyFunction_Vectorcall ()
#12 0x000000000056b5e0 in _PyEval_EvalFrameDefault ()
#13 0x00000000005f6226 in _PyFunction_Vectorcall ()
#14 0x000000000056b5e0 in _PyEval_EvalFrameDefault ()
#15 0x00000000005696da in _PyEval_EvalCodeWithName ()
#16 0x00000000005f6403 in _PyFunction_Vectorcall ()
#17 0x000000000050b271 in ?? ()
#18 0x00000000005f55f2 in PyObject_Call ()
#19 0x000000000056cbfb in _PyEval_EvalFrameDefault ()
#20 0x00000000005f6226 in _PyFunction_Vectorcall ()
#21 0x000000000056b5e0 in _PyEval_EvalFrameDefault ()
#22 0x00000000005696da in _PyEval_EvalCodeWithName ()
#23 0x000000000050add0 in ?? ()
#24 0x000000000056c5d1 in _PyEval_EvalFrameDefault ()
#25 0x00000000005f6226 in _PyFunction_Vectorcall ()
#26 0x000000000056b5e0 in _PyEval_EvalFrameDefault ()
#27 0x000000000059c04b in ?? ()
#28 0x00000000005f69af in _PyObject_MakeTpCall ()
#29 0x0000000000570612 in _PyEval_EvalFrameDefault ()
#30 0x00000000005f6226 in _PyFunction_Vectorcall ()
#31 0x00000000005703e6 in _PyEval_EvalFrameDefault ()
#32 0x00000000005f6226 in _PyFunction_Vectorcall ()
#33 0x00000000005703e6 in _PyEval_EvalFrameDefault ()
#34 0x00000000005f6226 in _PyFunction_Vectorcall ()
#35 0x000000000056b5e0 in _PyEval_EvalFrameDefault ()
#36 0x00000000005696da in _PyEval_EvalCodeWithName ()
#37 0x00000000005f6403 in _PyFunction_Vectorcall ()
#38 0x000000000056b5e0 in _PyEval_EvalFrameDefault ()
#39 0x00000000005696da in _PyEval_EvalCodeWithName ()
#40 0x000000000068db17 in PyEval_EvalCode ()
#41 0x000000000067eeb1 in ?? ()
#42 0x000000000067ef2f in ?? ()
#43 0x000000000067efd1 in ?? ()
#44 0x000000000067f377 in PyRun_SimpleFileExFlags ()
#45 0x00000000006b7902 in Py_RunMain ()
#46 0x00000000006b7c8d in Py_BytesMain ()
#47 0x00007f69a2dec0b3 in __libc_start_main (main=0x4eed30 , argc=2, argv=0x7ffc827081e8, init=, fini=, rtld_fini=, stack_end=0x7ffc827081d8) at …/csu/libc-start.c:308
#48 0x00000000005fb12e in _start ()

@EMed Are you calling ROOT.EnableImplicitMT()? Could you also provide a minimal reproducer?