You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Modestas Vainius (JIRA)" <ji...@apache.org> on 2014/09/19 17:52:34 UTC

[jira] [Comment Edited] (FELIX-4647) Incorrect check of the NO_LOCAL_RESOURCES flag in ResolverImpl:resolve()

    [ https://issues.apache.org/jira/browse/FELIX-4647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14140770#comment-14140770 ] 

Modestas Vainius edited comment on FELIX-4647 at 9/19/14 3:52 PM:
------------------------------------------------------------------

Well, I'm no expert in OSGI let alone Felix or Karaf. However, I as wrote in the bug description I have issue with some bundles (which are not supposed to be) getting removed from ServiceMix when I uninstall my feature. At one point I debugged this down to this code, looked at it and thought that it makes no sense. It basically says:

{quote}
if there is *not* NO_LOCAL_RESOURCES flag, the remove local resources from m_requiredSet. Likewise for m_optionalSet.
{quote}

 It should be exactly the opposite, shouldn't it?

The key point here is that basically all essential bundles in karaf *are* local resources. So whenever features installer in karaf resolves bundle dependencies, essential bundles are not included in the dependency list. Now if another feature which mentions that essential bundle explicitly gets uninstalled, then Karaf will remove the bundle because it thinks it is no longer in use.

Karaf uses default resolve() call (i.e. with flags=0)


was (Author: modax):
Well, I'm no expert in OSGI let alone Felix or Karaf. However, I as wrote in the bug description I have issue with some bundles (which are not supposed to be) getting removed from ServiceMix when I uninstall my feature. At one point I debugged this down to this code, looked at it and thought that it makes no sense. It basically says:

{quote}
if there is *not* NO_LOCAL_RESOURCES flag, the remove local resources from m_requiredSet. Likewise for m_optionalSet.
{quote}

 It should be exactly the opposite, shouldn't it?

The key point here is that basically all essential bundles in karaf *are* local resources. So whenever features installer in karaf resolves bundle dependencies, essential bundles are not included in the dependency list. Now if another feature which mentions that essential bundle explicitly gets uninstalled, then Karaf will remove the bundle because it things it is not longer in use.

Karaf uses default resolve() call (i.e. with flags=0)

> Incorrect check of the NO_LOCAL_RESOURCES flag in ResolverImpl:resolve()
> ------------------------------------------------------------------------
>
>                 Key: FELIX-4647
>                 URL: https://issues.apache.org/jira/browse/FELIX-4647
>             Project: Felix
>          Issue Type: Bug
>          Components: Bundle Repository (OBR)
>    Affects Versions: bundlerepository-1.6.6
>            Reporter: Modestas Vainius
>
> Hello,
> if I understand correctly, the following code is wrong
> {code:title=ResolverImpl.java:227}
> if ((flags & NO_LOCAL_RESOURCES) == 0)
> {
>     m_requiredSet.removeAll(Arrays.asList(locals));
> }
> {code}
> {code:title=ResolverImpl.java:233}
> if ((flags & NO_LOCAL_RESOURCES) == 0)
> {
>     m_optionalSet.removeAll(Arrays.asList(locals));
> }
> {code}
> I believe, in both cases the conditional should be:
> {code}
> if ((flags & NO_LOCAL_RESOURCES) != 0)
> {code}
> Due to this bug I'm seeing some important bundles getting auto-uninstalled from ServiceMix container when they are not supposed be. This breaks feature uninstall.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)