Bug#534418: boinc-client: client apps memory leaks cause OOM crashes

2009-09-08 Thread René Mayorga
forwarded 534418 http://boinc.berkeley.edu/trac/ticket/933
thanks

On Wed, Jun 24, 2009 at 01:19:52AM -0700, Michael R. Crusoe wrote:
 
 Client apps can have crufty code leading to OOM conditions. The attached 
 patch prevents this from taking down the system by configuring oom_adj to 
 favor removal.
 

Hi Michael

Thanks for you bug report and your patch, and sorry for the really late 
response,

I will review/apply this patch this week, indeed, is hard to work whith apps 
that
leave you out of memory, having oom_adj could be a good idea to prevent this.


Cheers
--
René Mayorga


signature.asc
Description: Digital signature


Bug#534418: boinc-client: client apps memory leaks cause OOM crashes

2009-06-24 Thread Michael R. Crusoe
Package: boinc-client
Version: 6.2.14-3
Severity: critical
Tags: patch
Justification: causes serious data loss


Client apps can have crufty code leading to OOM conditions. The attached patch 
prevents this from taking down the system by configuring oom_adj to favor 
removal.


-- Package-specific info:
-- Contents of /etc/default/boinc-client:
# This file is /etc/default/boinc-client, it is a configuration file for the
# /etc/init.d/boinc-client init script.

# Set this to 1 to enable and to 0 to disable the init script.
ENABLED=1

# Set this to 1 to enable advanced scheduling of the BOINC core client and
# all its sub-processes (reduces the impact of BOINC on the system's
# performance).
SCHEDULE=1

# The BOINC core client will be started with the permissions of this user.
BOINC_USER=boinc

# This is the data directory of the BOINC core client.
BOINC_DIR=/var/lib/boinc-client

# This is the location of the BOINC core client, that the init script uses.
# If you do not want to use the client program provided by the boinc-client
# package, you can specify here an alternative client program.
BOINC_CLIENT=/home/michael/src/BOINC/boinc
#BOINC_CLIENT=/usr/bin/boinc

# Here you can specify additional options to pass to the BOINC core client.
# Type 'boinc --help' or 'man boinc' for a full summary of allowed options.
#BOINC_OPTS=--allow_remote_gui_rpc
BOINC_OPTS=

-- System Information:
Debian Release: 5.0.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.18.8-linode16 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages boinc-client depends on:
ii  adduser3.110 add and remove users and groups
ii  ca-certificates20080809  Common CA certificates
ii  debconf [debconf-2.0]  1.5.24Debian configuration management sy
ii  libc6  2.7-18GNU C Library: Shared libraries
ii  libcurl3   7.18.2-8lenny2Multi-protocol file transfer libra
ii  libssl0.9.80.9.8g-15+lenny1  SSL shared libraries
ii  libstdc++6 4.3.2-1.1 The GNU Standard C++ Library v3
ii  lsb-base   3.2-20Linux Standard Base 3.2 init scrip
ii  python 2.5.2-3   An interactive high-level object-o
ii  zlib1g 1:1.2.3.3.dfsg-12 compression library - runtime

boinc-client recommends no packages.

Versions of packages boinc-client suggests:
pn  boinc-app-setinone (no description available)
pn  boinc-manager | kboincspy none (no description available)
ii  schedtool 1.2.10-1   Queries/alters process' scheduling

-- debconf information excluded

*** /home/michael/boinc-client.patch
--- /etc/init.d/boinc-client2009-01-18 20:08:16.0 -0700
+++ boinc-client2009-06-24 00:47:04.0 -0700
@@ -27,6 +27,7 @@
 BOINC_USER=boinc
 BOINC_DIR=/var/lib/boinc-client
 BOINC_CLIENT=/usr/bin/boinc
+BOINC_OOM_ADJ=15
 
 # Source defaults file. Edit that file to configure this script.
 if [ -e /etc/default/boinc-client ]; then
@@ -121,10 +122,11 @@
   fi
 fi
 
+children=`ps --ppid $pid -o pid= | tr '\n' ' '`
+
 if [ ! -x `which schedtool 2/dev/null` ]; then
   log_progress_msg schedtool not found
 else
-  children=`ps --ppid $pid -o pid= | tr '\n' ' '`
   (schedtool -n 19 -D $pid $children /dev/null \
  log_progress_msg idleprio) || \
   (schedtool -n 19 -B $pid $children /dev/null \
@@ -132,6 +134,8 @@
   (schedtool -n 19 -N $pid $children /dev/null \
  log_progress_msg normal)
 fi
+
+for BPID in ${pid} ${children}; do echo ${BOINC_OOM_ADJ}  
/proc/${BPID}/oom_adj; echo; done
   fi
   log_end_msg 0
 }
@@ -141,17 +145,21 @@
   STATUS=Status of $DESC:
   if is_running; then
 log_success_msg $STATUS running.
+
+children=`ps --ppid $pid -o pid= | tr '\n' ' '`
 if [ -x `which schedtool 2/dev/null` ]; then
   log_success_msg Scheduling of $DESC:
   schedtool $pid
 
-  children=`ps --ppid $pid -o pid= | tr '\n' ' '`
   if [ -n $children ]; then
 log_success_msg Scheduling of $DESC's children:
 schedtool $children
   fi
 fi
 
+log_success_msg OOM killer status for $DESC:
+for BPID in ${pid} ${children}; do echo PID ${BPID}: adj `cat 
/proc/${BPID}/oom_adj`, score `cat /proc/${BPID}/oom_score`; done
+
 # Display $BOINC_USER's cpu_share:
 uid=`id -u $BOINC_USER`
 cpu_share_file=/sys/kernel/uids/$uid/cpu_share


-- System Information:
Debian Release: 5.0.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.18.8-linode16 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages boinc-client depends on:
ii  adduser3.110 add and remove users and