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

Guillaume Nodet commented on FELIX-4309:
----------------------------------------

We have definitely a few threads involved in the process ;-)
I'm actually running a load test on bundles start / stop / refresh / update.
The framework itself does not allow concurrent access on a bundle (at least if 
the bundle and extenders do act synchronously).
Given SCR extends the felix AbstractExtender, it will synchronize correctly as 
much as possible, but there are always cases where the bundle can be stopped 
while the extender is processing the bundle.  The abstract extender correctly 
handles that (i.e. it will wait for the processing to finish, then destroy the 
extension), but it seems something is missing anyway.

After looking a bit more at the code, the problem may just come from the fact 
that the extension start / stop methods are not synchronized.  I think 
extending the SimpleExtension from felix utils would help in fixing this issue.
I can actually try and see if it helps.


> SCR leaves some components in DISABLED state
> --------------------------------------------
>
>                 Key: FELIX-4309
>                 URL: https://issues.apache.org/jira/browse/FELIX-4309
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.8.0
>            Reporter: Guillaume Nodet
>
> When running some load testing (involving refresh and restarts) on bundles, I 
> end up with the following exceptions:
> {code}
> 2013-11-08 13:20:00,234 | ERROR | xFrameworkWiring | fabric-core              
>         | ?                                   ? | 61 - 
> org.fusesource.fabric.fabric-core - 7.3.0.redhat-SNAPSHOT | 
> [org.fusesource.fabric.portservice.zookeeper] Cannot register Component
> java.lang.IllegalStateException: Invalid BundleContext.
>       at 
> org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)[org.apache.felix.framework-4.0.3.redhat-610147.jar:]
>       at 
> org.apache.felix.framework.BundleContextImpl.getBundle(BundleContextImpl.java:112)[org.apache.felix.framework-4.0.3.redhat-610147.jar:]
>       at 
> org.apache.felix.scr.impl.ComponentRegistry.checkComponentName(ComponentRegistry.java:357)[74:org.apache.felix.scr:1.8.0.redhat-610147]
>       at 
> org.apache.felix.scr.impl.BundleComponentActivator.loadDescriptor(BundleComponentActivator.java:253)[74:org.apache.felix.scr:1.8.0.redhat-610147]
>       at 
> org.apache.felix.scr.impl.BundleComponentActivator.initialize(BundleComponentActivator.java:153)[74:org.apache.felix.scr:1.8.0.redhat-610147]
>       at 
> org.apache.felix.scr.impl.BundleComponentActivator.<init>(BundleComponentActivator.java:115)[74:org.apache.felix.scr:1.8.0.redhat-610147]
>       at 
> org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:235)[74:org.apache.felix.scr:1.8.0.redhat-610147]
>       at 
> org.apache.felix.scr.impl.Activator.access$000(Activator.java:44)[74:org.apache.felix.scr:1.8.0.redhat-610147]
>       at 
> org.apache.felix.scr.impl.Activator$1.start(Activator.java:169)[74:org.apache.felix.scr:1.8.0.redhat-610147]
>       at 
> org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:256)[74:org.apache.felix.scr:1.8.0.redhat-610147]
>       at 
> org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:229)[74:org.apache.felix.scr:1.8.0.redhat-610147]
>       at 
> org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:479)[74:org.apache.felix.scr:1.8.0.redhat-610147]
>       at 
> org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:414)[74:org.apache.felix.scr:1.8.0.redhat-610147]
>       at 
> org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)[74:org.apache.felix.scr:1.8.0.redhat-610147]
>       at 
> org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:443)[74:org.apache.felix.scr:1.8.0.redhat-610147]
>       at 
> org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:870)[org.apache.felix.framework-4.0.3.redhat-610147.jar:]
>       at 
> org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:791)[org.apache.felix.framework-4.0.3.redhat-610147.jar:]
>       at 
> org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:515)[org.apache.felix.framework-4.0.3.redhat-610147.jar:]
>       at 
> org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4580)[org.apache.felix.framework-4.0.3.redhat-610147.jar:]
>       at 
> org.apache.felix.framework.Felix$4.run(Felix.java:2115)[org.apache.felix.framework-4.0.3.redhat-610147.jar:]
>       at 
> org.apache.felix.framework.Felix.runInContext(Felix.java:2139)[org.apache.felix.framework-4.0.3.redhat-610147.jar:]
>       at 
> org.apache.felix.framework.Felix.startBundle(Felix.java:2113)[org.apache.felix.framework-4.0.3.redhat-610147.jar:]
>       at 
> org.apache.felix.framework.Felix$RefreshHelper.restart(Felix.java:5099)[org.apache.felix.framework-4.0.3.redhat-610147.jar:]
>       at 
> org.apache.felix.framework.Felix.refreshPackages(Felix.java:4303)[org.apache.felix.framework-4.0.3.redhat-610147.jar:]
>       at 
> org.apache.felix.framework.FrameworkWiringImpl.run(FrameworkWiringImpl.java:178)[org.apache.felix.framework-4.0.3.redhat-610147.jar:]
>       at java.lang.Thread.run(Thread.java:722)[:1.7.0_12-ea]
> {code}
> The end result is that I end up with lots of components in DISABLED state 
> while the bundles are fully started
> {code}
> FuseFabric:karaf@root> scr:list
>    ID   State             Component Name
> [-1  ] [DISABLED        ] org.fusesource.fabric.placholder.resolver.port
> [-1  ] [DISABLED        ] org.fusesource.fabric.profile.urlhandler
> [-1  ] [DISABLED        ] org.fusesource.fabric.container.registration.karaf
> [-1  ] [DISABLED        ] 
> org.fusesource.fabric.placholder.resolver.versionprop
> [-1  ] [DISABLED        ] org.fusesource.fabric.placholder.resolver.crypt
> [-1  ] [DISABLED        ] org.fusesource.fabric.portservice.zookeeper
> [-1  ] [DISABLED        ] org.fusesource.fabric.placholder.resolver.zookeeper
> [-1  ] [DISABLED        ] org.fusesource.fabric.placholder.resolver.env
> [-1  ] [DISABLED        ] 
> org.fusesource.fabric.placholder.resolver.profileprop
> [-1  ] [DISABLED        ] org.fusesource.fabric.mbeanserver.listener
> [-1  ] [DISABLED        ] org.fusesource.fabric.service
> [46  ] [UNSATISFIED     ] org.fusesource.fabric.configadmin.bridge
> [93  ] [UNSATISFIED     ] 
> org.fusesource.fabric.api.jmx.ClusterBootstrapManager
> [94  ] [UNSATISFIED     ] org.fusesource.fabric.api.jmx.ClusterServiceManager
> [95  ] [UNSATISFIED     ] org.fusesource.fabric.api.jmx.MQManager
> [96  ] [UNSATISFIED     ] org.fusesource.fabric.zookeeper.config.builder
> [97  ] [REGISTERED      ] org.fusesource.fabric.lock.service
> [98  ] [UNSATISFIED     ] org.fusesource.fabric.zookeeper.cluster.bootstrap
> [99  ] [UNSATISFIED     ] org.fusesource.fabric.zookeeper.cluster.service
> [100 ] [REGISTERED      ] org.fusesource.fabric.placholder.resolver.checksum
> [101 ] [UNSATISFIED     ] org.fusesource.fabric.container.provider.child
> [102 ] [UNSATISFIED     ] org.fusesource.fabric.placholder.resolver.container
> [103 ] [ACTIVE          ] org.fusesource.datastore.manager
> [164 ] [UNSATISFIED     ] org.fusesource.fabric.features
> [202 ] [ACTIVE          ] org.fusesource.fabric.extender.listener.blueprint
> [203 ] [ACTIVE          ] org.fusesource.fabric.extender.listener.spring
> [205 ] [ACTIVE          ] org.fusesource.fabric.jaas
> [206 ] [REGISTERED      ] org.fusesource.fabric.jaas.zookeeper.backingengine
> [207 ] [UNSATISFIED     ] org.fusesource.fabric.web
> [208 ] [ACTIVE          ] org.fusesource.fabric.zookeeper.acl
> [209 ] [ACTIVE          ] org.fusesource.fabric.zookeeper
> [210 ] [ACTIVE          ] org.fusesource.fabric.zookeeper.urlhandler
> [216 ] [ACTIVE          ] org.fusesource.fabric.maven
> [217 ] [UNSATISFIED     ] org.fusesource.fabric.git.hawtio
> [218 ] [UNSATISFIED     ] org.fusesource.fabric.datastore
> [219 ] [ACTIVE          ] org.fusesource.fabric.git.service
> [220 ] [UNSATISFIED     ] org.fusesource.fabric.git.master.listener
> [221 ] [UNSATISFIED     ] org.fusesource.fabric.git.server
> FuseFabric:karaf@root> 
> {code}



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

Reply via email to