Ticket #1524 (closed: fixed)

Opened 10 years ago

Last modified 5 years ago

CRASH: Seg-fault with SimpleRebin in MantidPlot only.

Reported by: Janik Zikovsky Owned by: Russell Taylor
Priority: major Milestone: Iteration 26
Component: Mantid Keywords:
Cc: 2zr@… Blocked By:
Blocking: Tester: Peter Peterson

Description

I am getting a semi-reproducible segfault in MantidPlot with the following steps:

  1. Load PG3_732 neutron event data.
  2. AlignDetectors in the same event workspace
  3. DiffractionFocussing, same WS
  4. Rebin: 0, 1e-3, 3.0; same WS
  5. Display data
  6. Plot all 3 spectra
  7. Rebin again: 1, 1e-6, 1.2. Sometimes this segfaults right away, sometimes I have to rebin a couple more times before it segfaults.

I reproduced this in the release but I am usually in a debug MantidPlot+libraries build. This cannot be reproduced in a test (as the stack trace will show, the segfault occurs in MantidPlot code)

This has been observed by 3 different people with varying degrees of difficulty (sometimes it takes many tries before getting a segfault) but all of them were on Ubuntu; this needs testing under Windows and Mac.

Stack trace:

Thread [1] (Suspended: Signal 'SIGSEGV' received. Description: Segmentation fault.)	
	70 MantidQwtData::x() /home/janik/Code/Mantid/Code/qtiplot/qtiplot/src/Mantid/MantidCurve.cpp:377 0x000000000096c6c7	
	69 QwtPlotCurve::drawSteps(QPainter*, QwtScaleMap const&, QwtScaleMap const&, int, int) const()  0x00007ffff759ab52	
	68 QwtPlotCurve::draw(QPainter*, QwtScaleMap const&, QwtScaleMap const&, int, int) const()  0x00007ffff7598eb2	
	67 MantidCurve::draw() /home/janik/Code/Mantid/Code/qtiplot/qtiplot/src/Mantid/MantidCurve.cpp:163 0x000000000096ad52	
	66 QwtPlot::drawItems(QPainter*, QRect const&, QwtScaleMap const*, QwtPlotPrintFilter const&) const()  0x00007ffff7594960	
	65 Plot::drawItems() /home/janik/Code/Mantid/Code/qtiplot/qtiplot/src/Plot.cpp:223 0x000000000082294f	
	64 QwtPlot::drawCanvas()  0x00007ffff7594aba	
	63 QwtPlotCanvas::drawCanvas()  0x00007ffff75ada34	
	62 QwtPlotCanvas::drawContents()  0x00007ffff75adb86	
	61 QwtPlotCanvas::paintEvent()  0x00007ffff75add6f	
	60 QWidget::event()  0x00007ffff2b1e7a0	
	59 QFrame::event()  0x00007ffff2e7a2a6	
	58 QApplicationPrivate::notify_helper()  0x00007ffff2acfefc	
	57 QApplication::notify()  0x00007ffff2ad71ce	
	56 MantidApplication::notify() /home/janik/Code/Mantid/Code/qtiplot/qtiplot/src/Mantid/MantidApplication.cpp:23 0x00000000008f3af7	
	55 QCoreApplication::notifyInternal()  0x00007ffff2321c2c	
	54 QWidgetPrivate::drawWidget()  0x00007ffff2b25b93	
	53 QWidgetPrivate::paintSiblingsRecursive()  0x00007ffff2b262f0	
	52 QWidgetPrivate::paintSiblingsRecursive()  0x00007ffff2b26204	
	51 QWidgetPrivate::drawWidget()  0x00007ffff2b25803	
	50 QWidgetPrivate::paintSiblingsRecursive()  0x00007ffff2b262f0	
	49 QWidgetPrivate::drawWidget()  0x00007ffff2b25803	
	48 QWidgetPrivate::paintSiblingsRecursive()  0x00007ffff2b262f0	
	47 QWidgetPrivate::drawWidget()  0x00007ffff2b25803	
	46 QWidgetPrivate::paintSiblingsRecursive()  0x00007ffff2b262f0	
	45 QWidgetPrivate::drawWidget()  0x00007ffff2b25803	
	44 QWidgetPrivate::paintSiblingsRecursive()  0x00007ffff2b262f0	
	43 QWidgetPrivate::drawWidget()  0x00007ffff2b25803	
	42 QWidgetPrivate::paintSiblingsRecursive()  0x00007ffff2b262f0	
	41 QWidgetPrivate::drawWidget()  0x00007ffff2b25803	
	40 QWidgetPrivate::paintSiblingsRecursive()  0x00007ffff2b262f0	
	39 QWidgetPrivate::drawWidget()  0x00007ffff2b25803	
	38 QWidgetPrivate::paintSiblingsRecursive()  0x00007ffff2b262f0	
	37 QWidgetPrivate::drawWidget()  0x00007ffff2b25803	
	36 <symbol is not available  0x00007ffff2c97e1e	
	35 QWidgetPrivate::syncBackingStore()  0x00007ffff2b17fa0	
	34 QWidget::event()  0x00007ffff2b1e5b8	
	33 QMainWindow::event()  0x00007ffff2e949db	
	32 QApplicationPrivate::notify_helper()  0x00007ffff2acfefc	
	31 QApplication::notify()  0x00007ffff2ad71ce	
	30 MantidApplication::notify() /home/janik/Code/Mantid/Code/qtiplot/qtiplot/src/Mantid/MantidApplication.cpp:23 0x00000000008f3af7	
	29 QCoreApplication::notifyInternal()  0x00007ffff2321c2c	
	28 <symbol is not available  0x00007ffff2c95317	
	27 <symbol is not available  0x00007ffff2c984f6	
	26 QWidget::repaint()  0x00007ffff2b19f1b	
	25 QwtPlotCanvas::replot()  0x00007ffff75adea0	
	24 QwtPlot::replot()  0x00007ffff7594d44	
	23 MantidCurve::dataReset() /home/janik/Code/Mantid/Code/qtiplot/qtiplot/src/Mantid/MantidCurve.cpp:275 0x000000000096bae4	
	22 MantidCurve::qt_metacall() /home/janik/Code/Mantid/Code/qtiplot/tmp/qtiplot/debug/moc_MantidCurve.cpp:75 0x0000000000a82401	
	21 QMetaObject::activate()  0x00007ffff2336ddc	
	20 MantidCurve::resetData() /home/janik/Code/Mantid/Code/qtiplot/tmp/qtiplot/debug/moc_MantidCurve.cpp:88 0x0000000000a82483	
	19 MantidCurve::afterReplaceHandle() /home/janik/Code/Mantid/Code/qtiplot/qtiplot/src/Mantid/MantidCurve.cpp:281 0x000000000096bbb3	
	18 ObserverCallback::handleAfterReplace() /home/janik/Code/Mantid/Code/qtiplot/qtiplot/src/Mantid/WorkspaceObserver.cpp:16 0x000000000096cdac	
	17 ObserverCallback::qt_metacall() /home/janik/Code/Mantid/Code/qtiplot/tmp/qtiplot/debug/moc_WorkspaceObserver.cpp:83 0x0000000000a82af2	
	16 QObject::event()  0x00007ffff23310f9	
	15 QApplicationPrivate::notify_helper()  0x00007ffff2acfefc	
	14 QApplication::notify()  0x00007ffff2ad71ce	
	13 MantidApplication::notify() /home/janik/Code/Mantid/Code/qtiplot/qtiplot/src/Mantid/MantidApplication.cpp:23 0x00000000008f3af7	
	12 QCoreApplication::notifyInternal()  0x00007ffff2321c2c	
	11 QCoreApplicationPrivate::sendPostedEvents()  0x00007ffff232280a	
	10 <symbol is not available  0x00007ffff234a533	
	9 g_main_context_dispatch()  0x00007fffec5febce	
	8 <symbol is not available  0x00007fffec602598	
	7 g_main_context_iteration()  0x00007fffec6026c0	
	6 QEventDispatcherGlib::processEvents()  0x00007ffff234a1a6	
	5 <symbol is not available  0x00007ffff2b644be	
	4 QEventLoop::processEvents()  0x00007ffff2320532	
	3 QEventLoop::exec()  0x00007ffff2320904	
	2 QCoreApplication::exec()  0x00007ffff2322ab9	
	1 main() /home/janik/Code/Mantid/Code/qtiplot/qtiplot/src/main.cpp:175 0x000000000081d343	

Change History

comment:1 Changed 10 years ago by Janik Zikovsky

I should highlight that a plot must be on screen for the crash to occur. You can rebin reliably otherwise.

comment:2 Changed 10 years ago by Nick Draper

  • Owner set to Russell Taylor
  • Status changed from new to assigned

comment:3 Changed 10 years ago by Russell Taylor

  • Status changed from assigned to accepted
  • Component set to Mantid

comment:4 Changed 10 years ago by Russell Taylor

(In [7059]) Prevent crash if workspace from which a curve is plotted is replaced by a (smaller) workspace in which the plotted spectrum doesn't exist. Still trying to hunt down the specific problem reported in this ticket. Re #1524.

comment:5 Changed 10 years ago by Russell Taylor

(In [7136]) I think this solves it - so much searching, so little code-changing. The problem was that MantidQwtData holds a direct reference to the data vectors, which are invalidated if the workspace changes. This problem comes when multiple spectra from the same workspace are plotted and the data moves - e.g. if rebinning to a much larger number of bins. It tried to redraw the whole plot as soon as the first curve was updated to point to the new workspace but before subsequent plots had been. Adding the update command to the event queue instead of calling it directly means that the redraw doesn't happen until all data references have been updated. I think. The change to Graph.cpp was required - I don't see why this has to be a Blocking connection. Re #1524.

comment:6 Changed 10 years ago by Russell Taylor

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

comment:7 Changed 10 years ago by Martyn Gigg

  • Status changed from verify to verifying
  • Tester set to Martyn Gigg

comment:8 Changed 10 years ago by Martyn Gigg

  • Status changed from verifying to verify
  • Tester Martyn Gigg deleted

comment:9 Changed 10 years ago by Steve Williams

  • Status changed from verify to verifying
  • Tester set to Steve Williams

comment:10 Changed 10 years ago by Steve Williams

  • Status changed from verifying to reopened
  • Resolution fixed deleted

Doing the above Windows terminated my MantidPlot. I clicked "Debug" and got "Access violation reading location 0xfffff ...". I was running in release version 7190 (3/11/2010) and my memory usage went up in to 6GB (I only have 8GB), I believe in that last rebin step.

comment:11 Changed 10 years ago by Russell Taylor

  • Status changed from reopened to accepted

comment:12 Changed 10 years ago by Janik Zikovsky

(In [8120]) Refs #1524: Possible fix for segfaults when rebinning with a plot open.

comment:13 Changed 10 years ago by Russell Taylor

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

Appears OK on Windows, though can't be certain as it didn't always fail anyway. On red hat, problems had gone away with the previous change.

Anyway, this is what testing is for so place it there.......

comment:14 Changed 10 years ago by Peter Peterson

  • Status changed from verify to verifying
  • Tester changed from Steve Williams to Peter Peterson

comment:15 Changed 10 years ago by Peter Peterson

  • Status changed from verifying to closed

I keep rebinning with the plot up and I can't seem to crash it. Bug fixed.

comment:16 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 2371

Note: See TracTickets for help on using tickets.