Ticket #4516 (closed: fixed)

Opened 9 years ago

Last modified 5 years ago

PlusMD crashes Mantid in conjuction with SliceViewer

Reported by: Alex Buts Owned by: Janik Zikovsky
Priority: critical Milestone: Release 2.1
Component: Mantid Keywords:
Cc: zikovskyjl@… Blocked By: #4641
Blocking: Tester: Roman Tolchenov

Description (last modified by Janik Zikovsky) (diff)

The script below crashes release Mantid under windows with 100% probability on one of PlusMD operation (rows 17,18,19) after 2-13 iterations.

This happens only when SliceViewer row (20) is enabled.

Does not happen for Debug Mantid though. I suspect that it is because it does not brings SliceViewer up.

WS_Name = 'CNCS_7860_event'
Load(Filename='CNCS_7860_event.nxs',OutputWorkspace=WS_Name )
ConvertUnits(InputWorkspace=WS_Name,OutputWorkspace=WS_Name,Target='DeltaE',EMode='Direct',EFixed='3')
Rebin(InputWorkspace='CNCS_7860_event',OutputWorkspace=WS_Name,Params='-1,0.05,3',PreserveEvents=True)
SetUB(Workspace=WS_Name,a='5.4165',b='5.4165',c='5.4165',u='1,0,0',v='0,1,0')
#AddSampleLog(Workspace=WS_Name,LogName='Ei',LogText='3',LogType='Number')

for i in range(0,20,1):
	TWS='MD1'
	for i in range(0,20,5):
		CloneWorkspace(InputWorkspace=WS_Name,OutputWorkspace='preMDpart'+str(i))
		AddSampleLog(Workspace='preMDpart'+str(i),LogName='Psi',LogText=str(i),LogType='Number Series')
		SetGoniometer(Workspace='preMDpart'+str(i),Axis0='Psi,0,1,0,1')
		ConvertToMDEvents(InputWorkspace='preMDpart'+str(i),OutputWorkspace='MDpart'+str(i),QDimensions='QhQkQl',u="1,0,0",v="0,1,0",dEAnalysisMode='Direct',MinValues='-2,-2,-3,-1',MaxValues='2,2,3,3',SplitInto="20,20,1,1")
	PlusMD(LHSWorkspace='MDpart0',RHSWorkspace='MDpart5',OutputWorkspace=TWS)
	PlusMD(LHSWorkspace=TWS,RHSWorkspace='MDpart10',OutputWorkspace=TWS)
	PlusMD(LHSWorkspace=TWS,RHSWorkspace='MDpart15',OutputWorkspace=TWS)
	plotSlice(TWS, xydim=["Q1","Q2"],slicepoint=[0,0] )

Change History

comment:1 Changed 9 years ago by Janik Zikovsky

  • Status changed from new to accepted
  • Owner set to Janik Zikovsky

comment:2 Changed 9 years ago by Janik Zikovsky

  • Description modified (diff)

comment:3 Changed 9 years ago by Janik Zikovsky

  • Description modified (diff)

Reproduced segfault with the given modifications. Seems that with a large number of windows open, some are still processing (because of the workspace observer notification) while a new PlusMD call is modifying the underlying workspace. Will need some sort of locking mechanism.

comment:4 Changed 9 years ago by Janik Zikovsky

  • Milestone changed from Iteration 32 to Iteration 33

See ticket #4554 addressing the underlying issue (in iteration33)

comment:5 Changed 9 years ago by Janik Zikovsky

Refs #4516: fix crash with SliceViewer during long draw operation

It is still possible to get a crash in QwtPlotSpectrogram::draw() but it is hard to reproduce. Read-locking QwtRasterData::value() would be too slow.

Changeset: 9de3648874e5154ac1366dafa0d7eeb8e52ed8ee

comment:6 Changed 9 years ago by Janik Zikovsky

Thread [1] (Suspended: Signal 'SIGSEGV' received. Description: Segmentation fault.)	
	98 <symbol is not available> 0x0000000010753000	
	97 Mantid::MDEvents::MDGridBox<Mantid::MDEvents::MDEvent<4ul>, 4ul>::getBoxAtCoord() MDGridBox.cpp:713 0x00007fffd3e59b73	
	96 Mantid::MDEvents::MDGridBox<Mantid::MDEvents::MDEvent<4ul>, 4ul>::getBoxAtCoord() MDGridBox.cpp:713 0x00007fffd3e59b73	
	95 Mantid::MDEvents::MDGridBox<Mantid::MDEvents::MDEvent<4ul>, 4ul>::getBoxAtCoord() MDGridBox.cpp:713 0x00007fffd3e59b73	
	94 Mantid::MDEvents::MDGridBox<Mantid::MDEvents::MDEvent<4ul>, 4ul>::getBoxAtCoord() MDGridBox.cpp:713 0x00007fffd3e59b73	
	93 Mantid::MDEvents::MDGridBox<Mantid::MDEvents::MDEvent<4ul>, 4ul>::getBoxAtCoord() MDGridBox.cpp:713 0x00007fffd3e59b73	
	92 Mantid::MDEvents::MDGridBox<Mantid::MDEvents::MDEvent<4ul>, 4ul>::getBoxAtCoord() MDGridBox.cpp:713 0x00007fffd3e59b73	
	91 Mantid::MDEvents::MDEventWorkspace<Mantid::MDEvents::MDEvent<4ul>, 4ul>::getSignalAtCoord() MDEventWorkspace.cpp:230 0x00007fffd3e1b39c	
	90 MantidQt::SliceViewer::QwtRasterDataMD::value() QwtRasterDataMD.cpp:83 0x00007ffff6251277	
	89 QwtPlotSpectrogram::renderImage(QwtScaleMap const&, QwtScaleMap const&, QRectF const&) const()  0x00007ffff3663637	
	88 QwtPlotRasterItem::draw(QPainter*, QwtScaleMap const&, QwtScaleMap const&, QRect const&) const()  0x00007ffff366d4de	
	87 QwtPlotSpectrogram::draw(QPainter*, QwtScaleMap const&, QwtScaleMap const&, QRect const&) const()  0x00007ffff3664315	
	86 QwtPlot::drawItems(QPainter*, QRect const&, QwtScaleMap const*, QwtPlotPrintFilter const&) const()  0x00007ffff3655fd0	
	85 QwtPlot::drawCanvas()  0x00007ffff365612a	
	84 QwtPlotCanvas::drawCanvas()  0x00007ffff366e024	
	83 QwtPlotCanvas::drawContents()  0x00007ffff366e2d6	
	82 QwtPlotCanvas::paintEvent()  0x00007ffff366e4bf	
	81 QWidget::event()  0x00007ffff46ffc7a	
	80 QFrame::event()  0x00007ffff4ab2156	
	79 QApplicationPrivate::notify_helper()  0x00007ffff46ae9f4	
	78 QApplication::notify()  0x00007ffff46b33ba	
	77 MantidApplication::notify() MantidApplication.cpp:24 0x000000000094330d	
	76 QCoreApplication::notifyInternal()  0x00007ffff3a0d49c	
	75 QWidgetPrivate::drawWidget()  0x00007ffff46fcacd	
	74 <symbol is not available> 0x00007ffff48c398f	
	73 QWidgetPrivate::syncBackingStore()  0x00007ffff46f2f60	
	72 QWidget::event()  0x00007ffff4700194	
	71 QMainWindow::event()  0x00007ffff4acbc0b	
	70 QApplicationPrivate::notify_helper()  0x00007ffff46ae9f4	
	69 QApplication::notify()  0x00007ffff46b33ba	
	68 MantidApplication::notify() MantidApplication.cpp:24 0x000000000094330d	
	67 QCoreApplication::notifyInternal()  0x00007ffff3a0d49c	
	66 <symbol is not available> 0x00007ffff48c0618	
	65 QWidget::repaint()  0x00007ffff46f27f8	
	64 QwtPlotCanvas::replot()  0x00007ffff366e65a	
	63 QwtPlot::replot()  0x00007ffff36563b4	
	62 MantidQt::SliceViewer::CustomMagnifier::rescale() CustomTools.h:81 0x00007ffff625bd1a	
	61 QwtMagnifier::eventFilter()  0x00007ffff36392bd	
	60 QCoreApplicationPrivate::sendThroughObjectEventFilters()  0x00007ffff3a0d627	
	59 QApplicationPrivate::notify_helper()  0x00007ffff46ae9c1	
	58 QApplication::notify()  0x00007ffff46b37cb	
	57 MantidApplication::notify() MantidApplication.cpp:24 0x000000000094330d	
	56 QCoreApplication::notifyInternal()  0x00007ffff3a0d49c	
	55 <symbol is not available> 0x00007ffff471be42	
	54 <symbol is not available> 0x00007ffff4730e4d	
	53 QApplication::x11ProcessEvent()  0x00007ffff472fab7	
	52 <symbol is not available> 0x00007ffff4758842	
	51 g_main_context_dispatch()  0x00007fffebf50bcd	
	50 <symbol is not available> 0x00007fffebf513a8	
	49 g_main_context_iteration()  0x00007fffebf51639	
	48 QEventDispatcherGlib::processEvents()  0x00007ffff3a383ef	
	47 <symbol is not available> 0x00007ffff47584de	
	46 QCoreApplication::processEvents()  0x00007ffff3a1103f	
	45 MantidUI::executeAlgorithmAsync() MantidUI.cpp:1565 0x000000000097abf9	
	44 MantidUI::runAlgorithmAsync_PyCallback() MantidUI.cpp:1092 0x0000000000977520	
	43 meth_MantidUI_runAlgorithmAsync_PyCallback() sip_qtipart0.cpp:2013 0x00000000009ffd3e	
	42 call_function() ceval.c:4013 0x00007ffff2b83630	
	41 PyEval_EvalFrameEx() ceval.c:2666 0x00007ffff2b83630	
	40 fast_function() ceval.c:4099 0x00007ffff2b83f8c	
	39 call_function() ceval.c:4034 0x00007ffff2b83f8c	
	38 PyEval_EvalFrameEx() ceval.c:2666 0x00007ffff2b83f8c	
	37 PyEval_EvalCodeEx() ceval.c:3253 0x00007ffff2b8527d	
	36 fast_function() ceval.c:4109 0x00007ffff2b8328d	
	35 call_function() ceval.c:4034 0x00007ffff2b8328d	
	34 PyEval_EvalFrameEx() ceval.c:2666 0x00007ffff2b8328d	
	33 PyEval_EvalCodeEx() ceval.c:3253 0x00007ffff2b8527d	
	32 PyEval_EvalCode() ceval.c:667 0x00007ffff2b85392	
	31 PythonScript::executeScript() PythonScript.cpp:432 0x0000000000863623	
	30 PythonScript::exec() PythonScript.cpp:369 0x0000000000863236	
	29 ScriptManagerWidget::runScriptCode() ScriptManagerWidget.cpp:609 0x0000000000889259	
	28 ScriptManagerWidget::execute() ScriptManagerWidget.cpp:512 0x0000000000888d6e	
	27 ScriptManagerWidget::qt_metacall() moc_ScriptManagerWidget.cxx:165 0x0000000000a499e3	
	26 QMetaObject::activate()  0x00007ffff3a225f8	
	25 QAction::activated()  0x00007ffff46a8291	
	24 QAction::activate()  0x00007ffff46a8325	
	23 QAction::event()  0x00007ffff46a847f	
	22 QApplicationPrivate::notify_helper()  0x00007ffff46ae9f4	
	21 QApplication::notify()  0x00007ffff46b33ba	
	20 MantidApplication::notify() MantidApplication.cpp:24 0x000000000094330d	
	19 QCoreApplication::notifyInternal()  0x00007ffff3a0d49c	
	18 <symbol is not available> 0x00007ffff46e0bf0	
	17 <symbol is not available> 0x00007ffff46e2098	
	16 QApplication::notify()  0x00007ffff46b4d25	
	15 MantidApplication::notify() MantidApplication.cpp:24 0x000000000094330d	
	14 QCoreApplication::notifyInternal()  0x00007ffff3a0d49c	
	13 <symbol is not available> 0x00007ffff47543d9	
	12 <symbol is not available> 0x00007ffff4754856	
	11 QApplication::x11ProcessEvent()  0x00007ffff472f72f	
	10 <symbol is not available> 0x00007ffff4758842	
	9 g_main_context_dispatch()  0x00007fffebf50bcd	
	8 <symbol is not available> 0x00007fffebf513a8	
	7 g_main_context_iteration()  0x00007fffebf51639	
	6 QEventDispatcherGlib::processEvents()  0x00007ffff3a383ef	
	5 <symbol is not available> 0x00007ffff47584de	
	4 QEventLoop::processEvents()  0x00007ffff3a0c882	
	3 QEventLoop::exec()  0x00007ffff3a0cabc	
	2 QCoreApplication::exec()  0x00007ffff3a10ecb	
	1 main() main.cpp:218 0x0000000000a5dcfb	

comment:7 Changed 9 years ago by Janik Zikovsky

  • Blocked By 4641 added

comment:8 Changed 9 years ago by Janik Zikovsky

Refs #4641 thread-safe QwtPlot replacement

Also refs #4516, using this safeqwtPlot in SliceViewer looks to make it impossible to segfault

Changeset: 26737997bcb8a92a02026290440a266dff22cd0d

comment:9 Changed 9 years ago by Janik Zikovsky

  • Status changed from accepted to verify
  • Resolution set to fixed

I can no longer segfault SliceViewer even when really hammering it (lots of windows, running a loop in the background).

The "safe" plot does not seem to have affected performance except if you are viewing while doing processing on the same workspace in the background.

Note to testers: iteration33 branch only.

comment:10 Changed 8 years ago by Roman Tolchenov

  • Status changed from verify to verifying
  • Tester set to Roman Tolchenov

comment:11 Changed 8 years ago by Roman Tolchenov

  • Status changed from verifying to closed

Ran the above script with some modifications on windows. Didn't crash.

comment:12 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 5363

Note: See TracTickets for help on using tickets.