tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: URL Import Question
Date Tue, 29 Apr 2008 14:05:52 GMT
Hash: SHA1


Stephen Caine wrote:
| We are using a c:import url tag.  Under most circumstances this works
| just fine, but when it is iterated hundreds of times within the same
| page, it causes the java process to quickly exhaust threads.

That is a /lot/ of c:imports. Why do you need hundreds of c:imports in
the same page? That suggests to me that your architecture is not
particularly efficient.

I would imagine you are using mostly local imports. The JSTL spec says
that for internal resources, RequestDispatcher.include should be used.
If you are seeing an explosion of threads, then there is either a bug in
the JSTL implementation or you are observing unrelated behavior. The
servlet spec states that a request will be handled by a single thread
from start to finish -- that includes (ha!) includes. I'm pretty sure
that Tomcat will not allocate another thread to handle an include, so I
wonder if the JSTL is making a bad decision.

Are you using only local imports? Whose JSTL implementation are you
using, and what version?

If you are using external imports, you may have a problem. The JSTL spec
states that URLConnection should be used to fetch those resources.
URLConnection uses InputStream and OutputStream to handle input and
output. IIRC, each stream requires a thread, which means that all your
connections are creating lots of threads to manage input and output.
Since everything is still in scope (one giant _service method in your
JSP), the resources aren't cleaned up as the page executes.

In this case, I wonder if splitting a large page into smaller pages
might allow these resources to be freed a little more progressively.

Let's see what that thread dump shows...

- -chris

Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla -


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message