Ticket #4914 (closed: fixed)
Segfault if starting a python algorithm while a script is running
Reported by: | Janik Zikovsky | Owned by: | Martyn Gigg |
---|---|---|---|
Priority: | blocker | Milestone: | Release 2.1 |
Component: | Mantid | Keywords: | |
Cc: | russell.taylor@… | Blocked By: | |
Blocking: | Tester: | Roman Tolchenov |
Description (last modified by Janik Zikovsky) (diff)
Say you start a very simple script that takes a while:
for i in range(100): Pause(1)
and then start a python algorithm using the GUI. For example, I used ConjoinSpectra. You get a segfault with the following stack trace:
Thread [17] (Suspended: Signal 'SIGSEGV' received. Description: Segmentation fault.) 36 PyObject_Call() abstract.c:2530 0x00007ffff2984a5a 35 PyObject_CallFunctionObjArgs() abstract.c:2760 0x00007ffff2985410 34 PyObject_IsSubclass() abstract.c:3041 0x00007ffff2985c9d 33 PyErr_GivenExceptionMatches() errors.c:117 0x00007ffff2a40f8a 32 builtin_hasattr() bltinmodule.c:887 0x00007ffff2a27054 31 call_function() ceval.c:4013 0x00007ffff2a30630 30 PyEval_EvalFrameEx() ceval.c:2666 0x00007ffff2a30630 29 PyEval_EvalCodeEx() ceval.c:3253 0x00007ffff2a3227d 28 fast_function() ceval.c:4109 0x00007ffff2a3028d 27 call_function() ceval.c:4034 0x00007ffff2a3028d 26 PyEval_EvalFrameEx() ceval.c:2666 0x00007ffff2a3028d 25 PyEval_EvalCodeEx() ceval.c:3253 0x00007ffff2a3227d 24 fast_function() ceval.c:4109 0x00007ffff2a3028d 23 call_function() ceval.c:4034 0x00007ffff2a3028d 22 PyEval_EvalFrameEx() ceval.c:2666 0x00007ffff2a3028d 21 PyEval_EvalCodeEx() ceval.c:3253 0x00007ffff2a3227d 20 function_call() funcobject.c:526 0x00007ffff29b1192 19 PyObject_Call() abstract.c:2529 0x00007ffff2984a53 18 instancemethod_call() classobject.c:2578 0x00007ffff29978ff 17 PyObject_Call() abstract.c:2529 0x00007ffff2984a53 16 PyEval_CallObjectWithKeywords() ceval.c:3882 0x00007ffff2a2a627 15 PyEval_CallMethod() modsupport.c:586 0x00007ffff2a507de 14 boost::python::call_method<Mantid::PythonAPI::PyAlgorithmBase*>() call_method.hpp:66 0x00007fffb8091712 13 Mantid::PythonAPI::PyCall_NoArg<Mantid::PythonAPI::PyAlgorithmBase*>::dispatch() PythonInterfaceFunctions.h:133 0x00007fffb80914cb 12 Mantid::PythonAPI::PyAlgorithmCallback::clone() PyAlgorithmWrapper.cpp:50 0x00007fffb80900fa 11 Mantid::API::AlgorithmFactoryImpl::createAlgorithm() AlgorithmFactory.cpp:409 0x00007ffff6c59b19 10 Mantid::API::AlgorithmFactoryImpl::create() AlgorithmFactory.cpp:87 0x00007ffff6c580b8 9 Mantid::API::AlgorithmManagerImpl::createUnmanaged() AlgorithmManager.cpp:42 0x00007ffff6c657af 8 Mantid::API::AlgorithmProxy::createConcreteAlg() AlgorithmProxy.cpp:177 0x00007ffff6c6bf5e 7 Mantid::API::AlgorithmProxy::executeAsyncImpl() AlgorithmProxy.cpp:212 0x00007ffff6c6c19e 6 Poco::ActiveRunnable<bool, Poco::Void, Mantid::API::AlgorithmProxy>::run() ActiveRunnable.h:85 0x00007ffff6c6e6a0 5 Poco::PooledThread::run() ThreadPool.cpp:203 0x00007fffee79e185 4 Poco::ThreadImpl::runnableEntry() Thread_POSIX.cpp:345 0x00007fffee79acbd 3 start_thread() pthread_create.c:304 0x00007fffecb13d8c 2 clone() clone.S:112 0x00007fffec85f04d 1 <symbol is not available> 0x0000000000000000
Perhaps we need some sort of lock to exclude two python "things" running at once? This will come up in LiveDataMonitoring, where we will have one thread running a python script for, say, a few seconds every few minutes. We want to be able to run a python script when the live data script is NOT running; conversely, we need LiveData to wait until any script started by the user finishes.
Change History
comment:2 Changed 9 years ago by Janik Zikovsky
Note that I got a segfault with both the old and new python API's.
comment:4 Changed 9 years ago by Martyn Gigg
It should be possible to run two bits of python simultaneously, as long as the appropriate Python locks are in place, it does the switching itself. It seems notoriously difficult to get right inside MantidPlot for some reason. It has definitely worked in the past so something has changed. I'll take a look.
comment:5 Changed 8 years ago by Martyn Gigg
- Status changed from accepted to verify
- Resolution set to fixed
Fixed as part of #5006
comment:6 Changed 8 years ago by Roman Tolchenov
- Status changed from verify to verifying
- Tester set to Roman Tolchenov