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

                 Key: FELIX-2942
                 URL: https://issues.apache.org/jira/browse/FELIX-2942
             Project: Felix
          Issue Type: Bug
          Components: Framework
    Affects Versions: framework-3.0.8
            Reporter: Sahoo
            Priority: Critical


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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to