Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean whipe out all bundle data #203

Open
laeubi opened this issue Jan 30, 2023 · 9 comments
Open

clean whipe out all bundle data #203

laeubi opened this issue Jan 30, 2023 · 9 comments

Comments

@laeubi
Copy link
Member

laeubi commented Jan 30, 2023

On the help page it says:

osgi.clean
if set to "true", any cached data used by the OSGi framework and eclipse runtime will be wiped clean. This will clean the caches used to store bundle dependency resolution and eclipse extension registry data. Using this option will force eclipse to reinitialize these caches.

In fact this does not really clear out only cached data but also the "persistent bundle area" a bundle get when calling org.osgi.framework.BundleContext.getDataFile(String) this is also where the configuration admin usually stores data, so also all user-configuration get wiped when using -clean

Currently this won't be noticed much as eclipse uses it own "preferences" that are stored in the workspace and Plugins are using Platform.getStateLocation(bundle), but this is of course not an option for "pure" OSGi components that don't want to bind to Eclipse specific things.

@laeubi
Copy link
Member Author

laeubi commented Jan 30, 2023

Looking at https://docs.osgi.org/specification/osgi.core/8.0.0/framework.lifecycle.html#i1236436 I also can't find an indication that the data there is considered only a cache ("private persistent storage area").

@tjwatson
Copy link
Contributor

The bundle data area lives with the installation of a bundle. When a bundle is no longer installed then its bundle data area must also be removed. When using -clean all bundles effectively are no longer installed. This is the same when you use the framework launch option https://docs.osgi.org/javadoc/osgi.core/8.0.0/org/osgi/framework/Constants.html#FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT

@laeubi
Copy link
Member Author

laeubi commented Jan 30, 2023

Given that P2 / SimpleInstaller sometimes mess up things and we recommend to call clean it seems there might then be an option required to flush cached state but retain the bundle data (e.g. by only clear items that are really uninstalled, e.g. bundle location has changed or version or symbolic name) and better document that this not really clears cached data (what one usually reads as "data that can be recovered from other sources") but wipes out even persistent data.

@tjwatson
Copy link
Contributor

Given that P2 / SimpleInstaller sometimes mess up things and we recommend to call clean it seems there might then be an option required to flush cached state but retain the bundle data (e.g. by only clear items that are really uninstalled, e.g. bundle location has changed or version or symbolic name) and better document that this not really clears cached data (what one usually reads as "data that can be recovered from other sources") but wipes out even persistent data.

This will not be how other compliant frameworks behave and I think it would violate the specification. Bundle data is associated with an installed bundle which has a location + bundle ID (long) value associated with it. When doing -clean we could have the same bundle locations, but the bundle ID may very likely change from the previous state we cleaned.

@laeubi
Copy link
Member Author

laeubi commented Jan 30, 2023

So osgi.clean / -clean is effectively org.osgi.framework.storage.clean=onFirstInit, I'm just asking because I can't find osgi.clean in the spec, and at least the Eclipse doc seem to indicate a different purpose (cleaning cached data) that what org.osgi.framework.storage.clean indocates (clearing the persistent storage area).

@tjwatson
Copy link
Contributor

osgi.clean is Equinox specific and predates the spec'ed onFirstInit. If onFirstInit is used we always end up setting osgi.clean to true:

// set other defaults
if (FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT.equals(getConfiguration(FRAMEWORK_STORAGE_CLEAN))) {
setConfiguration(PROP_CLEAN, "true"); //$NON-NLS-1$
}

This is because other things in Eclipse pay attention to the osgi.clean value, like the extension registry.

@github-actions
Copy link

This issue has been inactive for 180 days and is therefore labeled as stale.
If this issue became irrelevant in the meantime please close it as completed. If it is still relevant and you think it should be fixed some possibilities are listed below.
Please read https://github.com/eclipse-equinox/.github/blob/main/CONTRIBUTING.md#contributing-to-eclipse-equinox for ways to influence development.

Copy link

This issue has been inactive for 180 days and is therefore labeled as stale.
If this issue became irrelevant in the meantime please close it as completed. If it is still relevant and you think it should be fixed some possibilities are listed below.
Please read https://github.com/eclipse-equinox/.github/blob/main/CONTRIBUTING.md#contributing-to-eclipse-equinox for ways to influence development.

@github-actions github-actions bot added the stale label Jan 27, 2024
@laeubi laeubi removed the stale label Jan 27, 2024
Copy link

This issue has been inactive for 180 days and is therefore labeled as stale.
If this issue became irrelevant in the meantime please close it as completed. If it is still relevant and you think it should be fixed some possibilities are listed below.
Please read https://github.com/eclipse-equinox/.github/blob/main/CONTRIBUTING.md#contributing-to-eclipse-equinox for ways to influence development.

@github-actions github-actions bot added the stale label Jul 26, 2024
@laeubi laeubi removed the stale label Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants