On Thu, Apr 2, 2015 at 9:12 PM, Peter Schüller <schuelle...@gmail.com> wrote: > Dear all, > > In the hexhex project on github [1] we execute a python program using > boost::python::exec_file, the respective code is in > src/PythonPlugin.cpp in the function PythonPlugin::runPythonMain(...). > > In this python program I use subprocess.call() to run a shell > application (actually graphviz). > > Sometimes it works, sometimes it hangs using 100% CPU. It seems to > depend on how much the C++ program had to do before it executed the > python part. In both cases the C++ program uses threads (is that > relevant wrt. fork() in python? I found some hints online that it > could be relevant). > > I traced it down to os.fork() in subprocess.py which returns in one > case and does not return at all (neither parent nor child) in the > other case. > > If I do strace -f on the process I get the following (the > SIGPROF/rt_sigreturn/clone repeats until the disk is full): > > [pid 18646] clone(child_stack=0, > flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, > child_tidptr=0x7f96a5fa2a50) = ? ERESTARTNOINTR (To be restarted) > [pid 18646] --- SIGPROF {si_signo=SIGPROF, si_code=SI_KERNEL} --- > [pid 18646] rt_sigreturn() = 56 > [pid 18646] clone(child_stack=0, > flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, > child_tidptr=0x7f96a5fa2a50) = ? ERESTARTNOINTR (To be restarted) > [pid 18646] --- SIGPROF {si_signo=SIGPROF, si_code=SI_KERNEL} --- > [pid 18646] rt_sigreturn() = 56 > [pid 18646] clone(child_stack=0, > flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, > child_tidptr=0x7f96a5fa2a50) = ? ERESTARTNOINTR (To be restarted) > [pid 18646] --- SIGPROF {si_signo=SIGPROF, si_code=SI_KERNEL} --- > [pid 18646] rt_sigreturn() = 56 > [pid 18646] clone(child_stack=0, > flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, > child_tidptr=0x7f96a5fa2a50) = ? ERESTARTNOINTR (To be restarted) > [pid 18646] --- SIGPROF {si_signo=SIGPROF, si_code=SI_KERNEL} ---
There is no loop in Python's fork code, so it cannot really be blamed. It sure looks like there is a pending signal which interferes for some reason. _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig