tomcat-users mailing list archives

Hello, Martin Gainty
Now i got some progress.
I used Borland Optimizeit 6.0's Thread Debugger and found that in my web application,
lots of threads are "defunct".
As I said before, my web application is based on struts framework and I wrote a plug-in
in my app. This plug-in named "AppInfoCachePlugIn" will be loaded and executed when tomcat
starts up. In this plugin, I wrote a class which extends from Thread and start it. Code like
this:
////////////////////////////////////////////////////////////////////////////////////////////
tfn_handle = new ServerNotify(); // ServerNotify is extended from Thread
tfn_handle.setName("ServerNotifyThread");
......
// start the thread
tfn_handle.start();
////////////////////////////////////////////////////////////////////////////////////////////
In "ServerNotify" class, I create a UDP ServerSocket and listen at 10010 port. When a
request comes in, ServerNotify will create a new Thread named "SendMailThread" and do something.
Code like this:
////////////////////////////////////////////////////////////////////////////////////////////
// construct the sendmail thread
SendMailThread sml = new SendMailThread();
sml.setName("SendMailThread");
......
sml.start();
////////////////////////////////////////////////////////////////////////////////////////////
Now I found that all "SendMailThread" cannot be released by gc. The thread's status is
"defunct" -- the run function of SendMailThread has been executed. That means the instances
of "SendMailThread" were referenced by someone -- Tomcat?
So, the problem is:
1. Can I create threads in a web application?
2. How to create threads that can be released gracefully in a web app?
======= 2005-12-17 11:40:00 Martin Wroted：=======
>I Agree with David-
>Send us your most recent log from $CATALINA_HOME/logs
>regards,
>Martin-
>----- Original Message -----
>From: "David Smith" <dns4@cornell.edu>
>To: "Tomcat Users List" <users@tomcat.apache.org>
>Sent: Saturday, December 17, 2005 11:03 AM
>Subject: Re: Help, Tomcat 4.1.31 no response
>
>
>> Have you taken a look at your log files? It could be a memory leak in
>> your app as well.
>>
>> -- David
>>
>> zhang chao wrote:
>>
>>> My Operating System: RedHat 9
>>> JVM version: j2sdk 1.4.2_09
>>> Tomcat: tomcat 4.1.31
>>> Hardware configuration: Dual PIII 1G, 512MB memory
>>> users: about 30
>>>
>>> I have a web application and have deployed to my tomcat 4.1.31. The
>>> problem is: tomcat will no response after running about 1 week. When i
>>> enter the URL in IE and press enter, there is nothing happen except
>>> the progress-bar of IE is increasing, after about 2 minutes, IE
>>> displayed "Cannot display this page". The tomcat's process in
>>> server(process named "java") has no any exception, the memory usage
>>> and cpu usage is normal.
>>>
>>> I think that maybe tomcat had no idle thread in thread pool to serve
>>> for requests so, it kept waiting for an thread available. If this is
>>> true, my web application must have bugs which exhausted the thread and
>>> resources. But i don't know, in what situation, these threads cannot
>>> be callback by tomcat. My database resultsets, statements and
>>> connections are released(MySQL database, version 3.23.58, used
>>> tomcat's dbcp connection pool), my network sockets instance are closed
>>> and any no-use class instances have been set to null.
>>>
>>> There is another important issue: when tomcat had no response, the
>>> only thing I can do is to restart the tomcat server but, when i
>>> invoked the tomcat's "shutdown.sh" script, I found that the 8080 port
>>> was not listening but the "java" process was still alive. I must use
>>> "kill -9 <the java process's pid>" to kill the process.
>>> my web application is based on struts framework. When a request
>>> arrives, a Action Servlet is invoked then, servlet will invoke my
>>> singleton mode logic class, logical classes will fill lots of entity
>>> classes and return them back to the client. Did these singleton-mode
>>> logical class cause the problem?
>>>
>>> My English is poor and I hope everybody can read me. Any help and
>>> suggestion will be appreciated. Thanks.
>>>
>>> _________________________________________________________________
>>> 享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>.
= = = = = = = = = = = = = = = = = = = =
致
礼！
kartwall
zc_kyo@hotmail.com
2005-12-19
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org