erlang的crash_core_dump解读

正常情况下 当erlang进程发生错误没有catch的时候 emulator就会自动产生erl_crash.dump,来提供crash的时候的emulator最详细的情况,类似于unix的core dump. 其中下边几个env变量控制dump产生的行为:

ERL_CRASH_DUMP 
If the emulator needs to write a crash dump, the value of this variable will be the file name of the crash dump file. If the variable is not set, the name of the crash dump file will be erl_crash.dump in the current directory.

ERL_CRASH_DUMP_NICE 
Unix systems: If the emulator needs to write a crash dump, it will use the value of this variable to set the nice value for the process, thus lowering its priority. The allowable range is 1 through 39 (higher values will be replaced with 39). The highest value, 39, will give the process the lowest priority.

ERL_CRASH_DUMP_SECONDS 
Unix systems: This variable gives the number of seconds that the emulator will be allowed to spend writing a crash dump. When the given number of seconds have elapsed, the emulator will be terminated by a SIGALRM signal.
 

除了被动产生dump以外, 用户还可以主动产生dump 方法有2种:
1.  erl控制台 CTRL+C  然后+A
2. kill -s SIGUSR1 erlpid

产生的erl_crash.dump是个纯文本, 可能非常大,特别是你有成千上万的process和port什么的,对于系统调优有非常大的意义。

察看方式参见文档 erl5.5.5/erts-5.5.5/doc/html/crash_dump.html 请注意内存使用有的是byte  有的是WORD.

更方便的是用工具 webtool 来察看 web界面 比较直观。

你可能感兴趣的:(html,c,Web,erlang,unix)