[ https://issues.apache.org/jira/browse/SLING-4026?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14179779#comment-14179779 ]
JBodkin commented on SLING-4026: -------------------------------- I've uploaded a bundle to the ticket so you can verify with this. The steps I've performed are as follows # Open Felix System Console # Upload bundle with Start Bundle checked # Validate the logs to ensure "Successful adaptTo PathModel" was printed # Re-upload bundle with start bundle unchecked # Validate the logs to ensure "Successful adaptTo PathModel" was printed - {color:red}Failure{color} Log Output: {code} 22.10.2014 10:57:25.066 *INFO* [Background Install C:\Users\jbodkin\AppData\Local\Temp\install8464041485950987376.tmp] com.lonelystorm.sling.racer BundleEvent INSTALLED 22.10.2014 10:57:25.072 *INFO* [Background Install C:\Users\jbodkin\AppData\Local\Temp\install8464041485950987376.tmp] com.lonelystorm.sling.racer BundleEvent RESOLVED 22.10.2014 10:57:25.072 *INFO* [Background Install C:\Users\jbodkin\AppData\Local\Temp\install8464041485950987376.tmp] com.lonelystorm.sling.racer BundleEvent STARTING 22.10.2014 10:57:25.137 *INFO* [Background Install C:\Users\jbodkin\AppData\Local\Temp\install8464041485950987376.tmp] org.apache.sling.models.impl Service [2933] ServiceEvent REGISTERED 22.10.2014 10:57:25.140 *ERROR* [Background Install C:\Users\jbodkin\AppData\Local\Temp\install8464041485950987376.tmp] com.lonelystorm.sling.racer.components.ImmediateComponent ImmediateComponent::bindPathAdapter 22.10.2014 10:57:25.141 *ERROR* [Background Install C:\Users\jbodkin\AppData\Local\Temp\install8464041485950987376.tmp] com.lonelystorm.sling.racer.components.ImmediateComponent ImmediateComponent::Activate 22.10.2014 10:57:25.143 *ERROR* [Background Install C:\Users\jbodkin\AppData\Local\Temp\install8464041485950987376.tmp] com.lonelystorm.sling.racer.components.ImmediateComponent Successful adaptTo PathModel 22.10.2014 10:57:25.144 *INFO* [Background Install C:\Users\jbodkin\AppData\Local\Temp\install8464041485950987376.tmp] com.lonelystorm.sling.racer BundleEvent STARTED 22.10.2014 10:57:48.569 *ERROR* [Background Update com.lonelystorm.sling.racer (442)] com.lonelystorm.sling.racer.components.ImmediateComponent ImmediateComponent::unbindPathAdapter 22.10.2014 10:57:48.570 *INFO* [Background Update com.lonelystorm.sling.racer (442)] org.apache.sling.models.impl Service [2934] ServiceEvent UNREGISTERING 22.10.2014 10:57:48.573 *INFO* [Background Update com.lonelystorm.sling.racer (442)] com.lonelystorm.sling.racer BundleEvent STOPPING 22.10.2014 10:57:48.574 *INFO* [Background Update com.lonelystorm.sling.racer (442)] com.lonelystorm.sling.racer BundleEvent STOPPED 22.10.2014 10:57:48.584 *INFO* [Background Update com.lonelystorm.sling.racer (442)] com.lonelystorm.sling.racer BundleEvent UNRESOLVED 22.10.2014 10:57:48.584 *INFO* [Background Update com.lonelystorm.sling.racer (442)] com.lonelystorm.sling.racer BundleEvent UPDATED 22.10.2014 10:57:48.635 *INFO* [FelixDispatchQueue] org.apache.felix.framework FrameworkEvent PACKAGES REFRESHED 22.10.2014 10:57:48.638 *INFO* [Background Update com.lonelystorm.sling.racer (442)] com.lonelystorm.sling.racer BundleEvent RESOLVED 22.10.2014 10:57:48.638 *INFO* [Background Update com.lonelystorm.sling.racer (442)] com.lonelystorm.sling.racer BundleEvent STARTING 22.10.2014 10:57:48.830 *ERROR* [Background Update com.lonelystorm.sling.racer (442)] com.lonelystorm.sling.racer.components.ImmediateComponent ImmediateComponent::bindPathAdapter 22.10.2014 10:57:48.830 *ERROR* [Background Update com.lonelystorm.sling.racer (442)] com.lonelystorm.sling.racer.components.ImmediateComponent ImmediateComponent::Activate 22.10.2014 10:57:48.831 *ERROR* [Background Update com.lonelystorm.sling.racer (442)] com.lonelystorm.sling.racer.components.ImmediateComponent Failure adaptTo PathModel 22.10.2014 10:57:48.831 *INFO* [Background Update com.lonelystorm.sling.racer (442)] org.apache.sling.models.impl Service [2935] ServiceEvent REGISTERED 22.10.2014 10:57:48.832 *INFO* [Background Update com.lonelystorm.sling.racer (442)] com.lonelystorm.sling.racer BundleEvent STARTED {code} > Sling Models Race Condition > --------------------------- > > Key: SLING-4026 > URL: https://issues.apache.org/jira/browse/SLING-4026 > Project: Sling > Issue Type: Bug > Components: Extensions > Affects Versions: Sling Models Implementation 1.1.0 > Reporter: JBodkin > Labels: models > Attachments: racer.zip > > > During initialization of a bundle, it is possible to encounter a race > condition in which the BundleTrackerCustomizer::addingBundle(Bundle bundle, > BundleEvent event) is triggered after the bundle has begun initialization of > a immediate component. > {code:java} > @Component(immediate = true) > @Service > public class ExampleImpl { > @Activate > public void activate(ComponentContext context) { > Resource resource = .... > // Race condition possible here... Could be executed before the > BundleTracker (ModelPackageBundleListener) > SlingModelExample example = resource.adaptTo(SlingModelExample); > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)