[asterisk-users] astmanproxy and core dump

Tzafrir Cohen tzafrir.cohen at xorcom.com
Tue Mar 4 08:10:04 CST 2008


On Tue, Mar 04, 2008 at 01:53:07PM +0000, Julian Lyndon-Smith wrote:
> Does any one know how to change astmanproxy to be able to
> 
> a) compile without optimisations
> b) dump a core
> 
> I've had it crash several times over the past couple of months, but 
> there is no way to debug what's going on.
> 
> I like the way a core is produced when (if!) * crashes, and would like 
> to have the same thing on astmanproxy.

astmanproxy's code is much simpler, and hence much more chances for it
not to crash.

However, here's an interesting feature for you:

custom location for core dumps:

  echo '/tmp/core.%e.%t' >/proc/sys/kernel/core_pattern

But you can take this a step further (the following is completely
untested)

  echo '| /usr/local/sbin/core_handler "%e"' >/proc/sys/kernel/core_pattern

cat <<EOF >/usr/local/sbin/core_handler
#!/bin/sh -e
# core_handler: handle dumped process cores.

# input: $1: process name, stdin: core file.

logger "Got a core file for "$1"

case "$1" in
astmanproxy) : ;;
*) exit 0;;
esac

core_file=`mktemp /tmp/core.$1.XXXXXX`
cat >$core_file

# add here lines to restart process

# add here lines to generate a trace and mail it to you
EOF

chmod +x /usr/local/sbin/core_handler


No change to the invocation of the daemon if it actually works well.

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir



More information about the asterisk-users mailing list