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

metatech commented on KARAF-2359:
---------------------------------

For the record, we discovered that this change has a side effect : when a 
bundle is updated while ServiceMix is stopped, at the next restart the "old" 
bundle is still present in the bundle cache, and is first started, then removed 
from the bundle, then the "new" bundle is deployed and started.  Without the 2 
parameters, Felix File Install scans for "updated" and "deleted" files very 
early in the boot process, which prevents this "double start".  With the 2 
parameters, Felix File Install waits until start level 80 to remove the "old" 
bundle.  This is only a problem for bundles which do not handle well "hot 
redeployment" (we have such a custom bundle on which many other bundles depend).
In summary, setting these 2 parameters improved the behaviour by ensuring 
correct start levels, but can have side-effects for atypical bundles.

> DirectoryWatcher for "deploy" directory should be configured to wait until 
> framework start level reaches 60
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: KARAF-2359
>                 URL: https://issues.apache.org/jira/browse/KARAF-2359
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-config
>    Affects Versions: 2.2.11
>         Environment: ServiceMix 4.4.2 and 4.5.1
>            Reporter: metatech
>            Assignee: Jean-Baptiste Onofré
>             Fix For: 2.2.12, 2.3.2, 2.4.0, 3.0.0
>
>
> Problem :
> By default, the DirectoryWatcher of Felix scans for new files very early in 
> the start process.  If a new application bundle is added to the "deploy" 
> directory, it might be detected and started while the framework start level 
> is still at 30, although the application bundle start should be postponed 
> until level 60 is reached.  
> If not, a typical problem will be that Camel-core is deployed after the 
> application bundle, thereby not using the OSGi-aware CamelContext, causing 
> some Camel components not to be found, with errors such as the following : 
> Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve 
> endpoint: sql://SELECT 1 from DUAL?dataSourceRef=myDS due to: No component 
> found with scheme: sql
> A hint to the root cause of the problem can be found in the logs :
> CamelNamespaceHandler            | OSGi environment not detected.
> By default, the property "felix.fileinstall.start.level" in file 
> "org.apache.felix.fileinstall-deploy.cfg" is unconfigured, resulting in the 
> default "0" level being used.  Although this means that the new bundle's 
> start level will be configured at level 60 (as configured in the 
> "karaf.startlevel.bundle" property), another unwanted side effect is also 
> observed : there is no wait in method "DirectoryWatcher:run()".
> Solutions :
> To avoid such race conditions between the starting of Camel-core bundle and 
> an application bundle, it would be safer to explicitly configure the property 
> "felix.fileinstall.start.level" to 60 in Felix 3.1.x, or property 
> "felix.fileinstall.active.level" to 60 in Felix 3.2.x, or change the code of 
> DirectoryWatcher to retrieve the default start level, in case it is 
> unspecified in the properties.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to