Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313489 - Plug-in import failed: could not delete files (JAR) / target out of sync
Summary: Plug-in import failed: could not delete files (JAR) / target out of sync
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 critical (vote)
Target Milestone: 3.7 M6   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 273809 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-05-19 05:20 EDT by Dani Megert CLA
Modified: 2011-03-22 07:35 EDT (History)
4 users (show)

See Also:


Attachments
Picture with out of sync dialog (16.34 KB, image/png)
2010-05-19 07:58 EDT, Dani Megert CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2010-05-19 05:20:23 EDT
N20100518-2000.

I've not seen that bug for quite some time but it's back now. Maybe someone (API tooling) again holds on to files?

After that my workspace was completely broken and it took me over an hour to get back to a working state.

I started the import right after starting with N20100518-2000.

To me it looks like the importer does this (just a guess):

1. delete projects
2. import projects

And if it fails somewhere in 1., it simply aborts instead of importing all projects that it deleted - leaving my workspace with many missing plug-ins.


!ENTRY org.eclipse.core.resources 4 273 2010-05-19 10:46:10.746
!MESSAGE Problems encountered while deleting resources.
!SUBENTRY 1 org.eclipse.core.resources 4 273 2010-05-19 10:46:10.746
!MESSAGE Could not delete 'C:\eclipse\workspaces\Development_HEAD\plugins\org.eclipse.core.jobs\org.eclipse.core.jobs_3.5.0.N20100511-2000.jar'.
!STACK 1
org.eclipse.core.runtime.CoreException: Problems encountered while deleting files.
	at org.eclipse.core.internal.filesystem.local.LocalFile.delete(LocalFile.java:125)
	at org.eclipse.core.internal.resources.ResourceTree.internalDeleteFile(ResourceTree.java:304)
	at org.eclipse.core.internal.resources.ResourceTree.internalDeleteProject(ResourceTree.java:384)
	at org.eclipse.core.internal.resources.ResourceTree.standardDeleteProject(ResourceTree.java:837)
	at org.eclipse.core.internal.resources.Resource.unprotectedDelete(Resource.java:1942)
	at org.eclipse.core.internal.resources.Resource.delete(Resource.java:786)
	at org.eclipse.core.internal.resources.Project.delete(Project.java:331)
	at org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation.deleteConflictingProjects(PluginImportOperation.java:270)
	at org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation.runInWorkspace(PluginImportOperation.java:129)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Contains: Could not delete: C:\eclipse\workspaces\Development_HEAD\plugins\org.eclipse.core.jobs\org.eclipse.core.jobs_3.5.0.N20100511-2000.jar.
!SUBENTRY 2 org.eclipse.core.filesystem 4 273 2010-05-19 10:46:10.746
!MESSAGE Problems encountered while deleting files.
!SUBENTRY 3 org.eclipse.core.filesystem 4 273 2010-05-19 10:46:10.746
!MESSAGE Could not delete: C:\eclipse\workspaces\Development_HEAD\plugins\org.eclipse.core.jobs\org.eclipse.core.jobs_3.5.0.N20100511-2000.jar.
!SUBENTRY 1 org.eclipse.core.resources 4 273 2010-05-19 10:46:10.746
!MESSAGE Could not delete 'C:\eclipse\workspaces\Development_HEAD\plugins\org.eclipse.core.jobs'.
Comment 1 Dani Megert CLA 2010-05-19 07:57:20 EDT
Looks like some very recent code changes cause this. Works fine when using N20100517-2000. So far I cannot constantly reproduce the import errors but what's very strange and reproducible is that it thinks the target platform is out of sync and I suspect that's also causing my bug:

1. start new workspace
2. check out 'org.eclipse.text' from CVS (HEAD) or import it from repository
3. exit
4. start
5. reload active target platform
==> it says it's out of sync!!! see attached picture

This works fine when using N20100517-2000.

Marking as blocker since there's definitely something fishy here.
Comment 2 Dani Megert CLA 2010-05-19 07:58:36 EDT
Created attachment 169093 [details]
Picture with out of sync dialog
Comment 3 Darin Wright CLA 2010-05-19 11:42:19 EDT
The changes in bug 312495 seem to have caused this problem. I have reverted those changes.
Comment 4 Darin Wright CLA 2010-05-19 16:06:13 EDT
The "in-synch" problems are addressed by reverting bug 312495. Removing blocking status.
Comment 5 Darin Wright CLA 2010-05-19 16:14:09 EDT
Dani, please try plug-in import with the next nightly or RC2 candidate to see if file deletion is still an issue.
Comment 6 Dani Megert CLA 2010-05-20 10:20:47 EDT
Import seems to work again. Thx!

But for 3.7 we really have to look at the code and make more stable:

1. First things to delete should be JARs because those are the ones that are often
   locked (at least that was my experience). If that fails we remember that 
   project and don't delete anything else of that project and continue with the 
   next project. This will leave the project in an old state but most likely in
   a state that allows the workspace to still compile.

2. As just said: we don't abort when the first deletion fails. This makes sure
   that we get to the import step and correctly replace the projects that got
   deleted before the first exception happened.

3. During import we ignore the projects remembered in 1.

4. At the end we report the errors along with the project(s) that could not be
   replaced.
Comment 7 Dani Megert CLA 2011-02-09 03:41:46 EST
Got this again and caused me more than an hour to repair my workspace:

!ENTRY org.eclipse.core.resources 4 273 2011-02-09 08:53:12.135
!MESSAGE Problems encountered while deleting resources.
!SUBENTRY 1 org.eclipse.core.resources 4 273 2011-02-09 08:53:12.135
!MESSAGE Could not delete 'C:\eclipse\workspaces\Development_HEAD\plugins\com.ibm.icu\com.ibm.icu_4.4.2.v20110115.jar'.
!STACK 1
org.eclipse.core.runtime.CoreException: Problems encountered while deleting files.
	at org.eclipse.core.internal.filesystem.local.LocalFile.delete(LocalFile.java:125)
	at org.eclipse.core.internal.resources.ResourceTree.internalDeleteFile(ResourceTree.java:304)
	at org.eclipse.core.internal.resources.ResourceTree.internalDeleteProject(ResourceTree.java:384)
	at org.eclipse.core.internal.resources.ResourceTree.standardDeleteProject(ResourceTree.java:837)
	at org.eclipse.core.internal.resources.Resource.unprotectedDelete(Resource.java:1946)
	at org.eclipse.core.internal.resources.Resource.delete(Resource.java:787)
	at org.eclipse.core.internal.resources.Project.delete(Project.java:344)
	at org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation.deleteConflictingProjects(PluginImportOperation.java:275)
	at org.eclipse.pde.internal.ui.wizards.imports.PluginImportOperation.runInWorkspace(PluginImportOperation.java:129)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 8 Dani Megert CLA 2011-02-10 10:53:58 EST
>To me it looks like the importer does this (just a guess):
>
>1. delete projects
>2. import projects
Yep, that's what happens :-(
Comment 9 Dani Megert CLA 2011-02-10 11:19:43 EST
Fixed in HEAD (PluginImportOperation.java, rev. 1.144).
Available in builds >= N20110210-2000.
Comment 10 Dani Megert CLA 2011-03-15 09:16:55 EDT
Verified in I20110310-1119.
Comment 11 Dani Megert CLA 2011-03-22 07:35:21 EDT
*** Bug 273809 has been marked as a duplicate of this bug. ***