felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Epik (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FELIX-3262) Startup delay due to URLHandlersBundleStreamHandler
Date Wed, 07 Dec 2011 21:18:39 GMT
Startup delay due to URLHandlersBundleStreamHandler 
----------------------------------------------------

                 Key: FELIX-3262
                 URL: https://issues.apache.org/jira/browse/FELIX-3262
             Project: Felix
          Issue Type: Improvement
          Components: Framework
    Affects Versions: framework-3.0.9
         Environment: Karaf 2.2.3 with spring-dm, spring
            Reporter: Sergey Epik


Problem: slow startup of bundles that use spring and spring-dm.

When spring-dm starts spring application context, it puts a lot of objects that contain URL
into set/map structures.
URL.hashCode delegates call to handler. 
URLHandlersBundleStreamHandler does not implement hashCode(URL u), but URLStreamHandler (parent)
calls InetAddress.getByName(name) with bundle number. 
This call is very slow and method URLStreamHandler.getHostAddress is synchronized.

We have found that Equinox's handler org.eclipse.osgi.framework.internal.core.BundleResourceHandler
overrides hashCode(URL u).

Here is thread dump that demonstrates problem:

[...]
"SpringOsgiExtenderThread-14" - Thread t@43
   java.lang.Thread.State: BLOCKED
	at java.net.URLStreamHandler.getHostAddress(URLStreamHandler.java:412)
	- waiting to lock <2a6cb4c8> (a org.apache.felix.framework.URLHandlersBundleStreamHandler)
owned by "SpringOsgiExtenderThread-2" t@31
	at java.net.URLStreamHandler.hashCode(URLStreamHandler.java:337)
	at java.net.URL.hashCode(URL.java:857)
	- locked <430eaae5> (a java.net.URL)
	at org.springframework.core.io.UrlResource.hashCode(UrlResource.java:217)
	at java.util.HashMap.put(HashMap.java:372)
	at java.util.HashSet.add(HashSet.java:200)
	at org.springframework.osgi.io.OsgiBundleResourcePatternResolver.doRetrieveMatchingBundleEntries(OsgiBundleResourcePatternResolver.java:707)
	at org.springframework.osgi.io.OsgiBundleResourcePatternResolver.doFindPathMatchingFileResources(OsgiBundleResourcePatternResolver.java:634)
	at org.springframework.osgi.io.OsgiBundleResourcePatternResolver.findPathMatchingResources(OsgiBundleResourcePatternResolver.java:577)
	at org.springframework.osgi.io.OsgiBundleResourcePatternResolver.findResources(OsgiBundleResourcePatternResolver.java:167)
	at org.springframework.osgi.io.OsgiBundleResourcePatternResolver.getResources(OsgiBundleResourcePatternResolver.java:197)
	at org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.getResources(AbstractOsgiBundleApplicationContext.java:425)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:177)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
	at org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:164)
	at org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:136)
	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:69)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:269)
	- locked <77f5c2c7> (a java.lang.Object)
	at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:247)
	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:214)
	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:169)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:175)
	at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:716)
	at java.lang.Thread.run(Thread.java:662)

   Locked ownable synchronizers:
	- None

"SpringOsgiExtenderThread-13" - Thread t@42
   java.lang.Thread.State: BLOCKED
	at java.net.URLStreamHandler.getHostAddress(URLStreamHandler.java:412)
	- waiting to lock <2a6cb4c8> (a org.apache.felix.framework.URLHandlersBundleStreamHandler)
owned by "SpringOsgiExtenderThread-2" t@31
	at java.net.URLStreamHandler.hashCode(URLStreamHandler.java:337)
	at java.net.URL.hashCode(URL.java:857)
	- locked <6e9ef1ce> (a java.net.URL)
	at org.springframework.core.io.UrlResource.hashCode(UrlResource.java:217)
	at java.util.HashMap.put(HashMap.java:372)
	at java.util.HashSet.add(HashSet.java:200)
	at org.springframework.osgi.io.OsgiBundleResourcePatternResolver.doRetrieveMatchingBundleEntries(OsgiBundleResourcePatternResolver.java:707)
	at org.springframework.osgi.io.OsgiBundleResourcePatternResolver.doFindPathMatchingFileResources(OsgiBundleResourcePatternResolver.java:634)
	at org.springframework.osgi.io.OsgiBundleResourcePatternResolver.findPathMatchingResources(OsgiBundleResourcePatternResolver.java:577)
	at org.springframework.osgi.io.OsgiBundleResourcePatternResolver.findResources(OsgiBundleResourcePatternResolver.java:167)
	at org.springframework.osgi.io.OsgiBundleResourcePatternResolver.getResources(OsgiBundleResourcePatternResolver.java:197)
	at org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.getResources(AbstractOsgiBundleApplicationContext.java:425)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:177)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
	at org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:164)
	at org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:136)
	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:69)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:269)
	- locked <515441f> (a java.lang.Object)
	at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:247)
	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:214)
	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:169)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:175)
	at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:716)
	at java.lang.Thread.run(Thread.java:662)

   Locked ownable synchronizers:
	- None
[...]

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message