Re: "Segment Violation" reported by Squid

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sat, 04 Sep 1999 01:54:02 +0200

If your platform supports gdb debugging then I have a RunCache
replacement which gets stacktraces runtime when errors happen. This is
what I use when I track assertion errors or segfaults on production
machines. The technique was originally developed to get stacktraces from
async-io enabled Squids on Linux (Linux can't generate a core from a
pthreads application) and then finetuned.

--
Henrik Nordstrom
Spare time Squid hacker
Alastair Johnson wrote:
> The assertion failure is "client_side.c:1194: "size > 0"".
> I tried all suggestions listed there,  and it just would NOT coredump.

#!/bin/sh
# Modified RunCache script to get automated stacktraces on failures
#

prefix=/usr/local/squid
exec_prefix=${prefix}
logdir=${prefix}/logs
PATH=${exec_prefix}/bin:/bin:/usr/bin
export PATH

conf=""
if test "$1" ; then
        conf="-f $1"
        shift
fi

cat <<EOF >${prefix}/etc/stacktrace.gdb
handle all pass nostop noprint
handle SIGSEGV stop print
handle SIGBUS stop print
handle SIGABRT stop print
break fatal
run -NDYd3 $conf
bt
c
bt
c
bt
c
bt
c
bt
c
bt
quit
EOF

failcount=0
while : ; do
        echo "Running: squid -NDYd3 $conf >> $logdir/squid.out 2>&1"
        echo "Startup: `date`" >> $logdir/squid.out
        start=`date '+%d%H%M%S'`
        gdb --batch -x ${prefix}/etc/stacktrace.gdb ${prefix}/bin/squid >> $logdir/squid.out 2>&1
        stop=`date '+%d%H%M%S'`
        t=`expr $stop - $start`
        if test 0 -le $t -a $t -lt 5 ; then
                failcount=`expr $failcount + 1`
        else
                failcount=0
        fi
        if test $failcount -gt 5 ; then
              echo "DebugCache: EXITING DUE TO REPEATED, FREQUENT FAILURES" >&2
                exit 1
        fi
        sleep 10
done
Received on Fri Sep 03 1999 - 18:11:44 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:48:15 MST