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

OSGi install/uninstall #556

Closed
PengZheng opened this issue May 14, 2023 · 0 comments · Fixed by #569
Closed

OSGi install/uninstall #556

PengZheng opened this issue May 14, 2023 · 0 comments · Fixed by #569
Assignees
Labels
component/framework Categorizes an issue or PR relevant to the framework. kind/bug Categorizes issue or PR as related to a bug.

Comments

@PengZheng
Copy link
Contributor

PengZheng commented May 14, 2023

The behavior of the uninstall() method of Bundle interface is specified as follows:

To whatever extent possible, the Framework must remove any resources related to the bundle. This method must always uninstall the bundle from the persistent storage of the Framework.

Clearly, the current implementation, which is introduced by #476, does not touch persistent storage.
As seen in TEST_F(CxxBundleArchiveTestSuite, BundleArchiveReusedTest), after uninstall, the bundle archive is intact.
#554 tries to fix this, but fails to take celix_bundleCache, which assumes that "bundle cache dirs are not removed" (see celix_bundleCache_updateIdForLocationLookupMap), into account, and thus is withdrawn in #555.

Also note that there are a race condition in current implementation of celix_framework_installBundle and celix_framework_installBundleAsync: if the same bundle are installed concurrently from multiple threads, it can happen that multiple copies of the same bundle will be installed into the bundle cache with different bundle ids.

        long alreadyExistingBndId = celix_bundleCache_findBundleIdForLocation(framework, bndLoc);
        //FIXME: first check then do
        long id = alreadyExistingBndId == -1 ? framework_getNextBundleId(framework) : alreadyExistingBndId;
        bundle_archive_t* archive = NULL;
        status = CELIX_DO_IF(status, celix_bundleCache_createArchive(framework, id, bndLoc, &archive));

Any future fix should also address the thread safety issue.

@PengZheng PengZheng self-assigned this May 14, 2023
@PengZheng PengZheng added kind/bug Categorizes issue or PR as related to a bug. component/framework Categorizes an issue or PR relevant to the framework. and removed kind/bug Categorizes issue or PR as related to a bug. labels May 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/framework Categorizes an issue or PR relevant to the framework. kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant