Can you be more specific on what you mean by "crashing"? Interpreted languages shouldn't crash and generally if they do it's something wrong with the interpreter. Are you using cPython?

On 5/7/2010 1:48 AM, David Zejda wrote:
Hi,

my web2py instance (about 10000 pageviews, 300000+ ajax requests
daily) crashes about daily. As a workaround I have a script which
(re)starts the server when either memory usage exceeds certain
threshold or when the server is completely down. I run the script from
cron every minute.

#! /bin/sh

A=`netstat -tlnp | grep 8000`
TIME=`date`
LOG='/var/log/web2py/keepalive.log'

if [ "$A" ];
then
     B=`echo $A | cut -d " " -f 7`
     PID=${B%/*}
     MEM=`ps -p $PID -o vsz | tail -n 1`
     if [ "$MEM" -gt 2000000 ];
     then
         echo "$TIME       $PID    $MEM    MEMORY">>  $LOG
         echo "Web2py memory $MEM on $TIME =>  restart." | mail
m...@mail.com -s 'Web2py fail!'
         /etc/init.d/web2py restart
     else
         echo "$TIME       $PID    $MEM    OK">>  $LOG
     fi
else
     echo "$TIME   FAIL">>  $LOG
     echo "Web2py failed on $TIME" | mail m...@mail.com -s 'Web2py fail!'
     /etc/init.d/web2py restart
fi

I know I should find time to try to examine cause of memory leaking
with guppy-heapy. But I think the crashing is another issue, not
directly related to the leaking. Access logs revealed no direct
relation to any particular controller or function. Also, after web2py
upgrade it has not changed.

Do you have any idea how to reveal the cause of crashing?

Thanks!
David

Reply via email to