# Root on python Multithreading

**URL:** <https://root-forum.cern.ch/t/root-on-python-multithreading/48344>\
**Category:** Newbie\
**Tags:** python, root\
**Created:** [January 11, 2022, 11:19pm UTC](https://root-forum.cern.ch/t/root-on-python-multithreading/48344 "2022-01-11T23:19:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![EMed](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/emed/32/28445_2.png) [@EMed](https://root-forum.cern.ch/u/EMed)\
**Post date:** [January 11, 2022, 11:19pm UTC](https://root-forum.cern.ch/t/root-on-python-multithreading/48344/1 "2022-01-11T23:19:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jalopezg](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jalopezg/32/25844_2.png) [@jalopezg](https://root-forum.cern.ch/u/jalopezg)\
**Post date:** [January 12, 2022, 11:58am UTC](https://root-forum.cern.ch/t/root-on-python-multithreading/48344/2 "2022-01-12T11:58:40Z")

</div>

Hi @EMed,

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

Cheers,  
J.

---

<div class="post-metadata">

**Author:** ![EMed](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/emed/32/28445_2.png) [@EMed](https://root-forum.cern.ch/u/EMed)\
**Post date:** [January 13, 2022, 1:38am UTC](https://root-forum.cern.ch/t/root-on-python-multithreading/48344/3 "2022-01-13T01:38:13Z")

</div>

# 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 ()

---

<div class="post-metadata">

**Author:** ![jalopezg](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jalopezg/32/25844_2.png) [@jalopezg](https://root-forum.cern.ch/u/jalopezg)\
**Post date:** [January 13, 2022, 12:30pm UTC](https://root-forum.cern.ch/t/root-on-python-multithreading/48344/4 "2022-01-13T12:30:23Z")

</div>

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