You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2018/09/12 16:28:00 UTC

[Bug 62713] New: caching of classes/statics doesn't work

https://bz.apache.org/bugzilla/show_bug.cgi?id=62713

            Bug ID: 62713
           Summary: caching of classes/statics doesn't work
           Product: Tomcat 8
           Version: 8.5.32
          Hardware: PC
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: esevecke@novomind.com
  Target Milestone: ----

The method resolveClass of class ImportHandler uses a cache named "clazzes".
This cache is useless since during every jsp evaluation a bunch of instances of
class ImportHandler were created and every instance has its own cache.

The result is that on all our live shop systems with tomcat 8 (e-commerce
applications) we see blocked threads due to concurrent calls to class loader
getResource.


   java.lang.Thread.State: BLOCKED (on object monitor)
        at java.util.zip.ZipFile.getEntry(ZipFile.java:314)
        - waiting to lock <0x00000003ee5ab130> (a java.util.jar.JarFile)
        at java.util.jar.JarFile.getEntry(JarFile.java:240)
        at java.util.jar.JarFile.getJarEntry(JarFile.java:223)
        at
org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.getArchiveEntry(AbstractSingleArchiveResourceSet.java:97)
        at
org.apache.catalina.webresources.AbstractArchiveResourceSet.getResource(AbstractArchiveResourceSet.java:272)
        at
org.apache.catalina.webresources.StandardRoot.getResourceInternal(StandardRoot.java:281)
        at org.apache.catalina.webresources.Cache.getResource(Cache.java:62)
        at
org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:216)
        at
org.apache.catalina.webresources.StandardRoot.getClassLoaderResource(StandardRoot.java:225)
        at
org.apache.catalina.loader.WebappClassLoaderBase.findResource(WebappClassLoaderBase.java:902)
        at
org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:1023)
        at javax.el.ImportHandler.findClass(ImportHandler.java:202)
        at javax.el.ImportHandler.resolveClass(ImportHandler.java:164)
        at
javax.servlet.jsp.el.ScopedAttributeELResolver.getValue(ScopedAttributeELResolver.java:85)
        at
org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:110)
        at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:94)
        at org.apache.el.parser.AstValue.getValue(AstValue.java:137)
        at
org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:190)
        at
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:944)

simple example to show the wrong behaviour:

use a local tomcat and a single jsp containing an undefined expression, e.g.:
${a.b}

At every execution of this jsp the ImportHandler tries to find a class named
"a" with the resource loader and the cache is empty.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 62713] caching of classes/statics doesn't work

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=62713

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All
         Resolution|---                         |WONTFIX
             Status|NEW                         |RESOLVED

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Caching has to be per JSP / tag file as each can have a different set of
imports.

The look-ups that Tomcat is performing are those required by the spec. The
additions in the EL 3.0 spec have significantly added to the overhead
associated with using EL in some scenarios. 

There is an optimisation in 8.5.33 that might help. It depends on the type of
expressions that are being used.

With a concrete, real-world example of a poorly performing JSP we can look to
see what further optimisations might be possible although the code is already
heavily optimised.

Generally, the users mailing list is the place to start when facing a
performance issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org