Bug 537757 - [touchpoint] Remove touchpoint action fails with IllegalArgumentException
Summary: [touchpoint] Remove touchpoint action fails with IllegalArgumentException
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 4.7.0 Oxygen   Edit
Hardware: PC Windows All
: P3 normal (vote)
Target Milestone: 4.21 M1   Edit
Assignee: Todor Boev CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-07 08:09 EDT by Miroslav Ivanov CLA
Modified: 2021-10-14 05:10 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Miroslav Ivanov CLA 2018-08-07 08:09:32 EDT
Result:

P2 provisioning operation sporadically fails due to an IllegalArgumentException in touchpoint action 'remove'.

Stack trace:

--------------------------------------------------------------------------------
!ENTRY org.eclipse.equinox.p2.engine 4 4 2018-02-23 10:09:06.475
!MESSAGE An error occurred while configuring the installed items
!SUBENTRY 1 org.eclipse.equinox.p2.engine 4 0 2018-02-23 10:09:06.476
!MESSAGE session context was:(profile=core, phase=org.eclipse.equinox.internal.p2.engine.phases.Configure, operand=null --> [R]<installable-unit>, action=org.eclipse.equinox.internal.p2.touchpoint.natives.actions.RemoveAction).
!SUBENTRY 1 org.eclipse.equinox.p2.engine 4 0 2018-02-23 10:09:06.476
!MESSAGE Directory is not empty: <path-to-an-existing-directory>
!STACK 0
java.lang.IllegalArgumentException: Directory is not empty: <path-to-an-existing-directory>
	at org.eclipse.equinox.internal.p2.touchpoint.natives.BackupStore.backupDirectory(BackupStore.java:443)
	at org.eclipse.equinox.internal.p2.touchpoint.natives.BackupStore.backup(BackupStore.java:232)
	at org.eclipse.equinox.internal.p2.touchpoint.natives.BackupStore.backupAll(BackupStore.java:344)
	at org.eclipse.equinox.internal.p2.touchpoint.natives.LazyBackupStore.backupAll(LazyBackupStore.java:79)
	at org.eclipse.equinox.internal.p2.touchpoint.natives.actions.RemoveAction.execute(RemoveAction.java:37)
	at org.eclipse.equinox.internal.p2.engine.ParameterizedProvisioningAction.execute(ParameterizedProvisioningAction.java:39)
	at org.eclipse.equinox.internal.p2.engine.Phase.mainPerform(Phase.java:184)
	at org.eclipse.equinox.internal.p2.engine.Phase.perform(Phase.java:96)
	at org.eclipse.equinox.internal.p2.engine.PhaseSet.perform(PhaseSet.java:47)
	at org.eclipse.equinox.internal.p2.engine.Engine.perform(Engine.java:77)
	at org.eclipse.equinox.internal.p2.engine.Engine.perform(Engine.java:45)
	at org.eclipse.equinox.internal.provisional.p2.director.PlanExecutionHelper.executePlan(PlanExecutionHelper.java:42)
	at org.eclipse.equinox.internal.provisional.p2.director.PlanExecutionHelper.executePlan(PlanExecutionHelper.java:24)
	at org.eclipse.equinox.internal.p2.director.app.DirectorApplication.executePlan(DirectorApplication.java:974)
	at org.eclipse.equinox.internal.p2.director.app.DirectorApplication.planAndExecute(DirectorApplication.java:967)
	at org.eclipse.equinox.internal.p2.director.app.DirectorApplication.performProvisioningActions(DirectorApplication.java:932)
	at org.eclipse.equinox.internal.p2.director.app.DirectorApplication.run(DirectorApplication.java:1307)
	at org.eclipse.equinox.internal.p2.director.app.DirectorApplication.start(DirectorApplication.java:1504)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
--------------------------------------------------------------------------------

Possible cause:

Most probably anti-virus is temporary blocking filesystem access for the process and java.io.File.exists() returns false (see https://bugs.java.com/bugdatabase/view_bug.do?bug_id=5003595), so 'file.delete()' on line https://github.com/eclipse/rt.equinox.p2/blob/3eca795499690a83a53e36eb38cf29fd9a6880ad/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/BackupStore.java#L281 is skipped.
Comment 1 Eclipse Genie CLA 2018-09-04 08:34:05 EDT
New Gerrit change created: https://git.eclipse.org/r/128634
Comment 3 Todor Boev CLA 2020-03-25 05:45:15 EDT
Re-opening the bug since the same instability began to re-occur in an environment where an antivirus software is enabled on the eclipse installation directory.

There are more file.delete() calls in BackupStore which are also potentially unstable.

One solution is to convert the file.delete() calls to a routine which re-tries to delete the file several times.

Also it may be good to replace the java.io.File operations in BackupStore with java.nio.file. The nio version is likely more stable or at least should not report bogus results the way File.exists() and File.delete() do.
Comment 4 Eclipse Genie CLA 2021-06-16 18:25:59 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/182079
Comment 5 Eclipse Genie CLA 2021-06-16 18:26:00 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/182081
Comment 6 Eclipse Genie CLA 2021-06-16 18:26:01 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/182080
Comment 7 Eclipse Genie CLA 2021-06-18 18:18:27 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/182197
Comment 8 Eclipse Genie CLA 2021-06-18 19:36:47 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/182198
Comment 9 Eclipse Genie CLA 2021-06-18 20:23:03 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/182199
Comment 10 Eclipse Genie CLA 2021-06-21 12:41:52 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/182314
Comment 11 Eclipse Genie CLA 2021-06-22 18:10:47 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/182370
Comment 12 Eclipse Genie CLA 2021-06-28 08:40:10 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/182539
Comment 13 Eclipse Genie CLA 2021-06-29 08:03:22 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/182583
Comment 14 Eclipse Genie CLA 2021-06-29 08:07:46 EDT
New Gerrit change created: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/182585
Comment 17 Ed Merks CLA 2021-07-01 01:06:10 EDT
FYI, these changes required me to make this change:

https://git.eclipse.org/c/oomph/org.eclipse.oomph.git/commit/?id=f87729807f7021fdc3425dc325213c87c6113652

The code there is apparently a workaround for

https://bugs.eclipse.org/bugs/show_bug.cgi?id=427148

It was added for this:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=446432

So I think it's fine that the override will no longer kick in.  But note that it is specifically the backup/update of the *.exe that was a problem on Windows and specifically when the original *.exe was on a different device/drive as the backup store.
Comment 18 Todor Boev CLA 2021-07-05 06:26:59 EDT
It's a bit hard to follow the code you point to.
But I went to great lengths to preserve the in-place backup of eclipse.exe
Comment 19 Andrey Loskutov CLA 2021-10-14 05:10:55 EDT
(In reply to Eclipse Genie from comment #16)
> Gerrit change https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/182585 was
> merged to [master].
> Commit:
> http://git.eclipse.org/c/equinox/rt.equinox.p2.git/commit/
> ?id=a57a0ce4a6b964c35a6172f4c043d7bf6057c6dd

This commit caused regression on Windows, see bug 576506.