Bug 514333 - Preferences store access can lead to unattended workspace location initialization
Summary: Preferences store access can lead to unattended workspace location initializa...
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Components (show other bugs)
Version: 3.8.2 Juno   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: Photon M3   Edit
Assignee: Andrey Loskutov CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 568726
  Show dependency tree
 
Reported: 2017-03-28 10:22 EDT by Andrey Loskutov CLA
Modified: 2022-04-22 14:13 EDT (History)
9 users (show)

See Also:


Attachments
example stack if using preferences service (21.10 KB, text/x-log)
2017-04-07 09:44 EDT, Andrey Loskutov CLA
no flags Details
example stack if using preference store (15.81 KB, text/x-log)
2017-04-07 09:46 EDT, Andrey Loskutov CLA
no flags Details
org.eclipse.equinox.p2.tests.AutomatedTests.txt (228.40 KB, text/plain)
2017-09-22 10:14 EDT, Andrey Loskutov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2017-03-28 10:22:05 EDT
Follow up on bug 514297 comment 5. 

A simple call to AbstractUIPlugin.getPreferenceStore() or simply to ScopedPreferenceStore() can lead to the workspace location silently set to the default one, ignoring location selected by the user in the workspace prompt and probably leading to other startup problems.

This is not acceptable behavior. We can't find this during the tests (because tests are always using -data argument) and we can't find it via code inspection (because calling the API in question is considered to be safe in general).

We should make sure that we can't *silently* initialize workspace to the default before the user confirms the workspace location prompt.

Related bugs also: bug 330320, bug 419940, bug 428977, bug 491850 and others I couldn't quickly find right now.

I have no solution right now...
Comment 1 Andrey Loskutov CLA 2017-03-28 12:00:49 EDT
Should we return null or throw some specific kind of exception in InstancePreferences.getBaseLocation() in case the workspace location is not known yet?

Whoever tries to access workspace preferences before we have the workspace instance should simply fail there, and NOT silently create and return some *default* workspace location.
Comment 2 Dani Megert CLA 2017-03-28 12:05:01 EDT
(In reply to Andrey Loskutov from comment #1)
> Should we return null or throw some specific kind of exception in
> InstancePreferences.getBaseLocation() in case the workspace location is not
> known yet?
> 
> Whoever tries to access workspace preferences before we have the workspace
> instance should simply fail there, and NOT silently create and return some
> *default* workspace location.

I'd prefer an exception.
Comment 3 Lars Vogel CLA 2017-03-28 12:12:59 EDT
+1 to Dani's opinion (exception)
Comment 4 Andrey Loskutov CLA 2017-03-29 05:25:38 EDT
This is a tricky issue.

DataArea.assertLocationInitialized() logic does not check if a location is set or not, and because EquinoxLocations by default initializes the data location with a *default* value,  DataArea.assertLocationInitialized() creates always a location from the default URL, and org.eclipse.core.internal.preferences.InstancePreferences.getBaseLocation() always able to return a path.

OK, one could think that we should simply put "-data @nodefault" value by default to the IDE eclipse.ini, but this will do even more harm! 

With "-data @nodefault" option EquinoxLocations creates a BasicLocation for instance data without the default value (good), but this leads to the problem that the InstancePreferences will simply work with an "empty" workspace location, even after user selects the workspace path (bad), and that plugins asking for the data *before* workspace is set will not see actual workspace settings for the rest of the session.

What we actually want is: if any client tries to access workspace preferences *before* the workspace location is set, it should receive some kind of exception and can decide what to do. In our case (bug 514297 for example) this will lead to the Eclipse throwing an exception with a very clear stack trace pointing to the place where the preferences were requested. IMHO this is much better then silently starting with a default workspace.

I think I have a patch proposal for Equinox, will submit in a moment. This will throw IllegalStateException on accessing the preference store before workspace location is set. To test it, the IDEWorkbenchPlugin should be reverted to commit fcf5b6385147db2f0266993950402082e8519d8b.

Unfortunately this patch conflicts with the promise of the AbstractUIPlugin.getPreferenceStore(): "If an error occurs reading the preference store, an empty preference store is quietly created, initialized with defaults, and returned."

So I'm not sure how to proceed now. Current state is bad, but breaking API contract is not good too.
Comment 5 Eclipse Genie CLA 2017-03-29 05:26:14 EDT
New Gerrit change created: https://git.eclipse.org/r/94032
Comment 6 Thomas Watson CLA 2017-03-29 08:53:23 EDT
What happens for cases where there is an RCP application that has no workspace chooser dialog?  Is it not reasonable that they would set the value osgi.instance.area.default in the config area and never explicitly set the Location URL?
Comment 7 Dani Megert CLA 2017-03-29 11:18:56 EDT
(In reply to Andrey Loskutov from comment #4)
> This is a tricky issue.

;-)
Comment 8 Andrey Loskutov CLA 2017-03-29 11:40:40 EDT
(In reply to Thomas Watson from comment #6)
> What happens for cases where there is an RCP application that has no
> workspace chooser dialog?  Is it not reasonable that they would set the
> value osgi.instance.area.default in the config area and never explicitly set
> the Location URL?

Yep, this is probably another issue with the patch (except that it breaks AbstractUIPlugin.getPreferenceStore() contract).

OK, let assume we will "undefine" osgi.instance.area.default value from our IDE config ini. Currently someone defines it like @user.home/workspace.

But then EquinoxLocations constructor by default sets this to 
defaultLocation = buildURL(new File(System.getProperty(PROP_USER_DIR), "workspace").getAbsolutePath(), true);

WHY? If we comment the lines out (I will push another patch for that), then we will have a nice (expected) exception on startup.
Comment 9 Eclipse Genie CLA 2017-03-29 11:41:30 EDT
New Gerrit change created: https://git.eclipse.org/r/94078
Comment 10 Andrey Loskutov CLA 2017-03-29 11:42:28 EDT
(In reply to Eclipse Genie from comment #9)
> New Gerrit change created: https://git.eclipse.org/r/94078

This patch should be used together with the *second* patch set from https://git.eclipse.org/r/#/c/94032/2.
Comment 11 Thomas Watson CLA 2017-03-29 13:54:06 EDT
(In reply to Andrey Loskutov from comment #8)
> (In reply to Thomas Watson from comment #6)
> > What happens for cases where there is an RCP application that has no
> > workspace chooser dialog?  Is it not reasonable that they would set the
> > value osgi.instance.area.default in the config area and never explicitly set
> > the Location URL?
> 
> Yep, this is probably another issue with the patch (except that it breaks
> AbstractUIPlugin.getPreferenceStore() contract).
> 
> OK, let assume we will "undefine" osgi.instance.area.default value from our
> IDE config ini. Currently someone defines it like @user.home/workspace.
> 
> But then EquinoxLocations constructor by default sets this to 
> defaultLocation = buildURL(new File(System.getProperty(PROP_USER_DIR),
> "workspace").getAbsolutePath(), true);
> 
> WHY? If we comment the lines out (I will push another patch for that), then
> we will have a nice (expected) exception on startup.

Coincidentally I just published a change from Mickael for bug 502220 that changes that "workspace" to be ${launcher name}-workspace.  Perhaps Mickael has a motivating use case for why the instance location should get a default even when one is not specified in the configuration.
Comment 12 Thomas Watson CLA 2017-03-29 14:06:01 EDT
> WHY? If we comment the lines out (I will push another patch for that), then
> we will have a nice (expected) exception on startup.

Looking back at the history of this it seems that it was done this way because the default workspace was always set for free way back.  See bug 62007.
Comment 13 Andrey Loskutov CLA 2017-03-29 14:13:33 EDT
(In reply to Thomas Watson from comment #12)
> > WHY? If we comment the lines out (I will push another patch for that), then
> > we will have a nice (expected) exception on startup.
> 
> Looking back at the history of this it seems that it was done this way
> because the default workspace was always set for free way back.  See bug
> 62007.

After reading through the bug 62004 I didn't get this, sorry, may be you have some concrete commit in mind? Thebug 62007 describes the special default variables to be introduced but lines I've commented out are basically setting  hard-coded default value for the instance locaton.
Comment 14 Thomas Watson CLA 2017-03-29 15:45:29 EDT
(In reply to Andrey Loskutov from comment #13)
> (In reply to Thomas Watson from comment #12)
> > > WHY? If we comment the lines out (I will push another patch for that), then
> > > we will have a nice (expected) exception on startup.
> > 
> > Looking back at the history of this it seems that it was done this way
> > because the default workspace was always set for free way back.  See bug
> > 62007.
> 
> After reading through the bug 62004 I didn't get this, sorry, may be you
> have some concrete commit in mind? Thebug 62007 describes the special
> default variables to be introduced but lines I've commented out are
> basically setting  hard-coded default value for the instance locaton.

Unfortunately some history got lost with renaming of Equinox internals.  You have to go back to the R3_9_maintenance branch to see the history of the LocationManager class where the EquinoxLocations class got much of its code and behavior:

http://git.eclipse.org/c/equinox/rt.equinox.framework.git/diff/?id=573bd5235d26f67af530bb1f5ae09aec95b463f5

eGit seems to show this commit in the history of the EquinoxLocations class, but command line git log and the web UI on the repo doesn't provide much help.
Comment 15 Andrey Loskutov CLA 2017-03-29 16:45:17 EDT
(In reply to Thomas Watson from comment #12)
> > WHY? If we comment the lines out (I will push another patch for that), then
> > we will have a nice (expected) exception on startup.
>  
> Looking back at the history of this it seems that it was done this way
> because the default workspace was always set for free way back.  See bug
> 62007.

Thomas, thanks to the pointer. In that sense, what do you think about new preference for osgi, which would say "explicit init only" for locations?
osgi.instance.area.init=explicit

Default value will be of course "implicit" to match our hisorical behavior. But if this is set in the config to "explicit", we will not use hard coded defaults in EquinoxLocations and so we will hard fail on any code trying to init the location which is not set explicitly.

If we add this to the SDK no clients schould be affected.

There is still the question of the AbstractUIPlugin.getPreferenceStore() contract but I think we can clarify its javadoc in the sense that *after* workspace location is set, the method will always return a properly initialized store, but may throw an IllegalStateException if the workspace location is not known yet and osgi.instance.area.init=explicit is set. I think this would make everyone happy and we will stay compatible.

WDYT?
Comment 16 Thomas Watson CLA 2017-03-30 09:03:11 EDT
(In reply to Andrey Loskutov from comment #15)
> WDYT?

Seems like a reasonable approach to me.
Comment 17 Andrey Loskutov CLA 2017-04-07 08:51:36 EDT
I've now tried different approaches how to pinpoint the problem. I think I've finally found one, which requires a system property set by the product and a tiny change in DataArea. Patches will follow in few moments, old patches are obsoleted now.
Comment 18 Thomas Watson CLA 2017-04-07 09:21:32 EDT
(In reply to Andrey Loskutov from comment #17)
> I've now tried different approaches how to pinpoint the problem. I think
> I've finally found one, which requires a system property set by the product
> and a tiny change in DataArea. Patches will follow in few moments, old
> patches are obsoleted now.

When you say system property I hope you mean configuration property set in the config.ini.  That is not entirely the same as a system property.
Comment 19 Eclipse Genie CLA 2017-04-07 09:28:30 EDT
New Gerrit change created: https://git.eclipse.org/r/94671
Comment 20 Andrey Loskutov CLA 2017-04-07 09:39:21 EDT
(In reply to Thomas Watson from comment #18)
> (In reply to Andrey Loskutov from comment #17)
> > I've now tried different approaches how to pinpoint the problem. I think
> > I've finally found one, which requires a system property set by the product
> > and a tiny change in DataArea. Patches will follow in few moments, old
> > patches are obsoleted now.
> 
> When you say system property I hope you mean configuration property set in
> the config.ini.  That is not entirely the same as a system property.

I meant a system property, see https://git.eclipse.org/r/94671. Why is this important? Do you mean someone could set the system property after startup but before the init of the DataArea? I'm not sure if and how I can access config property in org.eclipse.equinox.preferences and org.eclipse.equinox.common plugins, if you can point me to the API, I can change that.
Comment 21 Andrey Loskutov CLA 2017-04-07 09:44:43 EDT
Created attachment 267699 [details]
example stack if using preferences service

I've attached the example log produced by the patch and adding the code below to the begin of org.eclipse.ui.internal.ide.IDEWorkbenchPlugin.createProblemsViews()

IScopeContext[] contexts = new IScopeContext[] { InstanceScope.INSTANCE, DefaultScope.INSTANCE,
		BundleDefaultsScope.INSTANCE, ConfigurationScope.INSTANCE };
boolean b = Platform.getPreferencesService().getBoolean("org.eclipse.ui.ide", //$NON-NLS-1$
		IDEInternalPreferences.SHOW_PROBLEMS_VIEW_DECORATIONS_ON_STARTUP, false, contexts);
if(!b){
	return;
}
Comment 22 Andrey Loskutov CLA 2017-04-07 09:46:26 EDT
Created attachment 267700 [details]
example stack if using preference store

Similar example for the log produced by the patch and adding the code below to the begin of org.eclipse.ui.internal.ide.IDEWorkbenchPlugin.createProblemsViews()

if (!getDefault().getPreferenceStore()
.getBoolean(IDEInternalPreferences.SHOW_PROBLEMS_VIEW_DECORATIONS_ON_STARTUP)) {
	return;
}
Comment 23 Eclipse Genie CLA 2017-04-07 09:55:17 EDT
New Gerrit change created: https://git.eclipse.org/r/94677
Comment 24 Andrey Loskutov CLA 2017-04-07 09:56:15 EDT
(In reply to Eclipse Genie from comment #23)
> New Gerrit change created: https://git.eclipse.org/r/94677

This is the patch for the SDK product to set the system property into the config.ini.
Comment 25 Andrey Loskutov CLA 2017-04-12 02:55:30 EDT
@Thomas, do you have time for a review?
Comment 26 Dani Megert CLA 2017-05-15 03:58:22 EDT
To me this looks like too late and big for 4.7. I suggest to retarget to Oxygen.1.

Tom, please change the target if you disagree.
Comment 27 Thomas Watson CLA 2017-05-15 08:58:27 EDT
(In reply to Dani Megert from comment #26)
> To me this looks like too late and big for 4.7. I suggest to retarget to
> Oxygen.1.
> 
> Tom, please change the target if you disagree.

I agree.
Comment 28 Andrey Loskutov CLA 2017-07-25 03:36:07 EDT
(In reply to Thomas Watson from comment #27)
> (In reply to Dani Megert from comment #26)
> > To me this looks like too late and big for 4.7. I suggest to retarget to
> > Oxygen.1.
> > 
> > Tom, please change the target if you disagree.
> 
> I agree.

Thomas, can we please proceed with the review? https://git.eclipse.org/r/#/c/94671/
Comment 29 Thomas Watson CLA 2017-08-21 10:13:52 EDT
I don't think we should be doing this for Oxygen at this point.  Lets first get it into Photon.
Comment 30 Andrey Loskutov CLA 2017-09-15 08:17:38 EDT
(In reply to Thomas Watson from comment #29)
> I don't think we should be doing this for Oxygen at this point.  Lets first
> get it into Photon.

Thomas, can we please proceed with the patch review?
Comment 32 Thomas Watson CLA 2017-09-18 09:54:19 EDT
(In reply to Andrey Loskutov from comment #30)
> (In reply to Thomas Watson from comment #29)
> > I don't think we should be doing this for Oxygen at this point.  Lets first
> > get it into Photon.
> 
> Thomas, can we please proceed with the patch review?

I published the equinox changes.  Leaving open until you update the SDK bit.
Comment 33 Andrey Loskutov CLA 2017-09-19 05:26:21 EDT
(In reply to Thomas Watson from comment #32)
> (In reply to Andrey Loskutov from comment #30)
> > (In reply to Thomas Watson from comment #29)
> > > I don't think we should be doing this for Oxygen at this point.  Lets first
> > > get it into Photon.
> > 
> > Thomas, can we please proceed with the patch review?
> 
> I published the equinox changes.  Leaving open until you update the SDK bit.

Thanks Thomas!

@Sravan, Alexander: I've rebased the patch https://git.eclipse.org/r/94677/ for the sdk.product file in org.eclipse.platform.releng.tychoeclipsebuilder. Can you please review this patch?
Comment 35 Alexander Kurtakov CLA 2017-09-21 06:56:25 EDT
This caused p2 tests to fail with "The instance data location has not been specified yet." See http://download.eclipse.org/eclipse/downloads/drops4/I20170920-2000/testresults/html/org.eclipse.equinox.p2.tests_ep48I-unit-cen64-gtk2_linux.gtk.x86_64_8.0.html
Comment 36 Eclipse Genie CLA 2017-09-21 07:09:41 EDT
New Gerrit change created: https://git.eclipse.org/r/105555
Comment 37 Alexander Kurtakov CLA 2017-09-21 07:10:58 EDT
(In reply to Eclipse Genie from comment #36)
> New Gerrit change created: https://git.eclipse.org/r/105555

This is my dirty workaround - pass the vmargh with false to enforce old state of affairs. If one thinks code should be changed to instantiate config area please do so.
Comment 38 Thomas Watson CLA 2017-09-21 08:36:34 EDT
(In reply to Alexander Kurtakov from comment #37)
> (In reply to Eclipse Genie from comment #36)
> > New Gerrit change created: https://git.eclipse.org/r/105555
> 
> This is my dirty workaround - pass the vmargh with false to enforce old
> state of affairs. If one thinks code should be changed to instantiate config
> area please do so.

Alex, could you point to the preferences code in p2 where this setting makes things work?  Andrey could you have a look to see if we are doing things wrong in p2?
Comment 39 Dani Megert CLA 2017-09-22 08:38:04 EDT
Ping! Tests still fail.
Comment 40 Andrey Loskutov CLA 2017-09-22 08:58:17 EDT
(In reply to Dani Megert from comment #39)
> Ping! Tests still fail.

I'm looking into it right now.
Comment 41 Andrey Loskutov CLA 2017-09-22 10:14:41 EDT
Created attachment 270321 [details]
org.eclipse.equinox.p2.tests.AutomatedTests.txt

Attached is one of the logs with failing tests.
The common error stack is below.

The test starts Eclipse without -data and with "-Dosgi.dataAreaRequiresExplicitInit=true" option which enables strict checks coming from platform runtime eclipse.ini file (this was the part of the changes we did via https://git.eclipse.org/r/#/c/94677/).

VerifierApplication does NOT need a workspace, but it tries to use MigrationWizardTestHelper which extends MigrationSupport from org.eclipse.equinox.p2.ui.sdk.scheduler bundle, loading this class triggers load of AutomaticUpdatePlugin and unattended initialization of the DataArea via PreferenceInitializer => kaboom, we detect this as a problem and we have a proof the fix for this bug works!

Because this seem to be irrelevant for the p2 tests, we can suppress the strict checks via adding "-Dosgi.dataAreaRequiresExplicitInit=false" startup argument to the Eclipse instance started from inside AbstractSharedInstallTest.

So far what I could see from org.eclipse.equinox.p2.tests tests they seem never use workspace (why should they), so I think it is OK to allow them to relax the check.

java.lang.IllegalStateException: The instance data location has not been specified yet.
at org.eclipse.core.internal.runtime.DataArea.assertLocationInitialized(DataArea.java:56)
at org.eclipse.core.internal.runtime.DataArea.getStateLocation(DataArea.java:138)
at org.eclipse.core.internal.preferences.InstancePreferences.getBaseLocation(InstancePreferences.java:44)
at org.eclipse.core.internal.preferences.InstancePreferences.initializeChildren(InstancePreferences.java:209)
at org.eclipse.core.internal.preferences.InstancePreferences.<init>(InstancePreferences.java:59)
at org.eclipse.core.internal.preferences.InstancePreferences.internalCreate(InstancePreferences.java:220)
at org.eclipse.core.internal.preferences.EclipsePreferences.create(EclipsePreferences.java:352)
at org.eclipse.core.internal.preferences.EclipsePreferences.create(EclipsePreferences.java:340)
at org.eclipse.core.internal.preferences.PreferencesService.createNode(PreferencesService.java:393)
at org.eclipse.core.internal.preferences.RootPreferences.getChild(RootPreferences.java:60)
at org.eclipse.core.internal.preferences.RootPreferences.getNode(RootPreferences.java:95)
at org.eclipse.core.internal.preferences.RootPreferences.node(RootPreferences.java:84)
at org.eclipse.core.internal.preferences.AbstractScope.getNode(AbstractScope.java:38)
at org.eclipse.core.runtime.preferences.InstanceScope.getNode(InstanceScope.java:77)
at org.eclipse.equinox.internal.p2.ui.sdk.scheduler.PreferenceInitializer.migratePreferences(PreferenceInitializer.java:45)
at org.eclipse.equinox.internal.p2.ui.sdk.scheduler.AutomaticUpdatePlugin.start(AutomaticUpdatePlugin.java:91)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:779)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:772)
at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:729)
at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:956)
at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:308)
at org.eclipse.osgi.container.Module.doStart(Module.java:581)
at org.eclipse.osgi.container.Module.start(Module.java:449)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:468)
at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:103)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:328)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:368)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:446)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.equinox.internal.p2.tests.verifier.VerifierApplication.checkMigrationWizard(VerifierApplication.java:471)
at org.eclipse.equinox.internal.p2.tests.verifier.VerifierApplication.verify(VerifierApplication.java:336)
at org.eclipse.equinox.internal.p2.tests.verifier.VerifierApplication.start(VerifierApplication.java:69)
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)
Comment 42 Andrey Loskutov CLA 2017-09-22 11:37:05 EDT
(In reply to Alexander Kurtakov from comment #37)
> (In reply to Eclipse Genie from comment #36)
> > New Gerrit change created: https://git.eclipse.org/r/105555

+1 from me. As commented on gerrit, I have no rights to rebase & merge, so please someone with p2 committer rights should do this.

Strange enough the test started from Eclipse with this patch fail, but I see them not failing in Gerrit, so I miss something to reproduce it from IDE.
Comment 43 Dani Megert CLA 2017-09-22 11:39:40 EDT
(In reply to Andrey Loskutov from comment #42)
> Strange enough the test started from Eclipse with this patch fail, but I see
> them not failing in Gerrit, so I miss something to reproduce it from IDE.

See 522466 comment c17.
Comment 44 Andrey Loskutov CLA 2017-09-22 11:50:03 EDT
(In reply to Dani Megert from comment #43)
> (In reply to Andrey Loskutov from comment #42)
> > Strange enough the test started from Eclipse with this patch fail, but I see
> > them not failing in Gerrit, so I miss something to reproduce it from IDE.
> 
> See 522466 comment c17.

I don't think that bug 522466 comment c17 is it. It says about differences "between maven and standalone tests executions". 

I run tests from IDE with patch https://git.eclipse.org/r/105555 which should unset the variable, so there should be no fails like in Gerrit. And I see that during the test it starts Eclipse multiple times, but only one time with the "expected" variable set to false, but later process starts (who is doing that?) fail with the error like in SDK build. 

I see that this works fine in Gerrit (it IS maven, or?), but this does not work in IDE. I'm totally confused.
Comment 46 Alexander Kurtakov CLA 2017-09-23 02:40:34 EDT
(In reply to Andrey Loskutov from comment #44)
> (In reply to Dani Megert from comment #43)
> > (In reply to Andrey Loskutov from comment #42)
> > > Strange enough the test started from Eclipse with this patch fail, but I see
> > > them not failing in Gerrit, so I miss something to reproduce it from IDE.
> > 
> > See 522466 comment c17.
> 
> I don't think that bug 522466 comment c17 is it. It says about differences
> "between maven and standalone tests executions". 
> 
> I run tests from IDE with patch https://git.eclipse.org/r/105555 which
> should unset the variable, so there should be no fails like in Gerrit. And I
> see that during the test it starts Eclipse multiple times, but only one time
> with the "expected" variable set to false, but later process starts (who is
> doing that?) fail with the error like in SDK build. 
> 
> I see that this works fine in Gerrit (it IS maven, or?), but this does not
> work in IDE. I'm totally confused.

So I was investigating one issue (org.eclipse.equinox.p2.tests.sharedinstall.MultipleChanges) to find the root cause (launching it with  -Dorg.eclipse.equinox.p2.reconciler.tests.platform.archive=/path/to/eclipse-SDK-I20170920-2000-linux-gtk-x86_64.tar.gz) which pointed me to the workaround I proposed. It most likely requires disabling the env variable in other places too but the patch was mostly a proof of concept and smth people can play with and say whether this is the path forward. Let's see today's build and what else is left, I'll fix them next week unless someone beats me to it.
Comment 47 Andrey Loskutov CLA 2017-09-25 09:51:53 EDT
(In reply to Alexander Kurtakov from comment #46)
> Let's see today's
> build and what else is left, I'll fix them next week unless someone beats me
> to it.

Thanks Alexander! For me the status looks good now, no p2 fails anymore:
http://download.eclipse.org/eclipse/downloads/drops4/I20170924-2000/testResults.php

I'm closing this one now, feel free to reopen if I've missed something.