本文内容针对霸爷的博客《 产生crashdump的三种方法 》进行实验验证和总结。
-=-=-=-=- 我是<我是歌手 >的分隔线 -=-=-=-=-
(以下为原文引用)
crashdump 对于 erlang 的系统来讲如同 core 对于 c/c++ 程序一样宝贵,对于系统问题的修复提供了最详细的资料。当然 erlang 很贴心了提供了网页版的 crashdump_view 帮助用户解读数据,使用方法如下:
crashdump_viewer:start().
因为 crashdump 文本文件里面记录了大量系统相关的信息,这些信息对于分析系统的性能,状态,排除问题提供了不可替代的功能。所以很需要在系统正常运作的时候,得到 crashdump 文件。
除了坐等系统在发生问题时,自动产生 crashdump 以外,另外还有三种方法来手动产生 crashdump 。 方法如下:
- erlang:halt("abort").
- 在 erlang shell 下输入 Ctrl+c + “大写的A”
- kill -s SIGUSR1 [erlang_pid]
-=-=-=-=- 我是<我是歌手 >的分隔线 -=-=-=-=-
(以下为实际验证)
【实验一】
某业务进程运行中
[root@Betty upu]# ps aux|grep upu
root 2185 0.0 0.0 12908 796 ? S 13:03 0:00 /opt/mcu/upu/erts-6.0/bin/run_erl -daemon /tmp//opt/mcu/upu/ /opt/mcu/upu/log exec /opt/mcu/upu/bin/upu console ''
root 2186 12.3 1.1 507936 43688 pts/0 Ssl+ 13:03 0:00 /opt/mcu/upu/erts-6.0/bin/beam.smp -K true -- -root /opt/mcu/upu -progname upu -- -home /root -- -boot /opt/mcu/upu/releases/1/upu -mode embedded -config /opt/mcu/upu/etc/upu.config -mnesia dir '/opt/mcu/upu/data' -sname upu@Betty -setcookie upu -- console
root 2237 0.0 0.0 103252 848 pts/6 S+ 13:03 0:00 grep upu
root 2525 0.0 0.0 10956 396 ? S Feb01 0:12 /opt/mcu/upucore/erts-6.0/bin/epmd -daemon
[root@Betty upu]#
通过 remsh 登录,再通过 Ctrl+c,a 退出
[root@Betty upu]# ./bin/upu remote_console
Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V6.0 (abort with ^G)
(upu@Betty)1>
(upu@Betty)1>
(upu@Betty)1>
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
(v)ersion (k)ill (D)b-tables (d)istribution
a
[root@Betty upu]#
可以看到,上述操作对业务进程无影响(不产生影响的原因见后文)。
[root@Betty upu]#
[root@Betty upu]# ps aux|grep upu
root 2185 0.0 0.0 12908 796 ? S 13:03 0:00 /opt/mcu/upu/erts-6.0/bin/run_erl -daemon /tmp//opt/mcu/upu/ /opt/mcu/upu/log exec /opt/mcu/upu/bin