Project: Eclipse_Platform_UI
Bug 257167 Shutdown takes too long
Reported: 2008-12-02 05:11:54 | Status: resolved fixed

I20081127-0900 When I shut down my development workspace (most of the SDK from CVS) after working a few hours with it, I always get a progress dialog that reports "Saving Workspace." for a long time. After a day, it needs about a minute to finish. After working for more than a day, I sometimes have to wait for 3-5 minutes until Eclipse is finally closed. During the delay, I notice heavy disk activity. Stacktraces look like the one below (always in BucketTree.internalAccept(..) inside HistoryStore2.clean(..)). YourKit revealed that most of the time is burnt in - Bucket.load(String, File, boolean) > FileInputStream(File), and in - File.listFiles(). I don't know exactly why this cleanup takes so long, but I would expect that after the "Workspace save interval" from Preferences > General > Workspace (5min), nothing should have to be done any more on shutdown (otherwise, we would also lose that data when the workspace crashes). A problem could be this commented line from HistoryStore2.addState(..): // currentBucket.save(); "ModalContext" prio=6 tid=0x28ee2800 nid=0x964 runnable [0x2a0cf000..0x2a0cfb94] java.lang.Thread.State: RUNNABLE at java.io.WinNTFileSystem.$$YJP$$list(Native Method) at java.io.WinNTFileSystem.list(WinNTFileSystem.java) at java.io.File.list(File.java:973) at java.io.File.listFiles(File.java:1051) at org.eclipse.core.internal.localstore.BucketTree.internalAccept(BucketTree.java:102) at org.eclipse.core.internal.localstore.BucketTree.internalAccept(BucketTree.java:107) at org.eclipse.core.internal.localstore.BucketTree.internalAccept(BucketTree.java:107) at org.eclipse.core.internal.localstore.BucketTree.internalAccept(BucketTree.java:107) at org.eclipse.core.internal.localstore.BucketTree.internalAccept(BucketTree.java:107) at org.eclipse.core.internal.localstore.BucketTree.internalAccept(BucketTree.java:107) at org.eclipse.core.internal.localstore.BucketTree.accept(BucketTree.java:71) at org.eclipse.core.internal.localstore.HistoryStore2.clean(HistoryStore2.java:155) - locked <0x0eb9b000> (a org.eclipse.core.internal.localstore.HistoryStore2) at org.eclipse.core.internal.resources.SaveManager.save(SaveManager.java:1012) at org.eclipse.core.internal.resources.Workspace.save(Workspace.java:1827) at org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor$3.run(IDEWorkbenchAdvisor.java:388) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

Files changed in fix:
bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEWorkbenchAdvisor.java bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEWorkbenchMessages.java