Hi

The connectionTimeout parameter does not solve my problem. I don't know exactly what 
it does but it does not free a busy processor after some time. I will illustrate my 
problem with som source code. My servlet is sleeping 5 min to simulate that it is 
hanged/deadlocked. A wan't some way to automatcly kill/abort it after say 20s.

The servlets doGet method:

PrintWriter out = response.getWriter();
out.println("Start");
out.flush();
try {
    Thread.currentThread().sleep(300000); // Simulate hang
} catch(Exception x) {
    x.printStackTrace();
}
out.println("Finish");

My server.xml

<Server port="8005" shutdown="SHUTDOWN" debug="0">
        <Service name="Tomcat-fox">
                <Connector className="org.apache.coyote.tomcat4.CoyoteConnector" 
port="808" minProcessors="1" maxProcessors="5" acceptCount="1" 
connectionTimeout="20000"/>
                <Engine name="Tomcat-fox" defaultHost="localhost">
                      <Realm className="org.apache.catalina.realm.MemoryRealm" />
                        <Host name="localhost" appBase="">
                                <Context path="/fox_v2.0" 
docBase="c:\data\fox\fox_dev\site" debug="0" reloadable="true"/>
                        </Host>
                </Engine>
        </Service>
</Server>


Is there a way to do this? If tomcat can't can I do it myself with some extra thread 
monitoring and releaseing? I have tried killing (with Thread.destroy()) the thread but 
this doesn't seem to work, I only run out of memory after a while becuase resource 
probably arent freed correctly. How do I free a processor from my code?



Med vänliga hälsningar

Daniel Carlsson 
Gimlisoft AB
Email: [EMAIL PROTECTED]
Tel: 0709-744570, 031-189024

-----Ursprungligt meddelande-----
Från: Mauricio Nuñez <[EMAIL PROTECTED]>
Skickat: 2003-08-07  16:51:56
Till: Tomcat Users List
Ämne: Re: Freeing processors


> Hi
> 
> the HttpConnector haa a connectionTimeout parameter. Set this to a low 
> razonable value, as 20000 ( 20 seconds )
> 
> I was having a similar problem, using the JkConnector, but because my app 
> wasn't releasing db connections to the dbcp pool. Then, the "run out of 
> processors ..." is more a signal the leakaging in your app. (IMHO :-)
>  
> Check the timeout of your CORBA connections if available.
> Att
> 
> MN
> 
> 
> El Jue 07 Ago 2003 08:12, Daniel Carlsson escribió:
> > Hi
> >
> > My problem is that tomcat runs out of processors and I see "No processor
> > available, rejecting this connection" in the log file. By reading earlier
> > posts a I understand that each processor is a thread and is not freed until
> > it is returned by my code, my code is hanging somewhere.
> >
> > The problem is that my servlet (the only thing running in tomcat) only
> > "forwards" requests threw CORBA to a big app that I can't change, and its
> > in their the code hangs.
> >
> > So, how can I solve this? The perfect solution would be if tomcat could
> > automaticly free processors after some timeout ( 60 s) but I have not found
> > such a feature/setting, does it exist? If not, could I do some small hack
> > in my servlet that monitors and somehow terminates (kills thread or
> > something) the request after 60s and therby freeing the processor?
> >
> > I am running tomcat 4.1.12, java 1.4.0_04, redhat linux 9. I am using the
> > HttpConnector.
> >
> >
> > Thank you
> >
> > Daniel Carlsson
> > Gimlisoft AB
> > Email: [EMAIL PROTECTED]
> > Tel: 0709-744570, 031-189024
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to