Bug 3128 - [resources] Could not restart the workspace after an OutOfMemoryError (1GKEZ5V)
Summary: [resources] Could not restart the workspace after an OutOfMemoryError (1GKEZ5V)
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.0   Edit
Hardware: All Windows 2000
: P2 normal (vote)
Target Milestone: 3.0   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 14123 18008 23932 27774 28826 29431 33138 34321 35201 36626 39131 40516 42954 45216 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-10-10 22:49 EDT by Olivier Thomann CLA
Modified: 2003-10-20 13:54 EDT (History)
18 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2001-10-10 22:49:57 EDT
org.eclipse.core.internal.resources.ResourceException()[567]: java.io.EOFException
	at java.io.DataInputStream.readUTF(DataInputStream.java(Compiled Code))
	at java.io.DataInputStream.readUTF(DataInputStream.java(Compiled Code))
	at org.eclipse.core.internal.dtree.DataTreeReader.readNode(DataTreeReader.java(Compiled Code))
	at org.eclipse.core.internal.dtree.DataTreeReader.readTree(DataTreeReader.java:121)
	at org.eclipse.core.internal.watson.ElementTreeReaderImpl_1.readDelta(ElementTreeReaderImpl_1.java:39)
	at org.eclipse.core.internal.watson.ElementTreeReader.readDelta(ElementTreeReader.java:87)
	at org.eclipse.core.internal.watson.ElementTreeReaderImpl_1.readDeltaChain(ElementTreeReaderImpl_1.java:75)
	at org.eclipse.core.internal.watson.ElementTreeReader.readDeltaChain(ElementTreeReader.java:97)
	at org.eclipse.core.internal.resources.WorkspaceTreeReader.readTrees(WorkspaceTreeReader.java:210)
	at org.eclipse.core.internal.resources.WorkspaceTreeReader.readTree(WorkspaceTreeReader.java:149)
	at org.eclipse.core.internal.resources.SaveManager.restoreTree(SaveManager.java:703)
	at org.eclipse.core.internal.resources.SaveManager.restore(SaveManager.java:487)
	at org.eclipse.core.internal.resources.SaveManager.startup(SaveManager.java:988)
	at org.eclipse.core.internal.resources.Workspace.startup(Workspace.java:1311)
	at org.eclipse.core.internal.resources.Workspace.open(Workspace.java:1122)
	at org.eclipse.core.resources.ResourcesPlugin.startup(ResourcesPlugin.java:141)
	at org.eclipse.core.internal.plugins.PluginDescriptor$1.run(PluginDescriptor.java:647)
	at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:758)
	at org.eclipse.core.internal.plugins.PluginDescriptor.internalDoPluginActivation(PluginDescriptor.java:659)
	at org.eclipse.core.internal.plugins.PluginDescriptor.doPluginActivation(PluginDescriptor.java:204)
	at org.eclipse.core.internal.plugins.PluginClassLoader.activatePlugin(PluginClassLoader.java:52)
	at org.eclipse.core.internal.plugins.PluginClassLoader.findClassParentsSelf(PluginClassLoader.java:128)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLClassLoader.java:624)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.access$0(DelegatingURLClassLoader.java:618)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader$DelegateLoader.loadClass(DelegatingURLClassLoader.java:60)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.findClassPrerequisites(DelegatingURLClassLoader.java:359)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLClassLoader.java:632)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLClassLoader.java:604)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:257)
	at java.lang.Class.newInstance0(Native Method)
	at java.lang.Class.newInstance(Class.java:254)
	at org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension(PluginDescriptor.java:156)
	at org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension(PluginDescriptor.java:185)
	at org.eclipse.core.internal.plugins.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:97)
	at org.eclipse.core.internal.runtime.InternalPlatform.loaderGetRunnable(InternalPlatform.java:423)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.internal.boot.InternalBootLoader.getRunnable(InternalBootLoader.java:468)
	at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:811)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:151)
	at org.eclipse.core.launcher.Main.run(Main.java:433)
	at org.eclipse.core.launcher.Main.main(Main.java:306)
	4 org.eclipse.core.resources 567 Problems reading workspace tree.
java.io.EOFException
	at java.io.DataInputStream.readUTF(DataInputStream.java(Compiled Code))
	at java.io.DataInputStream.readUTF(DataInputStream.java(Compiled Code))
	at org.eclipse.core.internal.dtree.DataTreeReader.readNode(DataTreeReader.java(Compiled Code))
	at org.eclipse.core.internal.dtree.DataTreeReader.readTree(DataTreeReader.java:121)
	at org.eclipse.core.internal.watson.ElementTreeReaderImpl_1.readDelta(ElementTreeReaderImpl_1.java:39)
	at org.eclipse.core.internal.watson.ElementTreeReader.readDelta(ElementTreeReader.java:87)
	at org.eclipse.core.internal.watson.ElementTreeReaderImpl_1.readDeltaChain(ElementTreeReaderImpl_1.java:75)
	at org.eclipse.core.internal.watson.ElementTreeReader.readDeltaChain(ElementTreeReader.java:97)
	at org.eclipse.core.internal.resources.WorkspaceTreeReader.readTrees(WorkspaceTreeReader.java:210)
	at org.eclipse.core.internal.resources.WorkspaceTreeReader.readTree(WorkspaceTreeReader.java:149)
	at org.eclipse.core.internal.resources.SaveManager.restoreTree(SaveManager.java:703)
	at org.eclipse.core.internal.resources.SaveManager.restore(SaveManager.java:487)
	at org.eclipse.core.internal.resources.SaveManager.startup(SaveManager.java:988)
	at org.eclipse.core.internal.resources.Workspace.startup(Workspace.java:1311)
	at org.eclipse.core.internal.resources.Workspace.open(Workspace.java:1122)
	at org.eclipse.core.resources.ResourcesPlugin.startup(ResourcesPlugin.java:141)
	at org.eclipse.core.internal.plugins.PluginDescriptor$1.run(PluginDescriptor.java:647)
	at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:758)
	at org.eclipse.core.internal.plugins.PluginDescriptor.internalDoPluginActivation(PluginDescriptor.java:659)
	at org.eclipse.core.internal.plugins.PluginDescriptor.doPluginActivation(PluginDescriptor.java:204)
	at org.eclipse.core.internal.plugins.PluginClassLoader.activatePlugin(PluginClassLoader.java:52)
	at org.eclipse.core.internal.plugins.PluginClassLoader.findClassParentsSelf(PluginClassLoader.java:128)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLClassLoader.java:624)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.access$0(DelegatingURLClassLoader.java:618)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader$DelegateLoader.loadClass(DelegatingURLClassLoader.java:60)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.findClassPrerequisites(DelegatingURLClassLoader.java:359)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLClassLoader.java:632)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLClassLoader.java:604)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:257)
	at java.lang.Class.newInstance0(Native Method)
	at java.lang.Class.newInstance(Class.java:254)
	at org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension(PluginDescriptor.java:156)
	at org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension(PluginDescriptor.java:185)
	at org.eclipse.core.internal.plugins.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:97)
	at org.eclipse.core.internal.runtime.InternalPlatform.loaderGetRunnable(InternalPlatform.java:423)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.internal.boot.InternalBootLoader.getRunnable(InternalBootLoader.java:468)
	at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:811)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:151)
	at org.eclipse.core.launcher.Main.run(Main.java:433)
	at org.eclipse.core.launcher.Main.main(Main.java:306)
Log: Fri Sep 21 13:33:06 EDT 2001
4 org.eclipse.core.runtime 2 Plugin org.eclipse.ui was unable to instantiate class org.eclipse.ui.internal.Workbench.
org.eclipse.core.internal.boot.DelegatingLoaderException: org.eclipse.core.runtime.CoreException: Problems encountered starting up plug-in: org.eclipse.core.resources.
	at org.eclipse.core.internal.plugins.PluginDescriptor.internalDoPluginActivation(PluginDescriptor.java:661)
	at org.eclipse.core.internal.plugins.PluginDescriptor.doPluginActivation(PluginDescriptor.java:204)
	at org.eclipse.core.internal.plugins.PluginClassLoader.activatePlugin(PluginClassLoader.java:52)
	at org.eclipse.core.internal.plugins.PluginClassLoader.findClassParentsSelf(PluginClassLoader.java:128)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLClassLoader.java:624)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.access$0(DelegatingURLClassLoader.java:618)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader$DelegateLoader.loadClass(DelegatingURLClassLoader.java:60)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.findClassPrerequisites(DelegatingURLClassLoader.java:359)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLClassLoader.java:632)
	at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLClassLoader.java:604)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:257)
	at java.lang.Class.newInstance0(Native Method)
	at java.lang.Class.newInstance(Class.java:254)
	at org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension(PluginDescriptor.java:156)
	at org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension(PluginDescriptor.java:185)
	at org.eclipse.core.internal.plugins.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:97)
	at org.eclipse.core.internal.runtime.InternalPlatform.loaderGetRunnable(InternalPlatform.java:423)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.internal.boot.InternalBootLoader.getRunnable(InternalBootLoader.java:468)
	at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:811)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:151)
	at org.eclipse.core.launcher.Main.run(Main.java:433)
	at org.eclipse.core.launcher.Main.main(Main.java:306)

NOTES:

OT (21/09/2001 2:06:51 PM)
	workspace.zip is available on Q:\viper\problem_reports\1GKEZ5V

JohnA (9/24/2001 10:38:14 AM)
	The core .tree file has been corrupted.  If an OutOfMemoryError occurred as the workbench
	was being saved, the file on disk will be corrupt.

	His tree file is 123.tree, but the safetable file says tree=124.  So if it failed while trying to
	write tree 124, shouldn't it revert to trying to load the old 123.tree instead?

RTP (10/1/01 9:55:41 AM)
	Sounds like a good solution for this case. Should look at how much we can trust in this
numbering sequence.
Comment 1 DJ Houghton CLA 2001-10-24 06:45:16 EDT
PRODUCT VERSION:
	135

Comment 2 DJ Houghton CLA 2002-04-11 12:39:09 EDT
Was this work done by the recent work involving better failure case when 
starting the workspace with bogus files? John, please investigate.
Comment 3 John Arthorne CLA 2002-04-11 13:32:23 EDT
No, I did not fix the corrupt tree file case.  The reasoning is partly that if 
the .tree file is corrupt, you're dead.  We could create a new tree, but the 
user would be left with an empty workspace... perhaps this is better than not 
starting at all.  Ideally we could use the safetable to grab the previously 
saved tree, if available (ie., always leave around current tree plus previous 
tree).  But then, what happens if the safetable is corrupt?
Comment 4 John Arthorne CLA 2002-04-25 10:57:22 EDT
*** Bug 14123 has been marked as a duplicate of this bug. ***
Comment 5 DJ Houghton CLA 2002-05-23 11:54:25 EDT
Investigate options for robust startup for bogus safe-table file and tree.
Comment 6 John Arthorne CLA 2002-05-28 17:53:01 EDT
*** Bug 18008 has been marked as a duplicate of this bug. ***
Comment 7 John Arthorne CLA 2002-09-23 13:06:09 EDT
*** Bug 23932 has been marked as a duplicate of this bug. ***
Comment 8 Sonia Dimitrov CLA 2002-12-11 10:30:14 EST
*** Bug 27774 has been marked as a duplicate of this bug. ***
Comment 9 Sonia Dimitrov CLA 2002-12-30 12:49:18 EST
*** Bug 28826 has been marked as a duplicate of this bug. ***
Comment 10 Sonia Dimitrov CLA 2003-01-14 08:52:00 EST
*** Bug 29431 has been marked as a duplicate of this bug. ***
Comment 11 Andrew McCullough CLA 2003-02-10 17:41:54 EST
There is a thread on the newsgroup about this, and it seems pretty clear from 
this bug report that this is not easy to solve at its root.  

Perhaps as a workaround, core.resources could provide a "Recover Projects" 
facility that would read an old workspace's .projects directory and rebuild 
those projects in the new workspace.  They would still lose other metadata, but 
most people can probably live with resetting preferences.  This is an 
alternative to "File-->Import-->Existing Project" many times. 

Obviously a better solution would be for each plugin to have the ability to 
recover what metadata it can from another workspace, but that is well beyond 
the scope of this bug. 

-Andrew
Comment 12 Omry Yadan CLA 2003-02-11 01:22:20 EST
What about saving a checksup of key files (MD5 could do)
to detect that they are not what they are supposed to be?
and if this is indeed the case, just recover whatever possible?
Comment 13 DJ Houghton CLA 2003-02-11 18:25:45 EST
We actually have started a tool which does what you describe above. You point 
it at a corrupt workspace and it tries to rebuild it the best it can. Reviewing 
this code and releasing this tool is on the "to-do" list...
Comment 14 Omry Yadan CLA 2003-02-12 01:13:37 EST
The 'new' point in my comment (or maybe not new), is a way to detect a 
corrupted workspace automatically.
for this, you need support from the core (to keep a the checksum every time it 
saves).
Comment 15 Eric Rizzo CLA 2003-02-14 09:57:53 EST
I think there are a few things that might be done to make this less traumatic
for the user if he happens to stumble upon an OOM error (which seem to be the
most common cause of workspace corruptions, based on the bug reports listed above).

1) Making shutdown as tight as possible, not requiring persisting of so much
critical data. I don't know the internals, but perhaps more of the info can be
persisted "as you go" instead of waiting for workbench shutdown. Possibly in the
background. The goal should be to get shutdown as small as possible, so VM
failure at that point is not so tragic.

2) A fallback to "last known good" configuration (as has been discussed in this
and other bugs) could be implemented in Eclipse startup. The process to recover
a workspace that has bad .tree and/or .snap files is pretty simple to fix
without losing a lot of data, but it should be built in as much as possible.

3) In lieu of the above, a little more helpful logging pointing to the exact
file(s) that are corrupt is needed, as well as some prominent documentation
about how to recover from a corrupt workspace. It should not be so difficult for
users to learn what to do to get back to work.
Comment 16 DJ Houghton CLA 2003-03-10 16:50:27 EST
*** Bug 34321 has been marked as a duplicate of this bug. ***
Comment 17 DJ Houghton CLA 2003-03-10 16:52:26 EST
Increasing priority so this bug doesn't get lost. (like it already seems to 
have for 2.1)

For RC3 investigate any short-term fixes to help the user when encountering 
this problem.

Find more definate solution for 2.2.
Comment 18 DJ Houghton CLA 2003-03-12 15:20:16 EST
The problem is that the master table is saved in the finally block of 
SaveManager.save();

So this looks like what is happening:

- start saving workspace tree (1.tree is ok and on disk, we are saving 2.tree)
- get an exception saving 2.tree so this file is now only half there
- run the finally block
- removes 1.tree
- writes master table which has reference to 2.tree

So on startup we read the master table, it tells us to read 2.tree and then we 
blow up. Ouch.

We need to refactor the code so if we have a failure when saving, we do not 
delete any files. We should ensure that all the old files are there so we can 
at least try to use them to bring the platform up.

Unfortuanatly too risky to make changes in this area for 2.1.
Comment 19 DJ Houghton CLA 2003-03-18 09:44:17 EST
*** Bug 35201 has been marked as a duplicate of this bug. ***
Comment 20 Adam Kiezun CLA 2003-03-18 09:57:18 EST
>Increasing priority so this bug doesn't get lost. (like it already seems to 
>have for 2.1)

hmm, bugs of this severity should not simply get lost
Comment 21 John Arthorne CLA 2003-04-21 10:37:54 EDT
*** Bug 36626 has been marked as a duplicate of this bug. ***
Comment 22 John Arthorne CLA 2003-04-23 12:47:48 EDT
Fixed.

Cleanup code has been moved out of the finally block.  This means cleanup of
unused files will not happen on abormal save termination, so the valid tree file
will not be deleted.  Also moved the code to commit the master table immediately
after writing the tree, otherwise an error between those operations would result
in a master table pointing to the wrong tree. 

Here is the revised timeline from DJ's comment:

- start saving workspace tree (1.tree is ok and on disk, we are saving 2.tree)
- get an exception saving 2.tree so this file is now only half there
- abort the save immediately

Now, the master table still has a reference to 1.tree, and we have 1.tree and
2.tree on disk.  On next startup, 1.tree will be read, and on next shutdown,
2.tree will be overwritten with the next valid save state.
Comment 23 John Arthorne CLA 2003-06-19 18:34:38 EDT
*** Bug 33138 has been marked as a duplicate of this bug. ***
Comment 24 John Arthorne CLA 2003-06-19 18:36:02 EDT
*** Bug 39131 has been marked as a duplicate of this bug. ***
Comment 25 John Arthorne CLA 2003-07-22 10:32:57 EDT
*** Bug 40516 has been marked as a duplicate of this bug. ***
Comment 26 John Arthorne CLA 2003-09-11 12:07:33 EDT
*** Bug 42954 has been marked as a duplicate of this bug. ***
Comment 27 John Arthorne CLA 2003-10-20 13:54:00 EDT
*** Bug 45216 has been marked as a duplicate of this bug. ***