Running ser under valgrind
August 3, 2005
You can run the pic-ser service under Valgrind to help collect information for debuggin any problems. Valgrind (http://valgrind.org) is a tool for detecting memory management and threading bugs as well as for profiling.
How to use it on a Red Hat machine:
1) install it: up2date valgrind
2) Stop current instance of ser by one of the following methods:
a) /etc/rc.d/init.d/ser stop
b) serctl stop
c) service ser stop
d) killall ser
e) killall -9 ser
You can check on running ser processes with 'ps -ef | grep /ser'
3) Start ser under valgrind:
nohup valgrind /usr/sbin/ser -f /etc/ser/ser.cfg > /etc/ser/ser.log 2>&1 &
4) You can monitor ser by looking at the output in /etc/ser/ser.log
5) You can run the attached python script to monitor the output and send valgrind error messages to contact of your choice (fill in your contact's email address):
tail -f /etc/ser/ser.log | watchlog.py
#!/usr/bin/python
import sys, re, os
f = sys.stdin
in_valgrind = 0
log_lines = []
valgrind_lines = ''
for line in f:
sys.stdout.write(line)
if re.match('^==[0-9]+', line):
in_valgrind = 1
valgrind_lines = valgrind_lines + line
else:
if in_valgrind:
p = os.popen('mail -s pals-dev [email-addr-ofcontactofyourchoice]', 'w')
for l in log_lines:
p.write(l)
p.write(valgrind_lines)
p.close()
valgrind_lines = ''
in_valgrind = 0
else:
log_lines.append(line)
if len(log_lines) > 10:
log_lines = log_lines[1:]
pass
pass
pass