Re[3]: memory and/or ms problem

2001-03-02 Thread Gerd Trautner

hi randy, thanks for your tips!

i think i found the reason for the growing memory consumption of my
servlets.

preconditions:
i use servlets to get data out and in a mysql database and generate
html pages with PrintWriter.print(...) statements.
my servlets often use:
...
Statement Stmt = C.createStatement();
ResultSet RS = Stmt.executeQuery("SELECT ..,..,.. from ..");
while (RS.next())
{
   //do something with data
   out.println();
}
...

on each request an instance of a servlet is created and the servlet
starts reading data out of the database and writes it in the
PrintWriter stream.
But what happens if the PrintWriter has no target (because the user
sends another request or more then one other requests)? I am not sure,
but it seems that the servlet tries to write to the PrintWriter stream
and has no success. the result is a growing amount of instances of a
servlet which try to write to a PrintWriter and have no success. and
it seems they keep try writing (and consuming memory) a long time ...

my solution is to check the error state of a Printwriter before
writing in it. so the code from above looks like this:
...
Statement Stmt = C.createStatement();
ResultSet RS = Stmt.executeQuery("SELECT ..,..,.. from ..");
while (RS.next())
{
   if (out.checkError()) break;
   //do something with data
   out.println();
}
...

for my application it seems to work, but i think there must be a better
way,
(why does the write statement throws an exception and the print
statement not?)
any ideas?

Gerd

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




memory and/or ms problem

2001-03-01 Thread Gerd Trautner

Hi tomcat-users,

I am having some memory related troubles with my servlets running on
tomcat 3.2.1 on an win nt 4 workstation machine.
I read all previous messages in the list with the term "memory" in it,
but everything i try does not help.

problem: the memory consumption of the java.exe increases slightly, the
over all memory consumption of the system increases fast and memory is
not released. after a week (and about 400 hits or so) the server runs
out of memory (tomcat gives a OutOfMemoryError and quits).

what i did:
- set java max heap size (nothing changed)
- set max_threads (30), max_spare_threads(20) and min_spare_threads(5)
  for both http and https ConnectionHandler
- set session-timeout to 1 Minute
- added System.gc() to end of every servlet

my application uses servlets and mysql, i close every mysql connection
and i am not able to find anything i could change to get the memory
freed.

I also use ms-stresstool and i can simulate this memory-problem.

could anyone give me some assistance please?

thanks,
Gerd



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




Re: memory and/or ms problem

2001-03-01 Thread Oleg L. Sverdlov

I have the same problem too. I use Windows 2000 Server, Tomcat 3.2.1 and 
isapi_connect.dll

I've already asked this question on the list, and nobody seems to know.

Oleg L. Sverdlov
Web Development Dept.

Netmount Networks 
Raanana, Israel. 

http://www.netmount.com
Phone: +972-9-745-5220
Fax: +972-9-745-2521

- Original Message - 
From: "Gerd Trautner" [EMAIL PROTECTED]
To: "tomcat-user" [EMAIL PROTECTED]
Sent: Thursday, March 01, 2001 1:16 PM
Subject: memory and/or ms problem


 Hi tomcat-users,
 
 I am having some memory related troubles with my servlets running on
 tomcat 3.2.1 on an win nt 4 workstation machine.
 I read all previous messages in the list with the term "memory" in it,
 but everything i try does not help.
 
 problem: the memory consumption of the java.exe increases slightly, the
 over all memory consumption of the system increases fast and memory is
 not released. after a week (and about 400 hits or so) the server runs
 out of memory (tomcat gives a OutOfMemoryError and quits).
 
 what i did:
 - set java max heap size (nothing changed)
 - set max_threads (30), max_spare_threads(20) and min_spare_threads(5)
   for both http and https ConnectionHandler
 - set session-timeout to 1 Minute
 - added System.gc() to end of every servlet
 
 my application uses servlets and mysql, i close every mysql connection
 and i am not able to find anything i could change to get the memory
 freed.
 
 I also use ms-stresstool and i can simulate this memory-problem.
 
 could anyone give me some assistance please?
 
 thanks,
 Gerd




Re[2]: memory and/or ms problem

2001-03-01 Thread Gerd Trautner

Hi Randy,
Thursday, March 01, 2001, 1:15:06 PM, you wrote:


RL Look at your code.  My experience has been that Tomcat doesn't leak
RL any memory.  Check that you haven't set your sessions to never time out
RL (otherwise each session will continue to collect digital dust).  Also check
RL that you don't have any structures in memory of static classes that continue
RL to grow with each request (in-memory logs that flush to disk when some event
RL happens would one example of a place to look).


Did some additional test and: you are rigth, something in my code is
the reason for the growing memory consumption.but i can't imagine what
it is.

so the test i did was:
stress a servlet that just writes a text. i stressed it really and
nothing happend, the memory consumption growed, but gc brought it down
to starting level.

wondering...
Gerd



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