I don’t know about your most recent stack trace, but the first one had this 
frame:


at javax.xml.parsers.FactoryFinder$1.run(FactoryFinder.java:293)

What’s the rest of the stack trace?  I suspect you’re recreating a SAX parser 
or parser factory over and over.  The intent of those factories is that you 
initialize them once and reuse them.  Recreate the document builder, 
transformer, parser, etc as necessary, but don’t recreate the factory.  The 
java service loader is very expensive.  If you’re doing it dozens or hundreds 
of times a second, that can definitely chew up your CPU.

Thanks


From: Jalaj Asher <jalaj.as...@eclinicalworks.com.INVALID>
Sent: Wednesday, July 10, 2024 5:02 PM
To: users@tomcat.apache.org
Subject: RE: Reg: tomcat CPU spikes

Sharing another stack to see if this can give any more insights. this thread is 
the tomcat main thread was loading about 65MB of data. "main" #1 prio=5 
os_prio=0 java. lang. Thread. State: RUNNABLE at java. util. zip. ZipFile. 
getEntry(Native Method)


Sharing another stack to see if this can give any more insights.this thread is 
the tomcat main thread was loading about 65MB of data.



"main" #1 prio=5 os_prio=0

   java.lang.Thread.State: RUNNABLE

              at java.util.zip.ZipFile.getEntry(Native Method)

              at java.util.zip.ZipFile.getEntry(ZipFile.java:328)

              - locked <0x00000000a1b04418> (a java.util.jar.JarFile)

              at java.util.jar.JarFile.getEntry(JarFile.java:253)

              at java.util.jar.JarFile.getJarEntry(JarFile.java:236)

              at 
org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.getArchiveEntry(AbstractSingleArchiveResourceSet.java:97)

              at 
org.apache.catalina.webresources.AbstractArchiveResourceSet.getResource(AbstractArchiveResourceSet.java:249)

              at 
org.apache.catalina.webresources.StandardRoot.getResourceInternal(StandardRoot.java:272)

              at 
org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:213)

              at 
org.apache.catalina.webresources.StandardRoot.getClassLoaderResource(StandardRoot.java:220)

              at 
org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2348)

              at 
org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:875)

              at 
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1376)

              - locked <0x00000000f24fc728> (a java.lang.Object)

              at 
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1220)

              at java.lang.Class.forName0(Native Method)

              at java.lang.Class.forName(Class.java:348)

              at com.sun.beans.finder.ClassFinder.findClass(ClassFinder.java:67)

              at 
com.sun.beans.finder.ClassFinder.findClass(ClassFinder.java:110)

              at 
com.sun.beans.finder.InstanceFinder.instantiate(InstanceFinder.java:93)

              at 
com.sun.beans.finder.InstanceFinder.find(InstanceFinder.java:66)

              at 
java.beans.Introspector.findExplicitBeanInfo(Introspector.java:448)

              at java.beans.Introspector.<init>(Introspector.java:398)

              at java.beans.Introspector.getBeanInfo(Introspector.java:173)

              at 
org.springframework.beans.CachedIntrospectionResults.getBeanInfo(CachedIntrospectionResults.java:255)





Regards



Jalaj



From: Jalaj Asher

Sent: Wednesday, July 10, 2024 4:19 PM

To: users@tomcat.apache.org<mailto:users@tomcat.apache.org>

Subject: Reg: tomcat CPU spikes



Hello,

We are using tomcat version 9.0.80.



We are seeing intermittent CPU spikes with the requests  having the following 
stack and it is also causing disk spikes on our end because of this call stack .



at java.util.zip.ZipFile.getEntry(Native Method)

at java.util.zip.ZipFile.getEntry(ZipFile.java:328)

- locked <0x00000000bb4fbf08> (a java.util.jar.JarFile)

at java.util.jar.JarFile.getEntry(JarFile.java:253)

at java.util.jar.JarFile.getJarEntry(JarFile.java:236)

at 
org.apache.catalina.webresources.AbstractSingleArchiveResourceSet.getArchiveEntry(AbstractSingleArchiveResourceSet.java:97)

at 
org.apache.catalina.webresources.AbstractArchiveResourceSet.getResource(AbstractArchiveResourceSet.java:249)

at 
org.apache.catalina.webresources.StandardRoot.getResourcesInternal(StandardRoot.java:316)

at 
org.apache.catalina.webresources.StandardRoot.getResources(StandardRoot.java:307)

at 
org.apache.catalina.webresources.StandardRoot.getClassLoaderResources(StandardRoot.java:226)

at 
org.apache.catalina.loader.WebappClassLoaderBase.findResources(WebappClassLoaderBase.java:1009)

at 
org.apache.catalina.loader.WebappClassLoaderBase.getResources(WebappClassLoaderBase.java:1110)

at java.util.ServiceLoader$LazyIterator.hasNextService(ServiceLoader.java:348)

at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:393)

at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:474)

at javax.xml.parsers.FactoryFinder$1.run(FactoryFinder.java:293)

at java.security.AccessController.doPrivileged(Native Method)



these are the runnable threads.



Wanted to get some understanding to see when does tomcat access the 
archiveresourceset and why is it calling getjarentry and zip file entry and any 
suggestions to address this issue ?



Would appreciate any help with this review.



Regards



Jalaj



CONFIDENTIALITY NOTICE TO RECIPIENT: This transmission contains confidential 
information belonging to the sender that is legally privileged and proprietary 
and may be subject to protection under the law, including the Health Insurance 
Portability and Accountability Act (HIPAA). If you are not the intended 
recipient of this e-mail, you are prohibited from sharing, copying, or 
otherwise using or disclosing its contents. If you have received this e-mail in 
error, please notify the sender immediately by reply e-mail and permanently 
delete this e-mail and any attachments without reading, forwarding or saving 
them. Thank you.






Reply via email to