Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 540605

Summary: [regression] Eclipse 4.10 has ds.delayed.keepInstances=false per default
Product: [Eclipse Project] Equinox Reporter: Simeon Andreev <simeon.danailov.andreev>
Component: FrameworkAssignee: Andrey Loskutov <loskutov>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: christian.dietrich.opensource, loskutov, tjwatson
Version: 4.10   
Target Milestone: 4.10 M3   
Hardware: PC   
OS: Linux   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=510673
https://bugs.eclipse.org/bugs/show_bug.cgi?id=538737
https://git.eclipse.org/r/131663
https://git.eclipse.org/c/equinox/rt.equinox.framework.git/commit/?id=7d65c3565b61618454a809b02ea5d09d120db565
Whiteboard:

Description Simeon Andreev CLA 2018-10-30 09:17:29 EDT
Briefly, the fix for bug 510673 was broken by changes for bug 538737.

We tried upgrading our product to 4.10 and noticed odd OSGI service behaviour:

Our services would be activated and deactivated multiple times during the product life-cycle. This was not the case in 4.9.

After some debugging, we noticed that ds.delayed.keepInstances is no longer set to true in 4.10. This results in deactivating services when ServiceRegistry.ungetService is called on them; in our case we get and unget the service on each access.

In 4.x, this behaviour has been fixed with bug 510673; with bug 538737 this fix is no longer available. No idea about 3.8.2, which was our platform until we migrated to 4.7.2.
Comment 1 Simeon Andreev CLA 2018-10-30 09:25:31 EDT
Workaround seems to be to specify VM argument: -Dds.delayed.keepInstances=true
Comment 2 Thomas Watson CLA 2018-10-30 10:02:56 EDT
(In reply to Simeon Andreev from comment #1)
> Workaround seems to be to specify VM argument:
> -Dds.delayed.keepInstances=true

Or you can place that in the config.ini file.
Comment 3 Andrey Loskutov CLA 2018-10-30 11:51:31 EDT
(In reply to Thomas Watson from comment #2)
> (In reply to Simeon Andreev from comment #1)
> > Workaround seems to be to specify VM argument:
> > -Dds.delayed.keepInstances=true
> 
> Or you can place that in the config.ini file.

Sure we can do what we want in our product, but the question how we should fix this on the SDK level, because not only our code doesn't expect activate/deactivate that often (see bug 510673).

This is a big regression in 4.10, at least from my point of view. I do not know what is the best way to solve it, because everyone got it "for free" before, and the "old" activate/deactivate behavior is there since years (or even since ever).

At the end, we need this commit 
 somewhere else: http://git.eclipse.org/c/equinox/rt.equinox.bundles.git/commit/?id=83395839c881d4ed7604e825a38c7d1b6dd41119 or we restore the ds bundle back.
Comment 4 Thomas Watson CLA 2018-10-30 12:09:02 EDT
(In reply to Andrey Loskutov from comment #3)
> (In reply to Thomas Watson from comment #2)
> > (In reply to Simeon Andreev from comment #1)
> > > Workaround seems to be to specify VM argument:
> > > -Dds.delayed.keepInstances=true
> > 
> > Or you can place that in the config.ini file.
> 
> Sure we can do what we want in our product, but the question how we should
> fix this on the SDK level, because not only our code doesn't expect
> activate/deactivate that often (see bug 510673).
> 
> This is a big regression in 4.10, at least from my point of view. I do not
> know what is the best way to solve it, because everyone got it "for free"
> before, and the "old" activate/deactivate behavior is there since years (or
> even since ever).
> 
> At the end, we need this commit 
>  somewhere else:
> http://git.eclipse.org/c/equinox/rt.equinox.bundles.git/commit/
> ?id=83395839c881d4ed7604e825a38c7d1b6dd41119 or we restore the ds bundle
> back.

I suggest we set a default setting in org.eclipse.core.runtime.adaptor.EclipseStarter.getConfiguration() similar to how we set org.eclipse.osgi.internal.framework.EquinoxConfiguration.PROP_COMPATIBILITY_BOOTDELEGATION

Something like this:

String dsDelayedKeepInstances = System.getProperty("ds.delayed.keepInstances");
if (dsDelayedKeepInstances != null) {
	// The system properties have a specific setting; use it
	configuration.put("ds.delayed.keepInstances", dsDelayedKeepInstances);
} else {
	// set a default value; but this value can be overriden by the config.ini
	configuration.put("ds.delayed.keepInstances" + EquinoxConfiguration.PROP_DEFAULT_SUFFIX, "true"); //$NON-NLS-1$
}
Comment 5 Eclipse Genie CLA 2018-10-30 12:46:37 EDT
New Gerrit change created: https://git.eclipse.org/r/131663
Comment 6 Andrey Loskutov CLA 2018-10-30 12:49:16 EDT
(In reply to Eclipse Genie from comment #5)
> New Gerrit change created: https://git.eclipse.org/r/131663

Thomas, this is your proposal as I understand it.
Comment 8 Thomas Watson CLA 2018-10-30 13:31:06 EDT
(In reply to Andrey Loskutov from comment #6)
> (In reply to Eclipse Genie from comment #5)
> > New Gerrit change created: https://git.eclipse.org/r/131663
> 
> Thomas, this is your proposal as I understand it.

Thanks, I merged.