• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

AJP requested serviced all the time

 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

I am not sure it's Apache, Tomcat or JBoss issue, but perhaps someone could help me here.

I have Seam web application, hosted on JBoss (5.1) with Apache (2.2) in the front of Tomcat (6.0). After I start the server and it keeps running, I get more and more AJP requests being serviced (S in full tomcat status). For instance, I got threads being serviced about 32 hours , 10 hours and so on. JBoss/Tomcat process is growing as new requests join and finally I have to restart whole server. Restarting web applications or Apache does not help.

I made several thread dumps, but it didn't show anything, at least from my application. Garbage collector also should not be an issue, so I wonder - is there any way to set maximum time that request/thread can work? And then go back to the pool or is restarted?

Thanks,
Michal
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, threads are not time-limited. If you have long-running threads, you have a bug in your webapp.

If the webapp invokes potentially long-running processes, you should offload those processes off to somewhere outside the main request/response processing services. If a process is going to take more that a second or two, you risk annoying the webapp user and causing severe constipation in the Tomcat server. Never spawn child threads in a request/response service. It is not only explicitly forbidden by the J2EE spec, it can lead to erratic behavior on the part of Tomcat and its webapps.
 
Michal Glowacki
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Tim,

you might have point. I will try to remove all such points - I assume doing this:

new MyClass()

where

MyClass extends Thread

is also forbidden? Today I have restarted server at 12:00, now it already is working at 30% of 40 cores CPU...

Thanks,
Michal
 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It doesn't matter how you define them. All threads allocated from the Tomcat thread pool are supposed to be identical. They won't be identical if some of them have child threads dangling from them, which would be the case if an earlier thread user had spawned them.

Technically the "no threads" rules would be satisfied in the case that all children had terminated and been released prior to returning the thread to the pool, but Http Service functions are supposed to be quick in-and-out - being returned to the pool in milliseconds, and that tends to rule out child threads.

Longer-term processes aren't uncommon, but they have to be spawned by something like the application listener or a servlet's init() method (which doesn't run under a pool thread - but is no longer recommended as a thread-starter, regardless).

Simply spawning threads isn't sufficient to cause Tomcat to bog down, but if the child threads pause the parent thread, that would definitely gum up the works, and all sorts of mayhem can result from pulling "dirty" threads from the pool.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic