eclipse-ee4j / mojarra

Mojarra, a Jakarta Faces implementation
Other
162 stars 110 forks source link

DefaultFaceletCache makes jsf response time 2 seconds long randomly #2232

Closed ren-zhijun-oracle closed 11 years ago

ren-zhijun-oracle commented 13 years ago

JSF clikcks take more than two seconds randomly although there is no logic on the page. After running the profiler it turned out that the application waits for 2-4 seconds on the following place:

java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method) java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:850) java.net.InetAddress.getAddressFromNameService(InetAddress.java:1201) java.net.InetAddress.getAllByName0(InetAddress.java:1154) java.net.InetAddress.getAllByName(InetAddress.java:1084) java.net.InetAddress.getAllByName(InetAddress.java:1020) java.net.InetAddress.getByName(InetAddress.java:970) java.net.URLStreamHandler.getHostAddress(URLStreamHandler.java:420) java.net.URLStreamHandler.hashCode(URLStreamHandler.java:337) java.net.URL.hashCode(URL.java:857) java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768) com.sun.faces.util.ExpiringConcurrentCache.containsKey(ExpiringConcurrentCache.java:149) com.sun.faces.facelets.impl.DefaultFaceletCache.isFaceletCached(DefaultFaceletCache.java:132) com.sun.faces.facelets.impl.DefaultFaceletFactory.needsToBeRefreshed(DefaultFaceletFactory.java:264)

Reason of the hangs: DefaultFaceletCache uses an URL as the key of the cache entry. Some topic says that URL should never be used as key of HashMap or in collections where hashcode might be called. Reason is the same as the stacktrace shows: URL calls getHostAddress during hashcode generation that cause calling lookupAllHostAddr.

It may solve the problem if the url.getExternalForm() string is used as the key of the cache as it does not cause hangs.

Environment

Windows Vista, 7, 2008 Server, Java 1.6_27, Glassfish 3.1.1, JSF webapp as an OSGI bundle.

Affected Versions

[2.1.3]

ren-zhijun-oracle commented 6 years ago
ren-zhijun-oracle commented 13 years ago

@javaserverfaces Commented Reported by zsb

ren-zhijun-oracle commented 11 years ago

@javaserverfaces Commented @manfredriem said: Can you verify if your DNS is always resolving properly? Note if the key is not being resolved fast enough it might indicate a DNS resolving problem.

ren-zhijun-oracle commented 11 years ago

@javaserverfaces Commented @manfredriem said: Lowering priority because of no response

ren-zhijun-oracle commented 11 years ago

@javaserverfaces Commented @manfredriem said: Lowering priority because of no response

ren-zhijun-oracle commented 11 years ago

@javaserverfaces Commented @manfredriem said: Closing because of inactivity

ren-zhijun-oracle commented 13 years ago

@javaserverfaces Commented Issue-Links: is related to JAVASERVERFACES-2117

ren-zhijun-oracle commented 7 years ago

@javaserverfaces Commented This issue was imported from java.net JIRA JAVASERVERFACES-2228

ren-zhijun-oracle commented 11 years ago

@javaserverfaces Commented Marked as incomplete on Thursday, April 25th 2013, 9:20:47 am