Re: Freeing processors
Hi With RH 8, you can see the threads using the option -m Att Mauricio El Jue 07 Ago 2003 09:17, Jon Wingfield escribió: Yep. Since RH 8 the ps command only shows the main java process. In previous versions ps showed the parent process and a child process for each thread the java app spawned. The previous behaviour often lead to confusion relating to memory assignment so i guess that's why RH changed it. Personally, I find the change annoying coz it was an easy way to see how many threads the app had spawned. Jon Donaldson Sgt Michael J wrote: I have a question along these lines... I am running jakarta-tomcat-4.1.18 on 4 different severs. 3 are Red Hat 8.0 and 1 Red Hat 6.2. Same tomcat configuration on all of them. ps -el shows one java process on the Red Hat 8.0 but on the 6.2 box I have upward of 30 processes for java. Is there a reason for this? R/S Magilla 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]
Re: Freeing processors
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(30); // 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=2/ 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 2 ( 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]
Re: Freeing processors
I think the connectionTimeout parameter controls how long the container waits before giving up on trying to obtain a request processor from the pool. Once the processor has been obtained a runaway/blocked process can stop the processor from being released. One way to get around this would be, for example, use a worker thread : doGet() { final Object lock = new Object(); Thread worker = new Thread(new Runnable() { public void run() { // code to do CORBA stuff here ... // CORBA stuff returned so kick the waiting servlet synchronized (lock) { lock.notify(); } } }); try { synchronized (lock) { worker.start(); lock.wait(20*1000); // times out in 20s or is notified } } catch (InterruptedException ie) { } // work out whether CORBA invocation worked and // generate relevant response ... } Note: the code above was thrown together in 5mins for demonstration purposes. If i had to implement this I definitely wouldn't create a new Thread for each request; i would use a Thread pool to run Runnable objects. The Runnables would gather the data from the CORBA invocation for use later in the servlet. Hope this gets you started on a solution, Jon Daniel Carlsson wrote: 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(30); // 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=2/ 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 2 ( 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
Re: Freeing processors
Yep. Since RH 8 the ps command only shows the main java process. In previous versions ps showed the parent process and a child process for each thread the java app spawned. The previous behaviour often lead to confusion relating to memory assignment so i guess that's why RH changed it. Personally, I find the change annoying coz it was an easy way to see how many threads the app had spawned. Jon Donaldson Sgt Michael J wrote: I have a question along these lines... I am running jakarta-tomcat-4.1.18 on 4 different severs. 3 are Red Hat 8.0 and 1 Red Hat 6.2. Same tomcat configuration on all of them. ps -el shows one java process on the Red Hat 8.0 but on the 6.2 box I have upward of 30 processes for java. Is there a reason for this? R/S Magilla 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]
Re: Freeing processors
Hi the HttpConnector haa a connectionTimeout parameter. Set this to a low razonable value, as 2 ( 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]
RE: Freeing processors
I have a question along these lines... I am running jakarta-tomcat-4.1.18 on 4 different severs. 3 are Red Hat 8.0 and 1 Red Hat 6.2. Same tomcat configuration on all of them. ps -el shows one java process on the Red Hat 8.0 but on the 6.2 box I have upward of 30 processes for java. Is there a reason for this? R/S Magilla 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
Re: Freeing processors
Thanks for the info. I should have RTFM ;) Mauricio Nuñez wrote: Hi With RH 8, you can see the threads using the option -m Att Mauricio El Jue 07 Ago 2003 09:17, Jon Wingfield escribió: Yep. Since RH 8 the ps command only shows the main java process. In previous versions ps showed the parent process and a child process for each thread the java app spawned. The previous behaviour often lead to confusion relating to memory assignment so i guess that's why RH changed it. Personally, I find the change annoying coz it was an easy way to see how many threads the app had spawned. Jon Donaldson Sgt Michael J wrote: I have a question along these lines... I am running jakarta-tomcat-4.1.18 on 4 different severs. 3 are Red Hat 8.0 and 1 Red Hat 6.2. Same tomcat configuration on all of them. ps -el shows one java process on the Red Hat 8.0 but on the 6.2 box I have upward of 30 processes for java. Is there a reason for this? R/S Magilla 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]