View Issue Details

IDProjectCategoryView StatusLast Update
0001832Slicer4Core: Base Codepublic2017-06-07 23:27
Reporterpieper Assigned Topieper  
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status closedResolutionfixed 
Product Version 
Target VersionSlicer 4.3.0Fixed in VersionSlicer 4.3.0 
Summary0001832: add try/catch around render calls and event processing
Description

Reminder to Jc of our discussion on the na-mic engineering tcon today:

To more gracefully handle out-of-memory circumstances that can lead to catastrophic data loss, it would be good to catch as many out of memory errors as possible with a dialog box that notifies the user that the operation could not be performed and that they should probably save their data and restart the application.

We noted that in the DTI tutorials it was possible for users to crash slicer by setting the glyph spacing to a small setting that generates too much details to be successfully rendered. As of slicer 4.1 this leads to a crash.

One of the safest places to catch a crash is around calls to Render() at the vtk level - by design these calls 'pull' the pipeline and may cause generation of lots of data, as in the glyphing case. But these pipeline executions are 'read only' from a mrml perspective, so even if they fail the application is not really in a bad state and the user could save their data and/or carry on working.

The other place to catch the exceptions would be in the processEvent method of the slicer app. This may be more problematic from the application point of view because an logic slot may have failed in a way that leaves the mrml scene ill-formed or could leave Qt in a bad state. Even in this case though it would be better for the user to have the option to save their data rather than just having the application exit.

TagsNo tags attached.

Relationships

related to 0003209 closedpieper Crash importing the directory 
has duplicate 0002004 closedpieper Crash when using editor undo in 32-bit Slicer 
related to 0002184 closedpieper Crash - Identify and Remove Islands effect 
related to 0003140 closedpieper improve exception handling 

Activities

lassoan

lassoan

2012-05-09 06:16

developer   ~0004224

Out-of-memory issues are mostly happen on 32-bit systems. We could ship the 32-bit Slicer versions with "Prefer Executable CLIs" enabled by default and/or make it much harder to download the 32-bit version of Slicer (make it clear for the user that the performance of 32-bit version is inferior and should be used only for very small data sets).

In 64-bit executables out-of-memory issue should happen only because of software bugs. So, I think instead of trying to recover from crashes it would be more important to make it easier to find the bugs that cause the crashes by making it easy for users to submit rich information about the crash. A solution could be to write logs to file and whenever Slicer crashes create a zip package that contains these logs, the ini file, the Slicer version, etc. and ask the user to send this package along with his error report.

pieper

pieper

2012-05-11 08:19

administrator   ~0004325

I agree that 32 bit system are the most likely to have memory issues - and setting Prefer Executable CLIs by default on 32 bit systems is a great idea but won't prevent all out-of-memory situations.

There are other issues that could happen in Renders or event processing so adding the catch is probably good practice. Automatically capturing error information would be great.

I don't think we should try to recover from these error conditions, but giving the user some control is desirable, for example, so they can save data if they need to.

jcfr

jcfr

2012-06-19 10:00

administrator   ~0004857

Last edited: 2012-06-19 10:00

On windows, address space is shared between user(50%) and kernel (50%). It's possible to change these settings. See http://support.microsoft.com/kb/316739

pieper

pieper

2013-08-09 06:21

administrator   ~0009437

Added exception handling in r22273

jcfr

jcfr

2013-08-28 12:14

administrator   ~0009669

Note: The message box should be shown only when Slicer is in "interactive mode". I was thinking to add a new set of methods to "qSlicerCoreApplication": interactive()/setInteractive() ... depending on the value of this property, message would be displayed or not.

We could also probably use a ctkMessageBox that would be smart enough to either popup + log message or just log message.

jcfr

jcfr

2014-03-06 05:22

administrator   ~0011174

Closing resolved issues that have not been updated in more than 3 months

Related Changesets

Slicer: 2145-support-for-installing-extension-from-file 8c53d089

2013-08-09 10:12:42

pieper

Details Diff
BUG: 0001832 0003140 0003209 avoid crashes by catching exceptions

Some libraries and systems throw exceptions, but Qt's default
event processing does not catch them[1]. For example, slicer
could crash when ctkDICOMItem is pointed to a file that does
not exist. Wrapping event processing in try/catch should handle
other conditions, like out of memory exceptions thrown from
inside render operations (e.g. due to overly complex glyph
rendering).

[1] http://qt-project.org/doc/qt-4.8/exceptionsafety.html

http://stackoverflow.com/questions/10665655/how-to-log-uncatched-exceptions-of-a-qapplication

git-svn-id: http://svn.slicer.org/Slicer4/trunk@22273 3bd1e089-480b-0410-8dfb-8563597acbee
mod - Base/QTGUI/qSlicerApplication.cxx Diff File
mod - Base/QTGUI/qSlicerApplication.h Diff File

Issue History

Date Modified Username Field Change
2012-03-22 13:31 pieper New Issue
2012-03-22 13:31 pieper Status new => assigned
2012-03-22 13:31 pieper Assigned To => jcfr
2012-05-09 05:45 pieper Relationship added related to 0002004
2012-05-09 06:06 pieper Relationship replaced has duplicate 0002004
2012-05-09 06:16 lassoan Note Added: 0004224
2012-05-11 07:49 jcfr Target Version => Slicer 4.3.0
2012-05-11 08:19 pieper Note Added: 0004325
2012-06-01 11:56 jcfr Assigned To jcfr => crmullin
2012-06-16 11:55 pieper Relationship added related to 0002184
2012-06-19 10:00 jcfr Note Added: 0004857
2012-06-19 10:00 jcfr Note Edited: 0004857
2012-09-14 12:20 jcfr Assigned To crmullin => sankhesh
2013-06-03 03:56 pieper Relationship added related to 0003140
2013-06-03 05:15 jcfr Assigned To sankhesh =>
2013-06-03 05:16 jcfr Assigned To => jcfr
2013-08-09 06:20 pieper Relationship added related to 0003209
2013-08-09 06:21 pieper Assigned To jcfr => pieper
2013-08-09 06:21 pieper Note Added: 0009437
2013-08-09 06:21 pieper Status assigned => resolved
2013-08-09 06:21 pieper Fixed in Version => Slicer 4.3.0
2013-08-09 06:21 pieper Resolution open => fixed
2013-08-28 12:14 jcfr Note Added: 0009669
2014-03-06 05:22 jcfr Note Added: 0011174
2014-03-06 05:23 jcfr Status resolved => closed
2017-06-07 23:27 pieper Changeset attached => Slicer 2145-support-for-installing-extension-from-file 8c53d089