Coredump analysis

更新时间:
复制 MD 格式

This topic describes the Coredump analysis feature of Node.js Performance Platform.

Overview

When your application crashes, the operating system automatically records key information at the time of the crash. This information includes memory allocation, the program counter, and the stack pointer. This data is saved in a Coredump file. After you retrieve the Coredump file, you can use tools such as mdb, gdb, and lldb to parse the file and diagnose the cause of the crash.

In other words, Coredump files help you reconstruct the application's state at the time of failure to locate problems. Node.js Performance Platform provides several features for Coredump files generated by Node.js applications on your server. These features include file generation alerting, automatic saving, one-click dump (commandx >= v1.5.2), and intelligent analysis. You can also manually upload Coredump files for analysis.

File generation alerting

If you enable the `ulimit -c unlimited` setting, a Coredump file is automatically generated when a Node.js process crashes. Because you might not be aware when this happens, Node.js Performance Platform provides an alerting feature to notify you when a Coredump file is created.

Go to the Alerting page for your application and configure the settings to add a Coredump file alert.

coredump

Set Type to coredump. In the Threshold Expression field, enter @coredumps > 0. Configure the other options as needed, and then click Add Alerting Rule.

Automatic saving

Agenthub automatically reports and saves the paths of Coredump files generated by Node.js applications on the server. By default, the system scans the working directory (pwd) of the Node.js application. You can also add the coredir configuration item to the agenthub startup configuration file to specify additional folders to scan for Coredump files. For example:

{
 "appid": "xxx",
 "secret": "xxxxxx",
 "coredir": ["/home/alinode/test"]
}

The value for `coredir` is an array, which lets you configure multiple folders. After you configure and start agenthub, it will scan the /home/alinode/test folder for Coredump files in addition to the working directory (pwd) of the Node.js application.

To view the automatically reported records, go to the page for your application in Node.js Performance Platform. In the sidebar, hover your mouse over the Files button, as shown in the following figure.

Then, select Coredump Files to view the Coredump file records.

Note: Only newly generated Coredump files are reported. Records for files that have not been dumped are retained for one week.

One-click dump

To analyze a Coredump file, you must first transfer the file from your server to the cloud. The analysis also requires the corresponding Node.js executable file, so you must specify the runtime version of the application that generated the Coredump file.

Note: The dump feature requires that the commandx dependency for agenthub or egg-alinode is version 1.5.2 or later. Otherwise, the dump will fail.

Set the runtime version

Click Set runtime version, as shown in the following figure.

The runtime version format is alinode-vA.B.C or node-vA.B.C. For example, alinode-v3.11.5, as shown in the following figure.

Click Save. Ensure that the runtime version you set matches the actual version that was used to run the application.

Dump the Coredump file

After you set the runtime version, click the Dump button to transfer the Coredump file from your server to the cloud, as shown in the following figure.

Intelligent analysis

After the Coredump file is successfully transferred, click the Analyze button to start the intelligent analysis. For more information, see Uncovering the Scene of the Crime in Node.js: Restoring Online Abnormalities with Coredump.

Manual upload

In addition to analyzing Coredump files generated on the server, you can also manually upload a Coredump file for analysis. Click the Upload File button.

In the dialog box that appears, follow the prompts to select the Coredump file and its corresponding Node.js executable file from your local machine. Then, click Submit to upload the files.

modal

Note: The Coredump file must have a .core extension, and the Node.js executable file must have a .node extension. For easy reference, the recommended naming convention for the executable file is <os info>-<alinode/node>-<version>.node, for example, centos7-alinode-v4.2.2.node. The Coredump file and the Node.js executable file must have a one-to-one correspondence. This means that the Coredump file must have been generated by a process that was started with that specific Node.js executable file. If they do not correspond, the analysis results will be invalid.