Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 61581 - [Workbench] NPE on startup
Summary: [Workbench] NPE on startup
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux-GTK
: P1 major (vote)
Target Milestone: 3.0 RC1   Edit
Assignee: Stefan Xenos CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 61585 65867 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-05-10 09:18 EDT by DJ Houghton CLA
Modified: 2006-04-14 15:45 EDT (History)
5 users (show)

See Also:


Attachments
log file (3.80 KB, text/plain)
2004-05-10 09:18 EDT, DJ Houghton CLA
no flags Details
Additional assertions for premature disposals (13.62 KB, patch)
2004-05-10 15:49 EDT, Stefan Xenos CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description DJ Houghton CLA 2004-05-10 09:18:04 EDT
build 0506-0200
linux-gtk

Not sure if its related to bug 56816 or bug 58042. Stack traces are a little
different.

I upgraded my dev to this build and started. I shutdown and got an error saying
that there were problems storing the workbench state. (nothing in the console or
log) I rebooted my machine. On the next startup I got the following stack trace
in the console and all my perspectives and customizations were reset.

Will attach log file.
Comment 1 DJ Houghton CLA 2004-05-10 09:18:31 EDT
Created attachment 10446 [details]
log file
Comment 2 Stefan Xenos CLA 2004-05-10 11:10:24 EDT
This doesn't seem to be a duplicate.
Comment 3 Stefan Xenos CLA 2004-05-10 14:23:51 EDT
It seems that the presentation's control is being disposed prior to
StackPresentation.dispose() being called. This will cause all sorts of
unpleasant leaks.

I added some Assert statements to check for this case, and discovered that it is
happening all over the place (suddenly, many of the test suites started
failing). This is probably causing all sorts of seemingly unrelated problems
(widget disposed errors, NPEs, etc.) due to callbacks getting sent to disposed
presentation objects.

Increasing severity and priority.
Comment 4 Stefan Xenos CLA 2004-05-10 14:27:01 EDT
CC'ing Nick.
Comment 5 Stefan Xenos CLA 2004-05-10 15:49:15 EDT
Created attachment 10468 [details]
Additional assertions for premature disposals

This patch adds assertions for premature disposal of presentation widgets. This
causes a whole slew of test failures.
Comment 6 Stefan Xenos CLA 2004-05-10 17:09:50 EDT
Looks like this isn't as severe as I feared. It seems that EditorSashContainer
is simply maintaining two independent lists of children and they're losing
synch. This means the problem only applies to Editors.

(Nick, thanks for all your help on this one.)
Comment 7 Stefan Xenos CLA 2004-05-20 14:27:42 EDT
This appears to be a bug in our error handling code. It should only happen if
something else throws an exception during startup... it is still important, but
can be deferred until after M9.
Comment 8 Ines Khelifi CLA 2004-05-26 10:20:56 EDT
This bug might be a duplicate of bug 61585 (or vice versa). The stack traces are
similar.
We do not have reproducible steps, but as you pointed out, it does look like an
error handling issue.
Comment 9 Ines Khelifi CLA 2004-05-26 10:24:08 EDT
*** Bug 61585 has been marked as a duplicate of this bug. ***
Comment 10 Stefan Xenos CLA 2004-05-26 20:27:13 EDT
Here's the stack trace:

at
org.eclipse.ui.internal.presentations.BasicStackPresentation.layout(BasicStackPresentation.java:616)
	at
org.eclipse.ui.internal.presentations.BasicStackPresentation.setControlSize(BasicStackPresentation.java:650)
	at
org.eclipse.ui.internal.presentations.BasicStackPresentation.selectPart(BasicStackPresentation.java:798)
	at
org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:666)
	at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:649)
	at org.eclipse.ui.internal.EditorWorkbook.setSelection(EditorWorkbook.java:131)
	at org.eclipse.ui.internal.PartStack.updateContainerVisibleTab(PartStack.java:768)
	at org.eclipse.ui.internal.PartStack.createControl(PartStack.java:272)
	at org.eclipse.ui.internal.EditorWorkbook.createControl(EditorWorkbook.java:122)
	at
org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:392)
	at org.eclipse.ui.internal.EditorArea.createControl(EditorArea.java:344)
	at
org.eclipse.ui.internal.PartSashContainer.createControl(PartSashContainer.java:392)
	at
org.eclipse.ui.internal.PerspectivePresentation.activate(PerspectivePresentation.java:156)
	at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:641)
	at org.eclipse.ui.internal.WorkbenchPage.onActivate(WorkbenchPage.java:1983)
	at org.eclipse.ui.internal.WorkbenchWindow$6.run(WorkbenchWindow.java:1879)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:84)
	at org.eclipse.ui.internal.WorkbenchWindow.setActivePage(WorkbenchWindow.java:1866)
	at org.eclipse.ui.internal.WorkbenchWindow.restoreState(WorkbenchWindow.java:1435)
	at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1206)
	at org.eclipse.ui.internal.Workbench.access$10(Workbench.java:1173)
	at org.eclipse.ui.internal.Workbench$13.run(Workbench.java:1084)
	at
org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:604)
	at org.eclipse.core.runtime.Platform.run(Platform.java:545)
	at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1017)
	at
org.eclipse.ui.internal.WorkbenchConfigurer.restoreState(WorkbenchConfigurer.java:167)
	at
org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:648)
	at org.eclipse.ui.internal.Workbench.init(Workbench.java:807)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1301)
Comment 11 Stefan Xenos CLA 2004-05-27 14:39:36 EDT
Reading my own comments above, it's not clear what the problem is. Here's more
info for the curious:

1. Presentation objects are currently not able to deal with their widgets being
disposed before their public dispose() method is called. They will leak
listeners if this happens, and those listeners will throw exceptions.

2. EditorStack is never being disposed (due to comment 6), so the presentation's
dispose() method never gets called.

The easiest way to reproduce this leak is if an exception is thrown on shutdown
and WorkbenchWindow.hardClose needs to destroy its widgets in its finally block,
without running the nornmal cleanup code.

Comment 12 Stefan Xenos CLA 2004-05-28 09:28:09 EDT
Okay... issue 1 has been fixed in head.

Issue 2 is a duplicate of bug 59571.

Therefore, the NPE should no longer occur but there is still a resource leak.
Note: I never figured out how to reproduce this through the UI, but if you
programatically dispose a composite that contains a DefaultPartPresentation,
everything gets cleaned up correctly.
Comment 13 Stefan Xenos CLA 2004-05-28 09:33:52 EDT
Note: you can test that the new disposal code is running by running the test
suites and putting a conditional breakpoint inside
DefaultPartPresentation.widgetDisposed that only triggers when this instanceof
DefaultEditorPresentation. Due to bug 59571, the test suites will always dispose
the editor presentation by blowing away its widgets. It should be possible to
verify:

1. DefaultPartPresentation.dispose() is not on the stack (this is not correct
behavior, but it is the case that would have caused problems)
2. All the listeners are being removed 
3. No exceptions are thrown

Comment 14 Tod Creasey CLA 2006-04-14 15:45:14 EDT
*** Bug 65867 has been marked as a duplicate of this bug. ***