Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-2942

Bundles with higher start level get activated even before framework reaches that start level

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • framework-3.0.8
    • framework-3.2.2
    • Framework
    • None

    Description

      In my environment, this is what's going on:

      1. framework is started with start level 1.
      2. bundles are installed and assigned start level varying from 2 to 4.
      3. framework's start level is set to 5.
      4. another bundle is installed and is assigned start level 5. This bundle is then started.

      Immediately I see Bundle.STARTED event for the last bundle with start level 5 is fired. While trying to understand why certain bundles are getting started earlier than bundles with lower start levels, I stepped into Felix and found the following code:

      // Check to see if the bundle's start level is greater than the
      // the framework's active start level.
      // TODO: STARTLEVEL - Technically, this is not correct since we could be in the
      // middle of a framework start level change and we might not have yet
      // reached the target start level, but we will activate the bundle anyway.
      // This means the bundle will be running in a higher start level temporarily
      // until the start level thread catches up.
      if (bundle.getStartLevel(getInitialBundleStartLevel()) > m_targetStartLevel)
      {
      // Throw an exception for transient starts.
      if ((options & Bundle.START_TRANSIENT) != 0)

      { throw new BundleException( "Cannot start bundle " + bundle + " because its start level is " + bundle.getStartLevel(getInitialBundleStartLevel()) + ", which is greater than the framework's start level of " + m_targetStartLevel + "."); }

      // Ignore persistent starts.
      return;
      }

      The above code compares against "target start level" as opposed to the "currently active start level". The comment indicates that it is a known issue, so if there is already a bug filed to this extent, please close this one as duplicate. It pretty much makes it difficult to use start level service reliably.

      Attachments

        Activity

          People

            rickhall Richard S. Hall
            sahoo Sanjeeb Kumar Sahoo
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: