tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Rabung" <>
Subject Re: Lots of JspRuntimeContext threads
Date Tue, 10 Apr 2007 21:04:06 GMT
Based on my reading of the javadoc and source, I expected 1
"JspRuntimeContext" thread per context when the following conditions were
1. development is true and checkInterval is greater than 0 for JspServlet
2. The webapp is a directory

However, I seem to get arbitrary numbers of these threads, usually between
10 and 30, for each context.  This is a problem in a hosted environment,
where I need every thread I can get.

Luckily, I've been able to track down the root cause of all of these extra
threads: the <jsp-file> child element of the <servlet> element in web.xml.
If the above conditions are met, I'll have one normal JspRuntimeContext +
one thread for each servlet that specifies a <jsp-file>. I imagine each of
these servlets instantiates a new JspServlet, which instantiates a new
JspRuntimeContext in its init method, which calls threadStart()...

To reproduce:
1. Install a new Tomcat 5.5.23
2. edit conf/web.xml, and set update the JspServlet to include these params:
3. Create a  "threadTest" dir in webapps/
4. Create a WEB-INF/web.xml in threadTest/:
<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns=""

6. Start Tomcat, and observe thread list (you can use ctrl-break).  You will
see 4 JspRuntimeContexts for the threadTest context: 1 normal one, and one
for each servlet that specifies a <jsp-file>.

Is this a bug?  Hard to say... while I sure don't want one thread for every
<jsp-file>, a different instance of JspServlet  for each declaration is the
"servlet way".  Maybe JspRuntimeContext could be a context-wide singleton?

Thanks in advance for any further info.

On 4/9/07, Mark Thomas <> wrote:
> Adam Rabung wrote:
> > I _know_ I'll eventually discover this is some configuration problem
> > on my end, I'm just trying to understand the life-cycle of the
> > JspRuntimeContext to help me track it down.  I'm still stumped.
> I should have looked at the code rather than relying on my dodgy
> memory. This looks to be entirely normal to me.
> The javadoc explains all:
> Mark
> ---------------------------------------------------------------------
> To start a new topic, e-mail:
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message