Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 323162

Summary: RuntimeException in a Widget event handler can cause IDE to 'lock up'
Product: [Eclipse Project] Platform Reporter: James Blackburn <jamesblackburn+eclipse>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: akurtakov, eclipse.felipe
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:

Description James Blackburn CLA 2010-08-19 11:34:45 EDT
We had a user experience an IDE 'lock up'.  In fact a component had gone wrong causing everything else to stop working.

The error log was filled with:

java.lang.NullPointerException
	at com.ibm.rational.clearcase.ui.view.TextDiffMerge.getPane(TextDiffMerge.java:177)
	at com.ibm.rational.clearcase.ui.view.TextDiffMerge.getDiffs(TextDiffMerge.java:151)
	at com.ibm.rational.clearcase.ui.view.MacroViewRuler$1.paintControl(MacroViewRuler.java:84)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:223)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1282)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1267)
	at org.eclipse.swt.widgets.Control.gtk_expose_event(Control.java:2781)
	at org.eclipse.swt.widgets.Composite.gtk_expose_event(Composite.java:701)
	at org.eclipse.swt.widgets.Canvas.gtk_expose_event(Canvas.java:167)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1739)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4794)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4372)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8163)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1239)
	at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
	at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2224)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3169)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)

As you can see the CCRC UI ruler contains a bug resulting in a NPE. It looks like this propagates all the way up to Workbench.runEventLoop.  As this occurs in the paint event no other controls get painted and the IDE needs to be restarted.

Eclipse is resilient to failure of individual components, and it seems wise that it should be resilient in this case too.  This is especially important as this 3rd party code is closed and getting timely fixes is impossible.

If instead the RuntimeException was caught & logged in TypedListener this issue could be mitigated and the user could save work and restart cleanly.
Comment 1 Felipe Heidrich CLA 2010-08-20 14:25:56 EDT
Do you have steps to reproduce the problem ?
What version of Eclipse/SWT are you running ?

SWT will stop invoking callbacks when there is a pending exception.

The right thing to do here is the fix the NPE in the component where it happens.
Comment 2 James Blackburn CLA 2010-08-20 16:14:27 EDT
Not sure what you mean... The exception has been thrown inline by the callback preventing all other widgets from repaiting. As far as i can tell the stack unwinds all the way up to the run event loop which prevents all other UI elements from bring redrawn.  This is using eclipse 3.6. 

Completely agree the NPE should be fixed. I've file a PMR with IBM rational and it'll be months (if ever) before it's fixed. 

It seems that swt should/could be more resiliet to failures in 3rd party code, as a failure like this breaks the whole IDE.
Comment 3 Alexander Kurtakov CLA 2018-10-19 09:02:31 EDT
No action in years. Closing the bug. Please reopen (or better a new bug) with concrete example and proposal if you still face it.