javaee / mojarra

PLEASE NOTE: This project has moved to Eclipse Foundation and will be archived under the JavaEE GitHub Organization. After Feb. 1, 2021, the new location will be github.com/javaee/mojarra. Mojarra - Oracle's implementation of the JavaServer Faces specification
https://github.com/eclipse-ee4j/mojarra
Other
164 stars 58 forks source link

DefaultFaceletCache makes jsf response time 2 seconds long randomly #2232

Closed javaserverfaces closed 11 years ago

javaserverfaces 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]

javaserverfaces commented 13 years ago

Reported by zsb

javaserverfaces commented 11 years ago

@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.

javaserverfaces commented 11 years ago

@manfredriem said: Lowering priority because of no response

javaserverfaces commented 11 years ago

@manfredriem said: Lowering priority because of no response

javaserverfaces commented 11 years ago

@manfredriem said: Closing because of inactivity

javaserverfaces commented 13 years ago

Issue-Links: is related to JAVASERVERFACES-2117

javaserverfaces commented 7 years ago

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

javaserverfaces commented 11 years ago

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