Pierpaolo Fumagalli <[EMAIL PROTECTED]> wrote:
>
>[EMAIL PROTECTED] wrote:
>> After running for several hours, servicing thousands of requests, jserv
>> suddenly died with
>>
>> Exception in thread "main" java.lang.OutOfMemoryError
>>      at java.lang.Thread.start(Native Method)
>>      at java.lang.Thread.start(Compiled Code)
>>      at org.apache.jserv.JServ.main(Compiled Code)

It happened again about an hour after I posted this.

>> Of course, I understand that this means that jserv ran out of memory.
But
>> why? And how can I avoid this?
>>
>Can you try removing logging - in jserv.properties put:
>
>log=false
>log.file=/usr/local/apache/logs/jserv_log.log
>log.timestamp=truelog.dateFormat=[dd/MM/yyyy HH:mm:ss:SSS zz]
>log.channel.init=true
>log.channel.terminate=true
>log.channel.serviceRequest=true
>log.channel.authentication=false
>log.channel.requestData=false
>log.channel.responseHeaders=false
>log.channel.signal=true
>log.channel.exceptionTracing=true
>log.channel.servletManager=true
>
>Give it a shot....

Ok thanks. I did that. So far so good.

>(If you want to try it harder, you could look @ our JMeter...)

I did. I ran it full blast for several hours and all was as it should
be. I also tried running a much more interesting test using a perl
script where I made it go through the traffic of the past week as fast
as it could, from three different streams. It was very much stress
tested. Everything looked beautiful before I brought it online.

Out of paranoia I have running on my box a little script that will
restart apache if another out of memory error occurs:

#!/usr/local/bin/perl -w

# this is a lovely hack for recovering from out of memory errors in jserv

$log='/opt/apache/logs/error';
$ap='/opt/apache/bin/apachectl';

open(LOG, $log) || die "couldn't open $log: $!\n";

# jump to the end of the log

seek(LOG, 0, 2);
$| = 1;

# recover from log roll-overs by keeping track of the size of the log

my $s = -s $log;

while(1){
  while(<LOG>){
    if(/Exception in thread \"main\" java\.lang\.OutOfMemoryError/){
      system("$ap stop") || die $!;
      sleep 7;
      system("$ap start") || die $!;
      my @lt = localtime(time);
      $year = $lt[5] + 1900;
      $month = $lt[4] + 1;
      $day = $lt[3];
      printf("yikes %d%.2d%.2d\n", $year, $month, $day);
    }
  }
  sleep 1;
  my $s1 = -s $log;
  if($s1 < $s){
    close(LOG);
    open(LOG, $log);
  } else {
    seek(LOG, 0, 1);
  }
  $s = $s1;
}
----------------------------------------------------------------
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material.  Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.   If you received
 this in error, please contact the sender and delete the material from any
computer.




----------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://www.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to