This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 416673 - [Workbench] Corrupted workbench.xmi file causes silent Eclipse exit
Summary: [Workbench] Corrupted workbench.xmi file causes silent Eclipse exit
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3.1   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: 4.4 RC1   Edit
Assignee: Platform UI Triaged CLA
QA Contact: Paul Webster CLA
URL:
Whiteboard:
Keywords:
: 433750 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-09-05 18:48 EDT by Terry Parker CLA
Modified: 2015-11-23 14:48 EST (History)
9 users (show)

See Also:
emoffatt: review+


Attachments
workbench.xmi file that loads with no children windows (333.37 KB, text/x-xmi)
2013-09-05 18:48 EDT, Terry Parker CLA
no flags Details
Log file for when attempting to load the workbench.xmi file (4.51 KB, text/plain)
2013-09-11 10:59 EDT, Terry Parker CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Terry Parker CLA 2013-09-05 18:48:55 EDT
Created attachment 235213 [details]
workbench.xmi file that loads with no children windows

When attempting to restore the previous workbench state, the attached workbench.xmi file parses without errors, but the MApplication/ApplicationImpl object that is created contains a null "children" field. As a result, PartRenderingEngine.run() never calls createGui(), so Eclipse immediately exits (with a slew of error messages from early startup plug-ins that expect the workbench to have been created).

I'm not sure if this is a case of corrupted model data or just a bug in serializing it back in from the workbench.xmi file, but as a fallback for any serialization problems, ResourceHandler. loadMostRecentModel() (near line 206) can check not only for whether the resource loading returned null, but also whether the returned resource has a valid MApplication.  If the MApplication is not valid, it could fall back to loading from the application definition instance, and log the problem.
Comment 1 Terry Parker CLA 2013-09-10 11:52:34 EDT
Ping. Does validating the reloaded workbench state and discarding it if it is invalid seem reasonable?
Comment 2 Dani Megert CLA 2013-09-11 03:45:48 EDT
Is there something in the .log? Bug 410273 looks related.
Comment 3 Terry Parker CLA 2013-09-11 10:59:40 EDT
Created attachment 235390 [details]
Log file for when attempting to load the workbench.xmi file
Comment 4 Terry Parker CLA 2013-09-11 11:05:30 EDT
The two bugs do not appear to be related.  The workbench.xmi file attached to that bug contains a top-level "<children xsi:type="basic:TrimmedWindow"...>" tag, which for some reason is missing from the workbench.xmi file attached to this bug. I don't have any additional information as to what state Eclipse was in when it failed to properly serialize out the children windows, so I guess this bug can only address more graceful recovery when such a problem occurs.
Comment 5 Sergey Prigogin CLA 2013-09-11 19:10:27 EDT
(In reply to Terry Parker from comment #4)
Another option would be to add asserts and/or logging to the code that writes to workbench.xmi to get closer to the root cause of the problem.
Comment 6 Paul Webster CLA 2013-09-12 17:08:56 EDT
To make it more interesting, eclipse is supposed to support a headless workbench (no child windows).

PW
Comment 7 Lars Vogel CLA 2013-09-13 09:41:11 EDT
See Bug 323075 for headless mode.
Comment 8 Lars Vogel CLA 2014-04-28 14:01:35 EDT
(In reply to Terry Parker from comment #1)
> Ping. Does validating the reloaded workbench state and discarding it if it
> is invalid seem reasonable?

Yes. Could you provide a Gerrit review for it?
Comment 9 Terry Parker CLA 2014-05-01 17:28:39 EDT
(In reply to Lars Vogel from comment #8)
> (In reply to Terry Parker from comment #1)
> > Ping. Does validating the reloaded workbench state and discarding it if it
> > is invalid seem reasonable?
> 
> Yes. Could you provide a Gerrit review for it?

Done. https://git.eclipse.org/r/#/c/25853
Comment 10 Eric Moffatt CLA 2014-05-09 11:02:33 EDT
Committed:

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=e37da30b63cdd33dcf30eb6a5be12657b14a6fd0

As I commented on Gerrit..."Belt *and* suspenders, nice"...Thanks Terry !

BTW, Paul's going to add some guard code to trap whenever we get into this state in case it ever happens again so we can figure out why...
Comment 11 Paul Webster CLA 2014-05-09 11:27:57 EDT
Log when it happens:  https://git.eclipse.org/r/26298

Eric, could you please review this?
PW
Comment 12 Eric Moffatt CLA 2014-05-09 14:19:32 EDT
Committed:

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=47f11c69bdb654009053bd19d70c54b8b6d908ca

Only nit is that we don't unsubscribe the event but I realize that the Workbench's lifecycle matches that of the app...
Comment 13 Paul Benedict CLA 2014-05-09 15:55:10 EDT
Could this also be the fix to Bug 381555?
Comment 14 Paul Webster CLA 2014-05-09 16:01:48 EDT
(In reply to Paul Benedict from comment #13)
> Could this also be the fix to Bug 381555?

This can probably help with bug 381555, but it's not addressing the underlying cause, it's just trying to prevent a model with no windows from being saved and a model with no windows from killing the startup.

But if the model has even one window, it won't guard against anything in it that's corrupt or suspect.

PW
Comment 15 Dani Megert CLA 2014-05-12 07:17:07 EDT
Verified in I20140511-2000.
Comment 16 Dani Megert CLA 2014-06-30 09:06:20 EDT
*** Bug 418328 has been marked as a duplicate of this bug. ***
Comment 17 Dani Megert CLA 2014-06-30 09:08:07 EDT
*** Bug 433750 has been marked as a duplicate of this bug. ***
Comment 18 Thomas Schindl CLA 2015-03-25 14:23:04 EDT
(In reply to Eric Moffatt from comment #10)
> Committed:
> 
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/
> ?id=e37da30b63cdd33dcf30eb6a5be12657b14a6fd0
> 
> As I commented on Gerrit..."Belt *and* suspenders, nice"...Thanks Terry !
> 
> BTW, Paul's going to add some guard code to trap whenever we get into this
> state in case it ever happens again so we can figure out why...

This commit got in a regression - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=463125
Comment 19 Markus Keller CLA 2015-11-23 14:48:51 EST
This fix has been backported, see bug 482162 comment 5.