erlang宕机,一般来说都是因为内存分配失败。此时可以通过erl_crashdump_analyzer.sh分析dmp文件,如下:
https://github.com/ferd/recon/blob/master/script/erl_crashdump_analyzer.sh
[root@localhost239 rabbitmq]# ./erl_crashdump_analyzer.sh erl_crash.dump analyzing erl_crash.dump, generated on: Wed Nov 4 11:32:56 2020 Slogan: eheap_alloc: Cannot allocate 1318267840 bytes of memory (of type "old_heap"). Memory: === processes: 985 Mb processes_used: 985 Mb system: 507 Mb atom: 1 Mb atom_used: 1 Mb binary: 451 Mb code: 22 Mb ets: 13 Mb --- total: 1493 Mb Different message queue lengths (5 largest different): === 3799 0 Error logger queue length: === 0 File descriptors open: === UDP: 0 TCP: 87 Files: 1 --- Total: 88 Number of processes: === 3799 Processes Heap+Stack memory sizes (words) used in the VM (5 largest different): === 1 114432973 1 121536 1 75113 1 46422 2 28690 Processes OldHeap memory sizes (words) used in the VM (5 largest different): === 1 833026 1 514838 1 318187 2 196650 2 121536 Process States when crashing (sum): === 1 CONNECTED 3 CONNECTED|BINARY_IO 4 CONNECTED|BINARY_IO|PORT_LOCK 1 CONNECTED|BINARY_IO|SOFT_EOF|PORT_LOCK 83 CONNECTED|PORT_LOCK 1 Current Process Garbing 1 Current Process Internal ACT_PRIO_NORMAL | USR_PRIO_NORMAL | PRQ_PRIO_NORMAL | ACTIVE | GC | DIRTY_ACTIVE_SYS | DIRTY_RUNNING_SYS 1 Current Process Internal ACT_PRIO_NORMAL | USR_PRIO_NORMAL | PRQ_PRIO_NORMAL | ACTIVE | RUNNING 1 Current Process Running 1 Garbing 1 Internal ACT_PRIO_HIGH | USR_PRIO_HIGH | PRQ_PRIO_HIGH | OFF_HEAP_MSGQ 4 Internal ACT_PRIO_MAX | USR_PRIO_MAX | PRQ_PRIO_MAX 1 Internal ACT_PRIO_MAX | USR_PRIO_MAX | PRQ_PRIO_MAX | OFF_HEAP_MSGQ 3785 Internal ACT_PRIO_NORMAL | USR_PRIO_NORMAL | PRQ_PRIO_NORMAL 1 Internal ACT_PRIO_NORMAL | USR_PRIO_NORMAL | PRQ_PRIO_NORMAL | ACTIVE | GC | DIRTY_ACTIVE_SYS | DIRTY_RUNNING_SYS 7 Internal ACT_PRIO_NORMAL | USR_PRIO_NORMAL | PRQ_PRIO_NORMAL | OFF_HEAP_MSGQ 3798 Waiting