A fault location method and computing device

By acquiring the operating information of computing devices and analyzing the virtual memory segments and file cache sizes of processes, the problem of low efficiency and accuracy in fault location in existing technologies is solved, and fast and accurate fault code identification is achieved.

CN118295834BActive Publication Date: 2025-11-21HENAN KUNLUN TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410294804.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-14
Publication Date
2025-11-21
Estimated Expiration
2044-03-14

AI Technical Summary

Technical Problem

Existing technologies provide coarse-grained information when locating memory overflow faults, resulting in low efficiency and accuracy, and require the installation of third-party tools for finer-grained analysis.

Method used

By acquiring the operating information of the computing device, including the memory usage information of each process and the cache information of files, we can analyze the size of multiple virtual memory segments of the process and the size of files cached in memory, determine the target virtual memory segment and the target file, and quickly locate the fault code.

Benefits of technology

It improves the accuracy and efficiency of fault location, reduces reliance on third-party tools, and can quickly identify code that causes memory overflow, thus reducing the probability of memory overflow.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118295834B_ABST
    Figure CN118295834B_ABST
Patent Text Reader

Abstract

The application provides a fault positioning method and a computing device. The method comprises the following steps: obtaining running information of the computing device; and determining fault information of the computing device according to the running information, wherein the running information comprises at least one of the following: memory usage information of each process or cache information of each file, the memory usage information of the process comprises actual memory occupation sizes corresponding to a plurality of virtual memory segments allocated for the process, and the cache information comprises a file cache size of the file cached to the memory. The method provided in the application embodiment can efficiently and accurately position the fault.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computing devices, and particularly relates to a fault positioning method and a computing device. BACKGROUND

[0002] When available memory cannot meet the needs of the currently running program, an out of memory (OOM) mechanism is triggered to terminate a certain process to release memory. Improper use of memory by the process is the main cause of OOM, so when OOM is triggered, the operating system needs to record memory-related information of the process so as to enable the user to locate the specific cause.

[0003] In the related art, when OOM occurs, the total occupation sizes of different types of memory and the total occupation sizes of memory of each process are generally counted to perform fault positioning, that is, to determine the program code corresponding to the process that causes the memory overflow.

[0004] However, the method in the related art can only perform fault positioning according to the total occupation sizes of different types of memory and the total occupation sizes of memory of each process, and there may be problems of low efficiency and accuracy of fault positioning. SUMMARY

[0005] Embodiments of the present application provide a fault positioning method and a computing device. The method of embodiments of the present application can efficiently and accurately locate faults.

[0006] In a first aspect, embodiments of the present application provide a fault positioning method, comprising:

[0007] obtaining running information of a computing device;

[0008] determining fault information of the computing device according to the running information;

[0009] The running information includes at least one of the following: memory usage information of each process or cache information of each file, the memory usage information of the process includes actual memory occupation sizes corresponding to a plurality of virtual memory segments allocated for the process, and the cache information includes file cache sizes of files cached to the memory.

[0010] The beneficial effects of the embodiments of the present application are as follows: the computing device can acquire running information of the computing device. The running information includes at least one of memory usage information of each process (actual memory occupation size corresponding to a plurality of virtual memory segments allocated to the process) and cache information of each file (size of the file cached to the memory). The computing device can determine fault information according to the running information. In the case where the running information includes the memory usage information of each process, compared with the related art in which the fault information is determined according to the total occupation size of the memory of the process, the embodiments of the present application determine the fault information according to the actual memory occupation size corresponding to the plurality of virtual memory segments corresponding to the process. The embodiments of the present application analyze information with finer granularity, and thus can more accurately locate the fault information. In the case where the running information includes the cache information of each file, compared with the related art in which the fault information is determined according to the total occupation size of the file cache, the embodiments of the present application determine the fault information according to the size of each file cached to the memory. The embodiments of the present application analyze information with finer granularity, and thus can more accurately locate the fault information.

[0011] In addition, compared with the related art in which, if finer-grained information needs to be analyzed, time needs to be consumed, and a third-party tool needs to be installed on the computing device, the embodiments of the present application can analyze finer-grained information without installing an additional third-party tool, and thus improve the determination efficiency of the fault information. In summary, through the method of the embodiments of the present application, the fault information can be more efficiently and accurately located, so that the maintenance personnel can timely process based on the fault information to avoid the memory overflow situation.

[0012] In an implementation manner, the running information includes the memory usage information of each process; and the fault information of the computing device is determined according to the running information, including:

[0013] According to the actual memory occupation size corresponding to the plurality of virtual memory segments allocated to each process, a target virtual memory segment is determined from the plurality of virtual memory segments corresponding to at least one process;

[0014] According to the process corresponding to the target virtual memory segment, the fault information is determined.

[0015] Advantages of the present implementation: The computing device can determine a target virtual memory segment from the plurality of virtual memory segments corresponding to at least one process according to actual memory occupation sizes corresponding to the plurality of virtual memory segments allocated to each process. The computing device can regard the target virtual memory segment as a virtual memory segment that causes abnormal memory usage and further causes the computing device to have a memory overflow, so as to quickly determine fault information indicating code abnormality of the process corresponding to the target virtual memory segment. Compared with the related art in which the fault information is determined according to the total memory occupation size of the process, the present embodiment determines the fault information according to the actual memory occupation sizes corresponding to the plurality of virtual memory segments corresponding to the process. The present embodiment has a finer granularity of analysis information, and thus can more accurately locate the fault information. In addition, compared with the related art in which a third-party tool needs to be installed on the computing device if finer-granularity information needs to be analyzed, the present embodiment can analyze the finer-granularity information without installing an additional third-party tool, thereby improving the determination efficiency of the fault information. Furthermore, by the above manner, the program code of the process corresponding to the process can be quickly located, and the program code that is not perfect can be written, so that the code can be quickly and accurately recompiled by a maintenance personnel, so as to reduce the probability of the computing device having a memory overflow.

[0016] In an implementation manner, the target virtual memory segment is determined from the plurality of virtual memory segments corresponding to at least one process according to actual memory occupation sizes corresponding to the plurality of virtual memory segments allocated to each process, including:

[0017] The plurality of virtual memory segments corresponding to at least one process are sorted in descending order of the corresponding actual memory occupation sizes, and the first N virtual memory segments after the sorting are determined as the target virtual memory segments, N being an integer greater than or equal to 1; or,

[0018] The virtual memory segment having an actual memory occupation size greater than or equal to a first threshold value is determined as the target virtual memory segment.

[0019] Advantages of the present implementation: By the above manner of determining the first N virtual memory segments having larger actual memory occupation sizes or the virtual memory segment having an actual memory occupation size greater than or equal to a first threshold value as the target virtual memory segment, the target virtual memory segment can be quickly determined, and the fault information can be quickly determined, thereby improving the efficiency of determining the fault information.

[0020] In an implementation manner, the fault information is determined according to the process corresponding to the target virtual memory segment, including:

[0021] According to the target virtual memory segment, a first program code is determined in the program code corresponding to the process, the first program code being the code corresponding to the target virtual memory segment;

[0022] Fault information is determined, the fault information being used to indicate that the first program code is abnormal.

[0023] The implementation manner has the following beneficial effects: the computing device can filter the code corresponding to the target virtual memory segment from the program code (user-written program code) corresponding to the process (the process corresponding to the target virtual memory segment) to obtain the first program code. The computing device can determine the fault information to indicate that the first program code is abnormal. In this way, the user-written program code that is imperfect can be quickly located in the program code corresponding to the process, so that the code can be quickly and accurately recompiled by maintenance personnel, thereby reducing the probability of memory overflow of the computing device.

[0024] In an implementation manner, the cache information of each file in the running information package is determined; and according to the running information, fault information of the computing device is determined, including:

[0025] According to the file cache size of each file cached to the memory, a target file is determined in at least one file;

[0026] A target process accessing the target file is determined.

[0027] According to the target file and the target process, fault information is determined.

[0028] The implementation manner has the following beneficial effects: in the case where the running information includes the cache information of each file, compared with the related art in which the fault information is determined according to the total cache size of the file cache, the fault information is determined according to the size of each file cached to the memory in the embodiment of the present application. The analysis information granularity of the embodiment of the present application is finer, and thus the fault information can be more accurately located. In addition, compared with the related art in which a third-party tool needs to be installed on the computing device to analyze the information of finer granularity, the third-party tool does not need to be additionally installed in the embodiment of the present application, and the information of finer granularity can be analyzed, thereby improving the determination efficiency of the fault information.

[0029] In an implementation manner, according to the file cache size of each file cached to the memory, a target file is determined in at least one file, including:

[0030] The at least one file is sorted according to the file cache size from large to small, and the first M files after the sorting are determined as the target file, M being an integer greater than or equal to 1; or

[0031] A file with a file cache size greater than or equal to a second threshold value is determined as the target file; or

[0032] According to the file size of each file and the file cache size of each file cached to the memory, a cache ratio of each file cached to the memory is determined, and a target file is determined from the at least one file according to the cache ratio.

[0033] The present implementation has the following advantages: through the above method, the computing device can quickly determine the target file, and further quickly determine the fault information, thereby improving the efficiency of determining the fault information.

[0034] In an implementation, the target process accessing the target file is determined, including:

[0035] The file access information of each process in the at least one process is determined, and the file access information includes the identification of the file accessed by the process.

[0036] The target process is determined according to the file access information and the identification of the target file.

[0037] The present implementation has the following advantages: the computing device can determine the target process according to the file access information of each process in the at least one process (including the identification of the file accessed by the process) and the identification of the target file. Through the above method, the target process accessing the target file can be quickly determined, and further the fault information can be quickly determined according to the target process and the target file, thereby improving the speed of determining the fault information.

[0038] In an implementation, the fault information is determined according to the target file and the target process, including:

[0039] The second program code is determined in the program code corresponding to the target process according to the target file, and the second program code is the code for accessing the target file.

[0040] The fault information is determined, and the fault information is used to indicate that the second program code is abnormal.

[0041] The present implementation has the following advantages: the computing device can determine the target file from the at least one file according to the file cache size of each file cached to the memory. The computing device can regard the process accessing the target file as the target process, and the computing device can determine the code for accessing the target file in the program code corresponding to the target process as the code causing the abnormal use of the memory and further causing the memory overflow. Through the above method, the imperfect code can be quickly located, so that the maintenance personnel can quickly and accurately recompile the code, thereby reducing the probability of the memory overflow of the computing device.

[0042] In an implementation manner, the running information further includes memory usage information of the kernel space; the computing device includes a plurality of kernel modules; the memory usage information of the kernel space includes a memory size occupied by each kernel module and a total memory size occupied by the kernel space; and the method further includes:

[0043] For any one kernel module, a memory occupation ratio of the kernel module is determined according to the memory size occupied by the kernel module and the total memory size.

[0044] The kernel module with the memory occupation ratio greater than or equal to a third threshold value is determined as a target kernel module.

[0045] The fault information of the computing device is determined according to the running information, and the method further includes:

[0046] The auxiliary fault information is determined according to the target kernel module, the auxiliary fault information is used to indicate program code exception corresponding to the target kernel module, and the fault message further includes the auxiliary fault information.

[0047] The implementation manner has the beneficial effects that the computing device can determine the target kernel module according to the memory usage information of the kernel space, determine the auxiliary fault information used to indicate program code exception corresponding to the target kernel module according to the target kernel module, and improve the accuracy of determining the fault information.

[0048] In an implementation manner, the running information of the computing device is obtained, and the method includes:

[0049] When the memory is overflowed, the running information of the computing device is obtained according to the value of the running information total interface, the value of the virtual memory segment enabling interface and the value of the file cache enabling interface.

[0050] The implementation manner has the beneficial effects that when the memory is overflowed, the computing device can obtain the running information of the computing device according to the value of the running information total interface, the value of the virtual memory segment enabling interface and the value of the file cache enabling interface, and the computing device can obtain the running information based on the value set by the user flexibly, thereby improving the utilization rate of the running information and reducing the resources consumed for locating the fault.

[0051] In a second aspect, an embodiment of the present application provides a fault locating device, including:

[0052] The obtaining module is configured to obtain the running information of the computing device.

[0053] The processing module is configured to determine the fault information of the computing device according to the running information.

[0054] The running information includes at least one of memory usage information of each process or cache information of each file, the memory usage information of the process includes actual memory occupation sizes corresponding to a plurality of virtual memory segments allocated for the process, and the cache information includes a file cache size of the file cached to the memory.

[0055] The fault locating apparatus provided by the embodiments of the present application can execute the technical solutions shown in the method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.

[0056] In an implementation manner, the running information includes memory usage information of each process; and the processing module is specifically configured to:

[0057] According to the actual memory occupation sizes corresponding to a plurality of virtual memory segments allocated for each process, a target virtual memory segment is determined from the plurality of virtual memory segments corresponding to at least one process;

[0058] According to the process corresponding to the target virtual memory segment, fault information is determined.

[0059] The fault locating apparatus provided by the embodiments of the present application can execute the technical solutions shown in the method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.

[0060] In an implementation manner, the processing module is specifically configured to:

[0061] The plurality of virtual memory segments corresponding to at least one process are sorted in descending order of the corresponding actual memory occupation sizes, and the first N virtual memory segments after the sorting are determined as target virtual memory segments, N being an integer greater than or equal to 1; or,

[0062] A virtual memory segment with an actual memory occupation size greater than or equal to a first threshold value is determined as a target virtual memory segment.

[0063] The fault locating apparatus provided by the embodiments of the present application can execute the technical solutions shown in the method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.

[0064] In an implementation manner, the processing module is specifically configured to:

[0065] According to the target virtual memory segment, a first program code is determined in the program code corresponding to the process, the first program code being a code corresponding to the target virtual memory segment;

[0066] The fault information is determined, and the fault information is used to indicate that the first program code is abnormal.

[0067] The fault positioning apparatus provided in the embodiments of the present application can execute the technical solutions shown in the method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.

[0068] In an implementation manner, the processing module is specifically configured to:

[0069] determine the target file from the at least one file according to the file cache size of each file cached to the memory;

[0070] determine the target process accessing the target file;

[0071] determine the fault information according to the target file and the target process.

[0072] The fault positioning apparatus provided in the embodiments of the present application can execute the technical solutions shown in the method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.

[0073] In an implementation manner, the processing module is specifically configured to:

[0074] sort the at least one file in descending order of the file cache size, and determine the first M files after the sorting as the target files, M being an integer greater than or equal to 1; or

[0075] determine the file with the file cache size greater than or equal to the second threshold value as the target file; or

[0076] determine the cache proportion of each file cached to the memory according to the file size of each file and the file cache size of each file cached to the memory, and determine the target file from the at least one file according to the cache proportion.

[0077] The fault positioning apparatus provided in the embodiments of the present application can execute the technical solutions shown in the method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.

[0078] In an implementation manner, the processing module is specifically configured to:

[0079] determine the file access information of each process in the at least one process, the file access information including the identifier of the file accessed by the process;

[0080] determine the target process according to the file access information and the identifier of the target file.

[0081] The fault positioning apparatus provided in the embodiments of the present application can execute the technical solutions shown in the method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.

[0082] In an implementation manner, the processing module is specifically used for:

[0083] According to the target file, the second program code is determined in the program code corresponding to the target process, and the second program code is code for accessing the target file;

[0084] The fault information is determined, and the fault information is used to indicate that the second program code is abnormal.

[0085] The fault positioning device provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.

[0086] In an implementation manner, the running information further includes memory usage information of the kernel space; the computing device includes a plurality of kernel modules; the memory usage information of the kernel space includes a memory size occupied by each kernel module and a total memory size occupied by the kernel space; and the processing module is further used for:

[0087] For any one kernel module, according to the memory size occupied by the kernel module and the total memory size, a memory occupation ratio of the kernel module is determined;

[0088] The kernel module with a memory occupation ratio greater than or equal to a third threshold value is determined as a target kernel module;

[0089] According to the target kernel module, auxiliary fault information is determined, and the auxiliary fault information is used to indicate that the program code corresponding to the target kernel module is abnormal; and the fault message further includes the auxiliary fault information.

[0090] The fault positioning device provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.

[0091] In an implementation manner, the obtaining module is specifically used for:

[0092] When the memory overflow occurs, the running information of the computing device is obtained according to the value of the running information total interface, the value of the virtual memory segment enabling interface, and the value of the file cache enabling interface.

[0093] The fault positioning device provided by the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.

[0094] In a third aspect, the embodiments of the present application provide a computing device, comprising:

[0095] A processor and a memory in communication connection with the processor;

[0096] The memory is used to store computer execution instructions;

[0097] The processor is used to execute computer execution instructions stored in memory to implement the fault location method of the first aspect.

[0098] The computing device provided in this application embodiment can execute the technical solutions in the above method embodiments, and its beneficial effects are similar, so they will not be described again here.

[0099] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the fault location method of the first aspect.

[0100] The computer-readable storage medium provided in this application embodiment can execute the technical solutions in the above method embodiments, and its beneficial effects are similar, so they will not be described again here.

[0101] Fifthly, embodiments of this application provide a computer program product, including a computer program, which, when executed by a processor, is used to implement the fault location method of the first aspect.

[0102] The computer program product provided in this application embodiment can execute the technical solutions in the above method embodiments, and its beneficial effects are similar, so they will not be described again here. Attached Figure Description

[0103] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0104] Figure 1a A schematic diagram of the virtual memory space of a process provided in an embodiment of this application;

[0105] Figure 1b This application provides a schematic diagram of the architecture of a computing device.

[0106] Figure 2 A flowchart illustrating a fault location method according to an embodiment of this application;

[0107] Figure 3 A flowchart illustrating a second embodiment of a fault location method provided in this application;

[0108] Figure 4a A flowchart illustrating a third embodiment of a fault location method provided in this application;

[0109] Figure 4b A process access file diagram provided for an embodiment of the present application;

[0110] Figure 5a A flow diagram of a fault locating method embodiment four provided for an embodiment of the present application;

[0111] Figure 5b A schematic diagram of an information enhancement enabling interface provided for an embodiment of the present application;

[0112] Figure 6 A structural diagram of a fault locating device provided for an embodiment of the present application;

[0113] Figure 7 A structural diagram of a computing device provided for an embodiment of the present application. DETAILED DESCRIPTION

[0114] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments made by those of ordinary skill in the art under the inspiration of the embodiments of the present application belong to the scope of protection of the present application.

[0115] The terms "first", "second", "third", "fourth" and the like (if any) in the specification and claims of the present application and the above drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to include those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0116] Noun explanation:

[0117] File system: In an operating system, the software mechanism responsible for managing and storing file information is called the file management system, or simply the file system. A file system is typically a mechanism for storing and organizing files, facilitating easy searching and access. The Linux operating system divides the file system into two layers: the Virtual File System (VFS) and the concrete file systems. The VFS is a kernel software layer, an abstraction layer above the concrete file systems. It provides a common interface to various file systems, allowing upper-level applications to access different file systems using this common interface. The VFS includes the superblock, inodes, etc.

[0118] Superblock: In a file system, the superblock is a data structure used to store global information about the file system, including the total number of inodes and the number of inodes in use. In the Linux operating system, the superblock is usually mapped to a data structure in memory called `struct super_block`. It's important to note that one superblock corresponds to one file system.

[0119] An inode is a file that corresponds to only one inode, and a file that corresponds to only one inode. The metadata of an inode includes the file path of the file to which the inode corresponds, as well as the size of the file cache that caches the file in memory.

[0120] Virtual Memory Area (VMA): Operating systems commonly use virtual memory to manage physical memory. On a 32-bit machine, each process has its own 4GB virtual memory space, of which 0-3GB belongs to user space and is unique to that process; 3-4GB is kernel space, which is the kernel space shared by all processes in the computing device and kernel processes. Figure 1a This is a schematic diagram of the virtual memory space of a process provided in an embodiment of this application. Figure 1a As shown, the virtual memory space includes kernel space and user space. User space includes the stack, memory-mapped segments, heap, BSS (Block Started by Symbol) segment, data segment, and code segment. It's important to note that the BSS segment stores uninitialized global and static variables, the data segment stores initialized global and static variables, and the code segment stores program code. The BSS, data, and code segments will not cause memory overflow during runtime. It should also be noted that the stack, memory-mapped segments, and heap, etc., can all be considered virtual memory segments allocated by the computing device (operating system) to processes, and can also be called memory-mapped blocks.

[0121] Stack: Stack is an area used to store local variables and function call information. When a function is called, its local variables and function call information will be stored in the stack. Unlike the heap, the stack is managed according to the principle of last in, first out. That is, the last variable or function call that enters the stack will be released first. When a function call ends, the relevant stack frame will be removed from the stack to release memory. The size of the stack is dynamically changed during the process of running the process.

[0122] Heap: Heap is an area used for dynamic allocation of memory. When a process needs to dynamically allocate memory to store data, it will request a block of appropriate size memory in the heap. The operating system will allocate a block of unused memory area to the process and map it into the process's address space so that the process can use this block of memory to store data. The size of the heap is dynamically changed during the process of running the process.

[0123] Memory mapping segment: A process can map a file to the process's virtual memory space to access the file's memory through memory. Through the memory mapping segment, the process can treat the file's content as a part of memory, so it can read and write the file efficiently as accessing memory. This operation can improve the speed and performance of file access. The size of the memory mapping segment is dynamically changed during the process of running the process.

[0124] Kernel Module: The kernel space includes kernel modules. Kernel modules are a kind of plug-in software modules that can be dynamically loaded and unloaded, used to extend the functions of the operating system kernel. Kernel modules can add new drivers, file systems, network protocols, device support, etc. by loading in the running operating system kernel, so as to extend the kernel without recompiling and restarting the operating system.

[0125] For ease of understanding, first, the architecture of a computing device related to the embodiments of the present application is described. Figure 1b The architecture of a computing device related to the embodiments of the present application is described.

[0126] Figure 1b The architecture of a computing device related to the embodiments of the present application is described.

[0127] As shown in Figure 1b , the computing device 10 can include a processor 101, a memory 102, and a hard disk 103. The memory 102 and the hard disk 103 can be electrically connected to the processor 101.

[0128] The processor 101 can be a central processing unit (CPU) or other component with processing capability. The central processor is the operation and control core of the computing device 10, and is the final execution unit of information processing and program running. The central processor is a very large scale integrated circuit composed of an arithmetic unit, a controller, a register, etc., and its main task is to process and handle various data.

[0129] The memory 102 is also called a memory or a main memory, and is installed in a memory slot on the mainboard of the computing device. The memory can be used to store the operation data of the processor. For example, the memory can be a random access memory (RAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a dual inline memory module (DIMM), a persistent memory (PMEM), or a double data rate (DDR) memory, etc.

[0130] The hard disk 103 is the main storage device of the computing device 10, which can be a solid state disk or a mechanical hard disk.

[0131] It should be further noted that the computing device 10 can be a terminal (mobile phone, computer, etc.) or a server.

[0132] The following describes the memory overflow process based on the computing device shown in FIG. 1. Figure 1b

[0133] The computing device 10 (the processor 101 of the computing device 10) can run at least one process. For example, four processes, process 1, process 2, process 3, and process 4, can run on the computing device.

[0134] Taking the process 1 as an example, when the process 1 has a memory requirement, the process 1 can apply for a piece of memory to the computing device 10 (from the hardware point of view, the processor 101; from the software point of view, the operating system running on the processor 101). When the available memory space cannot meet the requirement of the process 1, the computing device 10 will trigger an out of memory (OOM). The computing device 10 can also determine the process 1 as the process triggering the out of memory.

[0135] ​The computing device 10 can determine the process identity (PID) of each process (the process triggering the memory overflow and other processes), and obtain the memory overflow score (oom_score) of each process. The computing device 101 can terminate the process with the largest memory overflow score to release memory. For example, the computing device 101 can terminate the process 4. It should be noted that the larger the memory overflow score of a process, the more memory the process consumes, and the greater the probability that the process is terminated by the computing device 10.

[0136] Improper use of memory by a process is the main cause of OOM, and therefore the computing device 10 needs to record memory-related information when OOM occurs to facilitate fault localization.

[0137] The computing device can record the total size of different types of memory and the total size of memory of each process when OOM occurs to locate an application with imperfect programming that causes memory overflow.

[0138] It should be noted that the total size of different types of memory includes the total size of anonymous memory and the total size of file cache.

[0139] However, the method in the related art records information with a coarse granularity, i.e., the total size of different types of memory and the total size of memory of each process, which results in a low accuracy of fault localization.

[0140] If more detailed information needs to be analyzed, it takes time to install third-party tools on the computing device, which results in a low efficiency of fault localization.

[0141] To address the above technical problems, the embodiments of the present application provide a fault localization method. The computing device can obtain running information of the computing device, and determine fault information of the computing device according to the running information. The running information includes at least one of the following: memory usage information of each process, or cache information of each file. The memory usage information of each process includes actual memory usage corresponding to a plurality of virtual memory segments allocated to the process, and the cache information includes a size of a file cached to memory.

[0142] The fault localization scheme of the embodiments of the present application is described in detail below. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described again in some embodiments.

[0143] Figure 2 A flowchart of a fault localization method according to an embodiment of the present application is shown in FIG. 1. The method specifically includes the following steps: Figure 2 The method specifically includes the following steps:

[0144] S201: Obtain running information of the computing device.

[0145] In the embodiment, at least one process can run on the computing device. In addition, the computing device can store at least one file.

[0146] It should be noted that at least one process can run on the computing device, which means that one process can run on the computing device, or multiple processes can run on the computing device. The computing device can store at least one file, which means that the computing device can store one file, or the computing device can store multiple files.

[0147] The process can apply for memory from the computing device (from the hardware point of view, the processor on the computing device; from the software point of view, the operating system running on the processor).

[0148] When the available memory space cannot meet the demand of the process, the computing device triggers a memory overflow.

[0149] When the computing device identifies that the memory overflow occurs, the computing device can obtain the running information of the computing device.

[0150] The running information includes at least one of the following:

[0151] Memory usage information of each process. It should be noted that the memory usage information of the process includes actual memory occupation sizes corresponding to multiple virtual memory segments allocated for the process. It should be further noted that the virtual memory segment allocated for the process by the computing device can be regarded as a memory mapping block. The virtual memory segment can include a stack, a heap, and a memory mapping segment. That is, among the multiple virtual memory segments, one virtual memory segment can be a stack; among the multiple virtual memory segments, one virtual memory segment can be a heap; and among the multiple virtual memory segments, one virtual memory segment can be a memory mapping segment. It should be noted that, compared with the related art in which the computing device obtains the total occupation size of the memory of the process, the embodiment of the present application obtains the actual memory occupation size corresponding to each virtual memory segment of each process, and the granularity of the information obtained by the present application is finer.

[0152] Cache information of each file. It should be noted that the cache information includes the size of the file cached to the memory. In addition, the cache information of each file can also indicate the process accessing the file. It should be noted that the size of the file cached to the memory refers to the size of one file cached to the memory. Compared with the related art in which the computing device obtains the total occupation size of the file cache, the embodiment of the present application obtains the size of each file cached to the memory, and the granularity of the information obtained by the embodiment of the present application is finer.

[0153] In an implementation, the running information can further include memory usage information of the kernel space. It should be noted that the kernel space of the computing device includes a plurality of kernel modules. The memory usage information of the kernel space includes a memory size occupied by each kernel module and a total memory size occupied by the kernel space.

[0154] S202: Determine the fault information of the computing device according to the running information.

[0155] In the embodiment, the computing device can determine the fault information of the computing device according to the running information.

[0156] In an implementation, the computing device can determine the fault information of the computing device according to the memory usage information of each process.

[0157] Specifically, the computing device can obtain actual memory occupation sizes corresponding to a plurality of virtual memory segments allocated by the computing device for each process. The computing device can determine a target virtual memory segment from the plurality of virtual memory segments corresponding to at least one process according to the actual memory occupation sizes corresponding to the plurality of virtual memory segments allocated by the computing device for each process. It should be noted that in the process of determining the target virtual memory segment: in an implementation, the computing device can sort the plurality of virtual memory segments corresponding to at least one process in descending order of the corresponding actual memory occupation sizes, and determine the first N (N is an integer greater than or equal to 1) virtual memory segments in the sorted order as the target virtual memory segment. In an implementation, the computing device can determine a virtual memory segment with an actual memory occupation size greater than or equal to a first threshold as the target virtual memory segment.

[0158] The computing device can determine the fault information according to the target virtual memory segment.

[0159] The process of determining the fault information according to the target virtual memory segment by the computing device is described below.

[0160] In an implementation, the computing device can determine the fault information according to the process corresponding to the target virtual memory segment. Specifically, the computing device can filter out the code corresponding to the target virtual memory segment from the program code (user-written program code) corresponding to the process (the process corresponding to the target virtual memory segment) as the first program code. The computing device can determine that the fault information indicates that the first program code is abnormal. It should be noted that in the case where the computing device determines multiple target virtual memory segments, for each target virtual memory segment, the computing device can filter out the code corresponding to the target virtual memory segment from the program code corresponding to the process (the process corresponding to the target virtual memory segment) as the first program code. The computing device can determine that the fault information indicates that the first program code is abnormal. It should be noted that in the case where there are multiple target virtual memory segments, the computing device can determine that the fault information indicates multiple first program code abnormalities. Each first program code is the code corresponding to the target virtual memory segment in the program code corresponding to the process corresponding to the target virtual memory segment.

[0161] In an implementation, in the case where there are multiple target virtual memory segments, after the first computing device determines the first program code corresponding to each target memory segment, the first computing device can perform detection processing on the multiple first program codes according to the detection rule, and when the detection result of at least one first program code is detected to be an abnormal result, determine the at least one program code as an abnormal first program code. The computing device can determine that the fault information indicates that the abnormal first program code is abnormal. Exemplarily, the detection rule can include an abnormal character, etc.

[0162] In an implementation, the computing device can determine that the fault information indicates that the target virtual memory segment is a virtual memory segment with a memory allocation exception. It should be noted that in the case where there are multiple target virtual memory segments, the computing device can determine that the fault information indicates that the multiple target virtual memory segments are virtual memory segments with a memory allocation exception.

[0163] In an implementation, the computing device can determine the fault information of the computing device according to the cache information of each file.

[0164] Specifically, the computing device can determine the target file from the at least one file according to the file cache size of each file being cached to the memory. It should be noted that in the process of determining the target file: in an implementation manner, the computing device can sort the at least one file in descending order of the file cache size, and determine the first M (M is an integer greater than or equal to 1) files in the sorted order as the target file. In an implementation manner, the computing device can determine the file whose file cache size is greater than or equal to the second threshold as the target file. In an implementation manner, the computing device can determine the cache ratio of each file being cached to the memory according to the file size of each file and the file cache size of each file being cached to the memory, and determine the target file from the at least one file according to the cache ratio.

[0165] The computing device can determine the fault information according to the target file.

[0166] The process of determining the fault information by the computing device according to the target file is described below.

[0167] In an implementation manner, the computing device can determine the target process accessing the target file, and determine the fault information according to the target file and the target process. Specifically, in the process of determining the fault information according to the target file and the target process, the computing device can filter the code accessing the target file from the program code (user-written program code) corresponding to the target process as the second program code. The computing device can determine that the fault information is used to indicate that the second program code is abnormal. It should be noted that in the case where there are multiple target files, the computing device can determine that the fault information is used to indicate that multiple second program codes are abnormal. Each second program code is the code accessing the target file in the program code corresponding to the target process corresponding to the target file.

[0168] In an implementation manner, in the case where there are multiple target files and multiple target processes, after the first computing device determines the second program code corresponding to each target file, the first computing device can perform detection processing on the multiple second program codes according to the detection rule, and determine at least one second program code as an abnormal second program code when the detection result of the at least one second program code is an abnormal result. The computing device can determine that the fault information is used to indicate that the abnormal second program code is abnormal. Exemplarily, the detection rule can include an abnormal character, etc.

[0169] In an implementation manner, the computing device can determine that the fault information is used to indicate that the target file is a file with cache exception. It should be noted that in the case where there are multiple target files, the computing device can determine that the fault information is used to indicate that the multiple target files are files with cache exception.

[0170] In an implementation, based on the computing device comprising a plurality of kernel modules, for any one kernel module, the computing device can determine a memory occupation ratio of the memory occupied by the kernel module according to a size of the memory occupied by the kernel module and a total size of the memory occupied by the kernel space. The computing device can determine a kernel module with a memory occupation ratio greater than or equal to a third threshold value as a target kernel module. According to the target kernel module, the computing device determines auxiliary fault information, which is used to indicate program code exceptions corresponding to the target kernel module. The fault message further comprises the auxiliary fault information.

[0171] That is, after the computing device determines the fault information according to the target virtual memory segment and / or the target file, the computing device can determine that the auxiliary fault information is also used to indicate program code exceptions corresponding to the target kernel module. For example, the computing device can determine that the fault information is used to indicate at least one first program code exception or at least one second program code exception and program code exceptions corresponding to the target kernel module.

[0172] Advantages of the embodiment: In the embodiment, the computing device can obtain the running information of the computing device. The running information comprises at least one of the following: memory usage information of each process (actual memory occupation size corresponding to a plurality of virtual memory segments allocated to the process) and cache information of each file (size of the file cached to the memory). The computing device can determine the fault information according to the running information. In the case where the running information comprises the memory usage information of each process, compared with the related art which determines the fault information according to the total occupation size of the memory of the process, the embodiment determines the fault information according to the actual memory occupation size corresponding to the plurality of virtual memory segments corresponding to the process. The embodiment has a finer granularity of analysis information, and thus can more accurately locate the fault information. In the case where the running information comprises the cache information of each file, compared with the related art which determines the fault information according to the total occupation size of the file cache, the embodiment determines the fault information according to the size of each file cached to the memory. The embodiment has a finer granularity of analysis information, and thus can more accurately locate the fault information. In addition, compared with the related art which needs to consume time and install third-party tools on the computing device if it needs to analyze finer-grained information, the embodiment can analyze finer-grained information without installing additional third-party tools, thereby improving the efficiency of determining the fault information. In summary, through the method of the embodiment, the fault information can be located more efficiently and accurately, so that the maintenance personnel can timely process based on the fault information to avoid the memory overflow situation.

[0173] Figure 3 A flowchart of a fault locating method embodiment two provided by the embodiment is shown in FIG. 2. Referring to FIG. 2, Figure 3The method specifically comprises the following steps:

[0174] S301: Obtain running information of the computing device.

[0175] In this embodiment, the computing device can obtain running information of the computing device. The running information comprises memory usage information of each process.

[0176] It should be noted that the memory usage information comprises actual memory occupation sizes corresponding to a plurality of virtual memory segments allocated by the computing device for the process. Exemplarily, the actual memory occupation sizes can be represented in the form of address ranges.

[0177] In addition, the memory usage information can further comprise an identifier of an index node (an index node corresponding to a file accessed by the process).

[0178] In an implementation manner, the memory usage information can further comprise one or more of the following information: relevant permissions corresponding to each virtual memory segment, a file offset address, a device number, and memory usage sizes of various types.

[0179] It should be noted that the index node refers to an index node corresponding to a file accessed by the process.

[0180] The memory usage sizes of various types comprise RSS, PSS, and the like.

[0181] RSS: resident memory size, which is an actual memory (physical memory) occupation size of the process at present, comprising a size of memory occupied by the process alone and a size of memory shared by the process with other processes.

[0182] PSS: proportional resident memory size, comprising a size of memory occupied by the process alone and a ratio of a size of memory shared by the process with other processes to a number of processes participating in sharing.

[0183] S302: Determine a target virtual memory segment from a plurality of virtual memory segments corresponding to at least one process according to actual memory occupation sizes corresponding to a plurality of virtual memory segments allocated for each process.

[0184] In this embodiment, the computing device can determine a target virtual memory segment from a plurality of virtual memory segments corresponding to at least one process according to actual memory occupation sizes corresponding to a plurality of virtual memory segments allocated for each process after obtaining the actual memory occupation sizes corresponding to the plurality of virtual memory segments allocated for each process.

[0185] In an implementation, the computing device can sort the plurality of virtual memory segments corresponding to the at least one process in descending order of the corresponding actual memory occupancy size. The computing device can determine the first N virtual memory segments in the sorted order as the target virtual memory segments. It should be noted that N is an integer greater than or equal to 1.

[0186] By the above manner of determining the first N virtual memory segments with larger actual memory occupancy size as the target virtual memory segments, the target virtual memory segments can be quickly determined, and then the fault information can be quickly determined, thereby improving the efficiency of determining the fault information.

[0187] In an implementation, the computing device can determine a virtual memory segment with a corresponding actual memory occupancy size greater than or equal to a first threshold value as the target virtual memory segment. For example, the first threshold value can be 500 MB.

[0188] By the above manner of determining a virtual memory segment with a corresponding actual memory occupancy size greater than or equal to a first threshold value as the target virtual memory segment, the target virtual memory segment can be quickly determined, and then the fault information can be quickly determined, thereby improving the efficiency of determining the fault information.

[0189] S303: Determine the fault information according to the process corresponding to the target virtual memory segment.

[0190] In this embodiment, the computing device can determine the fault information according to the process corresponding to the target virtual memory segment.

[0191] Specifically, the computing device can determine a first program code in the program code corresponding to the process (the process corresponding to the target virtual memory segment) according to the target virtual memory segment, where the first program code is the code corresponding to the target virtual memory segment.

[0192] The computing device can determine the fault information, where the fault information is used to indicate that the first program code is abnormal.

[0193] Advantages of the present embodiment: in the present embodiment, the computing device can determine the target virtual memory segment from the plurality of virtual memory segments corresponding to at least one process according to the actual memory occupation size corresponding to the plurality of virtual memory segments allocated to each process. The computing device can regard the target virtual memory segment as a virtual memory segment that causes abnormal memory usage and further causes the computing device to have a memory overflow, so as to be able to quickly determine the fault information indicating the code abnormality of the target virtual memory segment according to the process corresponding to the target virtual memory segment. Compared with the related art, which determines the fault information according to the total memory occupation size of the process, the present embodiment determines the fault information according to the actual memory occupation size corresponding to the plurality of virtual memory segments corresponding to the process. The granularity of the analysis information of the present embodiment is finer, so that the fault information can be more accurately located. In addition, compared with the related art, if the finer granularity information needs to be analyzed, the third-party tool needs to be installed on the computing device, and the present embodiment can analyze the finer granularity information without installing additional third-party tools, thereby improving the determination efficiency of the fault information. In addition, by the above-mentioned manner, the program code corresponding to the process can be quickly located, and the program code written imperfectly can be quickly and accurately recompiled by the maintenance personnel, so as to reduce the probability of the computing device having a memory overflow.

[0194] Figure 4a A flowchart of a fault locating method provided by an embodiment of the present application is provided. Referring to FIG. 4, the method specifically includes the following steps: Figure 4a

[0195] S401: Obtain the running information of the computing device.

[0196] In the present embodiment, the computing device can obtain the running information of the computing device. The running information includes the cache information of each file.

[0197] It should be noted that the cache information of the file includes the file cache size of the file cached to the memory.

[0198] Next, the reason why the computing device obtains the cache information of each file for fault locating is described.

[0199] Figure 4b A schematic diagram of a process accessing a file provided by an embodiment of the present application is provided.

[0200] As shown in FIG. 5, the process can access the file in the following manner: Figure 4b ​As shown, a file is stored in the hard disk of the computing device. Since the speed of accessing the hard disk is lower than that of accessing the memory, in order to avoid accessing the hard disk every time the file is accessed, the computing device divides the file into multiple data blocks in units of page size (e.g., 4 KB). When a process needs to read or write a data block in the file, the computing device first applies a memory page (called page cache) to bind the data block in the file.

[0201] When a process reads or writes a data block in the file, the process actually reads or writes the page cache. Therefore, when the file is read or written, the following two cases are processed:

[0202] When a process reads a data block from the file, if the page cache where the data block to be read exists, the process can directly read the data block in the page cache. Otherwise, the computing device (kernel) can allocate a free memory page (page cache) and store the data block from the hard disk to the page cache. The process can read the data block in the page cache.

[0203] When a process writes a data block to the file, if the page cache where the data block to be written exists, the computing device can directly write the data block to be written to the page cache. Otherwise, the computing device (kernel) can allocate a free memory page (page cache), and the process can directly write the data block to be written to the page cache.

[0204] When a process finishes accessing a data block in a file, the page cache where the data block is located can be released.

[0205] For a process, if the code related to accessing a file in the program code corresponding to the process is abnormal, the process does not release the page cache. When the computing device needs to access other data blocks in the file, if there is no page cache in the memory where the other data blocks are located, the computing device can allocate a free page cache, and the computing device can cache other data blocks in the file from the hard disk to the page cache in the memory. At this time, the number of page caches (nrpages) corresponding to the file increases.

[0206] Based on the above process, in the case that the code related to accessing a file is abnormal, the file cache size (the product of nrpages and page size (e.g., 4 KB)) of the file cached in the memory gradually increases.

[0207] Therefore, the computing device can determine whether the code related to accessing a file in the program code corresponding to the process accessing the file is abnormal by analyzing the file cache size of the file cached in the memory.

[0208] The following describes a process in which the computing device obtains the cache information of each file.

[0209] The computing device includes a plurality of file systems. Each file system includes a plurality of files. Each file system corresponds to a superblock. Each superblock includes a plurality of index nodes. Each index node corresponds to a file.

[0210] The metadata information of the index node includes a file path and a file cache size of the file cached to the memory. The file path includes an identifier of the file (e.g., a name of the file) and an identifier of a directory. The file cache size can be represented by a number of page caches (nrpages).

[0211] The computing device can create an array of nrpages structures. For each index node in each superblock, the computing device can obtain the metadata information of the index node. The computing device can determine the cache information (the file cache size of the file cached to the memory) of the file according to the identifier of the file and the file cache size of the file cached to the memory.

[0212] The computing device can store the cache information of each file in the array of nrpages structures after determining the cache information of each file.

[0213] S402: Determine a target file from the at least one file according to the file cache size of each file cached to the memory.

[0214] In this embodiment, the computing device can determine a target file from the at least one file according to the file cache size of each file cached to the memory. In one implementation, based on the number of page caches (nrpages) corresponding to a file reflecting the file cache size, the computing device can directly determine a target file from the at least one file according to the number of page caches (nrpages) corresponding to each file.

[0215] In one implementation, the computing device can sort the at least one file in descending order of file cache size, and determine the first M files after sorting as target files. M is a positive integer greater than or equal to 1.

[0216] By determining the first M files with larger file cache size as target files, the target file can be quickly determined, and the fault information can be quickly determined, thereby improving the efficiency of determining the fault information.

[0217] In one implementation, the computing device can determine a file with a file cache size greater than or equal to a second threshold value as a target file. For example, the second threshold value can be 500 KB.

[0218] By the above manner of determining the target file by taking the file whose file cache size is greater than or equal to the second threshold value as the target file, the target file can be quickly determined, and then the fault information can be quickly determined, thereby improving the efficiency of determining the fault information.

[0219] In an implementation manner, the computing device can determine a cache ratio of each file cached to the memory according to a file size of each file and a file cache size of each file cached to the memory, and determine the target file in the at least one file according to the cache ratio. For example, the computing device determines a file as the target file when it is identified that the cache ratio of the file is higher than a third threshold value. For another example, the computing device can sort the at least one file according to the cache ratio of each file from large to small, and determine the first K files after the sorting as the target file. K is a positive integer greater than or equal to 1.

[0220] By the above manner of determining the target file according to the cache ratio of each file cached to the memory, the target file can be quickly determined, and then the fault information can be quickly determined, thereby improving the efficiency of determining the fault information.

[0221] It should be noted that, in the case of storing the cache information of each file in the page cache quantity structure array, the computing device can determine the target file in the at least one file included in the page cache quantity structure array according to the file cache size of each file cached to the memory in the page cache quantity structure array.

[0222] S403: Determine a target process accessing the target file.

[0223] In this embodiment, the computing device can determine the target process accessing the target file after determining the target file.

[0224] Specifically, the computing device can determine file access information of each process in the at least one process, where the file access information includes an identifier of a file accessed by the process.

[0225] In the process of determining the identifier of the file accessed by each process, for each process, the computing device can determine an identifier of an index node corresponding to the process by searching a memory mapping segment (a virtual memory segment) of the process. Based on metadata information of each index node, including an identifier of a file corresponding to the index node, the computing device can determine the identifier of the file accessed by the process. It should be noted that the metadata information of each index node includes a file path of the file corresponding to the index node, and the file path includes the identifier of the file.

[0226] The computing device can determine, according to the file access information of each process and the identifier of the target file, a target process that accesses the target file.

[0227] S404: Determine fault information according to the target file and the target process.

[0228] In this embodiment, the computing device can determine fault information according to the target file and the target process.

[0229] Specifically, the computing device can determine, according to the target file, second program code in the program code corresponding to the target process, the second program code being code for accessing the target file. The computing device can determine that the fault information indicates that the second program code is abnormal.

[0230] Advantages of this embodiment: In this embodiment, when the running information includes cache information of each file, compared with the related art in which the fault information is determined according to the total cache size of the file, the fault information in this embodiment is determined according to the size of each file cached to the memory. The analysis information granularity of this embodiment is finer, and thus the fault information can be more accurately located. In addition, compared with the related art in which time is consumed and a third-party tool is installed on the computing device if more fine-grained information needs to be analyzed, this embodiment does not need to install an additional third-party tool to analyze more fine-grained information, and thus the determination efficiency of the fault information is improved. In addition, in this embodiment, the computing device can determine, according to the file cache size of each file cached to the memory, a target file in at least one file. The computing device can regard a process that accesses the target file as a target process, and determine, in program code corresponding to the target process, code for accessing the target file as code that causes abnormal memory usage and further causes a memory overflow. In this way, the code that is not perfectly written can be quickly located, so that a maintenance personnel can quickly and accurately recompile the code to reduce the probability of a memory overflow of the computing device.

[0231] Figure 5a An embodiment four of a fault locating method provided by this application is shown in a flowchart. Referring to FIG. 4, the method specifically includes the following steps. Figure 5a

[0232] S501: Obtain an information enhancement instruction.

[0233] In this embodiment, the computing device can include an information enhancement enabling interface. The information enhancement enabling interface includes a running information total interface, a virtual memory segment enabling interface, and a file cache enabling interface. For example, Figure 5b ​An information enhancement interface is provided for the embodiments of the present application.

[0234] A running information total interface is provided for controlling or checking whether the computing device can obtain running information when the memory is overflowed. The running information total interface can have a value of 0 / 1. When the value of the running information total interface is 0, the computing device does not have the capability of obtaining the running information and does not need to obtain the running information. When the value of the running information total interface is 1, the computing device has the capability of obtaining the running information and can obtain the running information.

[0235] It should be noted that the running information total interface can be regarded as a memory overflow information enhancement interface. When the value of the running information total interface is 0, the computing device cannot obtain the running information, but can obtain the total size of the memory of different types and the total size of the memory of each process. The computing device can determine the fault information according to the total size of the memory of different types and the total size of the memory of each process.

[0236] In the above manner, the two values of the running information total interface can be used to directly and simply manage the obtaining of the running information, thereby reducing the complexity of managing the obtaining of the running information. Meanwhile, the user can set the value of the running information total interface according to actual business needs to set whether to obtain the running information.

[0237] A virtual memory segment enable interface is provided for controlling or checking whether the computing device can obtain the memory usage information of each process when the memory is overflowed, wherein the memory usage information of the process includes the actual memory size corresponding to the plurality of virtual memory segments allocated for the process. The value of the virtual memory segment enable interface can be -1 / 0 / N. In the case where the value of the running information total interface is 1, when the value of the virtual memory segment enable interface is 0, the computing device does not have the capability of obtaining the memory usage information of each process. In the case where the value of the running information total interface is 1, when the value of the virtual memory segment enable interface is -1, the computing device has the capability of obtaining the memory usage information of each process and can determine each virtual memory segment allocated for each process as a target virtual memory segment. In the case where the value of the running information total interface is 1, when the value of the virtual memory segment enable interface is N, the computing device has the capability of obtaining the memory usage information of each process and can determine N target virtual memory segments from the plurality of virtual memory segments of the plurality of processes. N is a positive integer greater than or equal to 1.

[0238] In the above manner, the three values of the virtual memory segment enable interface can be used to directly and simply manage the number of target virtual memory segments determined by the computing device, thereby reducing the complexity of determining the target virtual memory segments. Meanwhile, the user can set the value of the virtual memory segment enable interface according to actual business needs.

[0239] The file cache enable interface is used to control or check whether the computing device can obtain the cache information of each file when the memory is overflowed. The cache information of each file is used to indicate the file cache size of each file cached to the memory. The value of the file cache enable interface can be -1 / 0 / M. When the value of the running information total interface is 1 and the value of the file cache enable interface is 0, the computing device does not have the capability of obtaining the cache information of each file. When the value of the running information total interface is 1 and the value of the file cache enable interface is -1, the computing device has the capability of obtaining the cache information of each file, and each file can be determined as a target file. When the value of the running information total interface is 1 and the value of the file cache enable interface is M, the computing device has the capability of obtaining the cache information of each file, and M target files can be determined from a plurality of files. M is a positive integer greater than or equal to 1.

[0240] In the above manner, the number of target files determined by the computing device can be directly and simply managed by using the three values of the file cache enable interface, and the complexity of determining the target virtual memory segment is reduced. Meanwhile, the user can set the value of the virtual memory segment enable interface according to actual business needs.

[0241] Table 1 is the information enhancement enable interface. As shown in Table 1, the value of the running information total interface can be 1, the value of the virtual memory segment enable interface can be 30, and the value of the file cache enable interface can be 30.

[0242] Table 1 information enhancement enable interface

[0243] Interface name Value Running information total interface 1 Virtual memory segment enable interface 30 File cache enable interface 30

[0244] In this embodiment, the user can input the value information in the user interaction interface of the terminal device. The terminal device can generate an information enhancement instruction according to the value information input by the user, and send the information enhancement instruction to the computing device. The value information includes the value of the running information total interface, the value of the virtual memory segment enable interface, and the value of the file cache enable interface.

[0245] The computing device can obtain the information enhancement instruction. The information enhancement instruction includes the value of the running information total interface, the value of the virtual memory segment enable interface, and the value of the file cache enable interface.

[0246] S502: According to the information enhancement instruction, the value of the running information total interface, the value of the virtual memory segment enable interface, and the value of the file cache enable interface are set respectively.

[0247] In this embodiment, the computing device can set the value of the running information total interface, the value of the virtual memory segment enabling interface, and the value of the file cache enabling interface according to the information enhancement instruction after obtaining the information enhancement instruction.

[0248] For example, the computing device can set the value of the running information total interface to 1 according to the value of the running information total interface being 1 in the information enhancement instruction; the computing device can set the value of the virtual memory segment enabling interface to 3 according to the value of the virtual memory segment enabling interface being 3 in the information enhancement instruction; and the computing device can set the value of the file cache enabling interface to 4 according to the value of the file cache enabling interface being 4 in the information enhancement instruction.

[0249] S503: When the memory is overflowed, the computing device obtains the running information of the computing device according to the value of the running information total interface, the value of the virtual memory segment enabling interface, and the value of the file cache enabling interface.

[0250] In this embodiment, the computing device can obtain the running information of the computing device according to the value of the running information total interface, the value of the virtual memory segment enabling interface, and the value of the file cache enabling interface when it is identified that the memory is overflowed.

[0251] When the value of the running information total interface is 0:

[0252] The computing device can directly obtain the total usage information of different types of memory and the total usage information of memory of each process. The total usage information of different types of memory includes the actual memory occupation size corresponding to the anonymous memory and the actual memory occupation size corresponding to the file cache. The total usage information of memory of each process includes the actual memory occupation size corresponding to each process.

[0253] When the value of the running information total interface is 1:

[0254] When the value of the virtual memory segment enabling interface is 0 and the value of the file cache enabling interface is M, the computing device can obtain the cache information of each file (all files). The computing device can determine M target files from a plurality of files. It should be noted that the process of determining M target files from a plurality of files by the computing device has been described in S202 and S401, and will not be repeated here.

[0255] When the value of the virtual memory segment enabling interface is 0 and the value of the file cache enabling interface is -1, the computing device can obtain the cache information of each file. The computing device can determine each file as a target file.

[0256] When the value of the virtual memory segment enabling interface is -1 and the value of the file cache enabling interface is M, the computing device can obtain memory usage information of each process. The computing device can obtain cache information of each file. The computing device can determine each virtual memory segment of each process as a target virtual memory segment. The computing device can determine M target files from the plurality of files.

[0257] When the value of the virtual memory segment enabling interface is -1 and the value of the file cache enabling interface is -1, the computing device can obtain memory usage information of each process. The computing device can obtain cache information of each file. The computing device can determine each virtual memory segment of each process as a target virtual memory segment. The computing device can determine each file as a target file.

[0258] When the value of the virtual memory segment enabling interface is -1 and the value of the file cache enabling interface is 0, the computing device can obtain memory usage information of each process. The computing device can determine each virtual memory segment of each process as a target virtual memory segment.

[0259] When the value of the virtual memory segment enabling interface is N and the value of the file cache enabling interface is M, the computing device can obtain memory usage information of each process. The computing device can obtain cache information of each file. The computing device can determine N target virtual memory segments from the plurality of virtual memory segments of the plurality of processes. The computing device can determine M target files from the plurality of files. It should be noted that the process of determining N target virtual memory segments from the plurality of virtual memory segments of the plurality of processes has been described in S302 and S401, and will not be described here.

[0260] When the value of the virtual memory segment enabling interface is N and the value of the file cache enabling interface is -1, the computing device can obtain memory usage information of each process. The computing device can obtain cache information of each file. The computing device can determine N target virtual memory segments from the plurality of virtual memory segments of the plurality of processes. The computing device can determine each file as a target file.

[0261] When the value of the virtual memory segment enabling interface is N and the value of the file cache enabling interface is 0, the computing device can obtain memory usage information of each process. The computing device can determine N target virtual memory segments from the plurality of virtual memory segments of the plurality of processes.

[0262] S504: Determine the fault information of the computing device according to the running information.

[0263] In this embodiment, the computing device can determine the fault information of the computing device according to the running information.

[0264] In the case where the value of the running information total interface is 0:

[0265] The memory total usage information of each process is running information. The computing device can filter out a process with the largest actual memory occupation size as a target process according to the memory total usage information of each process.

[0266] The computing device can also determine whether the program code corresponding to different types of memory is abnormal program code according to whether the total usage information of different types of memory exceeds the preset memory total threshold. For example, the computing device determines that the program code corresponding to file access in the program code corresponding to each process is abnormal program code when the total occupation size of the file cache exceeds the preset memory total threshold.

[0267] When the value of the running information total interface is 1:

[0268] When the value of the virtual memory segment enabling interface is 0 and the value of the file cache enabling interface is M, the cache information of each file is running information. The computing device can determine M target files from a plurality of files after obtaining the cache information of each file (all files).

[0269] When the value of the virtual memory segment enabling interface is 0 and the value of the file cache enabling interface is -1, the cache information of each file is running information. The computing device can determine each file as a target file after obtaining the cache information of each file.

[0270] When the value of the virtual memory segment enabling interface is -1 and the value of the file cache enabling interface is M, the memory usage information of each process and the cache information of each file are running information. The computing device can determine a plurality of target virtual memory segments of each process and M target files from a plurality of files after obtaining the memory usage information of each process and the cache information of each file.

[0271] When the value of the virtual memory segment enabling interface is -1 and the value of the file cache enabling interface is -1, the memory usage information of each process and the cache information of each file are running information. The computing device can determine a plurality of target virtual memory segments of each process and each file as a target file after obtaining the memory usage information of each process and the cache information of each file.

[0272] When the value of the virtual memory segment enabling interface is -1 and the value of the file cache enabling interface is 0, the memory usage information of each process is running information. The computing device can determine a plurality of target virtual memory segments of each process after obtaining the memory usage information of each process.

[0273] When the value of the virtual memory segment enabling interface is N and the value of the file cache enabling interface is M, the memory usage information of each process and the cache information of each file are running information. The computing device can determine N target virtual memory segments from the plurality of virtual memory segments of the plurality of processes and determine M target files from the plurality of files after obtaining the memory usage information of each process and the cache information of each file.

[0274] When the value of the virtual memory segment enabling interface is N and the value of the file cache enabling interface is -1, the memory usage information of each process and the cache information of each file are running information. The computing device can determine N target virtual memory segments from the plurality of virtual memory segments of the plurality of processes and determine each file as a target file after obtaining the memory usage information of each process and the cache information of each file.

[0275] When the value of the virtual memory segment enabling interface is N and the value of the file cache enabling interface is 0, the memory usage information of each process is running information. The computing device can determine N target virtual memory segments from the plurality of virtual memory segments of the plurality of processes after obtaining the memory usage information of each process.

[0276] For each target virtual memory segment, the computing device can determine a first program code in the program code corresponding to the process (the process corresponding to the target virtual memory segment) according to the target virtual memory segment after determining the target virtual memory segment, wherein the first program code is the code corresponding to the target virtual memory segment. The computing device can determine fault information, wherein the fault information is used to indicate that the first program code is abnormal.

[0277] The computing device can determine a second program code in the program code corresponding to the target process (the process accessing the target file) according to the target file after determining the target file, wherein the second program code is the code accessing the target file. The computing device can determine fault information to indicate that the second program code is abnormal.

[0278] It should be noted that when the computing device determines at least one target virtual memory segment and at least one target file, the computing device can determine fault information to indicate that at least one first program code is abnormal and at least one second program code is abnormal after determining the first program code corresponding to each target virtual memory segment and the second program code corresponding to each target file.

[0279] The beneficial effects of the embodiment are as follows: the computing device can set the values of the running information total interface, the virtual memory segment enabling interface, and the file cache enabling interface according to the information enhancement instruction. When the memory overflows, the computing device can obtain the running information of the computing device according to the values of the running information total interface, the virtual memory segment enabling interface, and the file cache enabling interface, and determine the fault information of the computing device according to the running information. In the above manner, the specific content of the running information can be flexibly set, thereby improving the utilization rate of the running information and reducing the resources consumed for locating the fault.

[0280] The following is an apparatus embodiment of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the apparatus embodiments of the present application, refer to the method embodiments of the present application.

[0281] Figure 6 The structure diagram of the fault locating apparatus provided by the embodiment of the present application is shown in FIG. 6. As shown in FIG. 6, the fault locating apparatus 60 includes an acquisition module 61 and a processing module 62. Wherein, Figure 6

[0282] The acquisition module 61 is configured to acquire the running information of the computing device.

[0283] The processing module 62 is configured to determine the fault information of the computing device according to the running information.

[0284] The running information includes at least one of the following: memory usage information of each process, or cache information of each file, the memory usage information of the process includes actual memory occupation sizes corresponding to a plurality of virtual memory segments allocated for the process, and the cache information includes a file cache size of the file cached to the memory.

[0285] The fault locating apparatus provided by the embodiment of the present application can execute the technical solutions shown in the above method embodiments, and has similar implementation principles and beneficial effects, which will not be described here.

[0286] In one implementation manner, the running information includes the memory usage information of each process; and the processing module 62 is specifically configured to:

[0287] determine a target virtual memory segment in a plurality of virtual memory segments corresponding to at least one process according to actual memory occupation sizes corresponding to the plurality of virtual memory segments allocated for the process;

[0288] determine the fault information according to a process corresponding to the target virtual memory segment.

[0289] The fault locating apparatus provided by the embodiment of the present application can execute the technical solutions shown in the above method embodiments, and has similar implementation principles and beneficial effects, which will not be described here. ​

[0290] In an implementation manner, the processing module 62 is specifically configured to:

[0291] The plurality of virtual memory segments corresponding to the at least one process are sorted in descending order of the corresponding actual memory occupation sizes, and the first N virtual memory segments in the sorted order are determined as the target virtual memory segments, N being an integer greater than or equal to 1; or,

[0292] The virtual memory segment with the corresponding actual memory occupation size greater than or equal to the first threshold value is determined as the target virtual memory segment.

[0293] The fault locating apparatus provided by the embodiments of the present application can execute the technical solutions shown in the method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.

[0294] In an implementation manner, the processing module 62 is specifically configured to:

[0295] The first program code is determined in the program code corresponding to the process according to the target virtual memory segment, the first program code being the code corresponding to the target virtual memory segment;

[0296] The fault information is determined, the fault information being used to indicate that the first program code is abnormal.

[0297] The fault locating apparatus provided by the embodiments of the present application can execute the technical solutions shown in the method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.

[0298] In an implementation manner, the processing module 62 is specifically configured to:

[0299] The target file is determined in the at least one file according to the file cache size of each file cached to the memory;

[0300] The target process accessing the target file is determined;

[0301] The fault information is determined according to the target file and the target process.

[0302] The fault locating apparatus provided by the embodiments of the present application can execute the technical solutions shown in the method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.

[0303] In an implementation manner, the processing module 62 is specifically configured to:

[0304] The at least one file is sorted in descending order of the file cache size, and the first M files in the sorted order are determined as the target files, M being an integer greater than or equal to 1; or,

[0305] determine the file as a target file if the file cache size of the file is greater than or equal to a second threshold value; or

[0306] determine a cache ratio of each file cached to the memory according to the file size of each file and the file cache size of each file cached to the memory, and determine a target file in the at least one file according to the cache ratio.

[0307] The fault locating apparatus provided by the embodiments of the present application can execute the technical solutions shown in the method embodiments, and has similar implementation principles and beneficial effects, which will not be repeated here.

[0308] In an implementation manner, the processing module 62 is specifically configured to:

[0309] determine file access information of each process in the at least one process, the file access information including an identifier of a file accessed by the process;

[0310] determine the target process according to the file access information and the identifier of the target file.

[0311] The fault locating apparatus provided by the embodiments of the present application can execute the technical solutions shown in the method embodiments, and has similar implementation principles and beneficial effects, which will not be repeated here.

[0312] In an implementation manner, the processing module 62 is specifically configured to:

[0313] determine second program code in the program code corresponding to the target process according to the target file, the second program code being code for accessing the target file;

[0314] determine fault information, the fault information being used for indicating that the second program code is abnormal.

[0315] The fault locating apparatus provided by the embodiments of the present application can execute the technical solutions shown in the method embodiments, and has similar implementation principles and beneficial effects, which will not be repeated here.

[0316] In an implementation manner, the running information further includes memory usage information of the kernel space; the computing device includes a plurality of kernel modules; the memory usage information of the kernel space includes a memory size occupied by each kernel module and a total memory size occupied by the kernel space; and the processing module 62 is further configured to:

[0317] for any one kernel module, determine a memory occupation ratio of the kernel module according to the memory size occupied by the kernel module and the total memory size;

[0318] determine a kernel module as a target kernel module if the memory occupation ratio of the kernel module is greater than or equal to a third threshold value;

[0319] According to the target kernel module, the auxiliary fault information is determined, and the auxiliary fault information is used to indicate program code exception corresponding to the target kernel module; the fault message further includes the auxiliary fault information.

[0320] The fault positioning apparatus provided by the embodiments of the present application can execute the technical solutions shown in the method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.

[0321] In an implementation manner, the obtaining module 61 is specifically configured to:

[0322] When the memory overflow occurs, the running information of the computing device is obtained according to the value of the running information total interface, the value of the virtual memory segment enabling interface, and the value of the file cache enabling interface.

[0323] The fault positioning apparatus provided by the embodiments of the present application can execute the technical solutions shown in the method embodiments, and the implementation principles and beneficial effects are similar, which will not be repeated here.

[0324] Figure 7 A structural schematic diagram of the computing device provided by the embodiments of the present application is provided. As shown in the figure, Figure 7 The computing device 70 includes a processor 71 and a memory 72; the processor 71 is in communication connection with the memory 72, and the memory 72 is configured to store computer execution instructions; the processor 71 is configured to execute the technical solutions in the foregoing method embodiments by executing the computer execution instructions stored in the memory 72.

[0325] Optionally, the memory 72 can be independent or integrated with the processor 71. Optionally, when the memory 72 is independent of the processor 71, the computing device 70 can further include a bus 73 for connecting the above-mentioned devices.

[0326] The processor is configured to execute the technical solutions in the foregoing method embodiments, and the implementation principles and technical effects are similar, which will not be repeated here.

[0327] The embodiments of the present application further provide a computer readable storage medium, and the computer readable storage medium stores computer execution instructions. When the computer execution instructions are executed by the processor, the computer execution instructions are configured to implement the technical solutions provided by the foregoing method embodiments.

[0328] The embodiments of the present application further provide a computer program product, and the computer program product includes a computer program. When the computer program is executed by the processor, the computer program is configured to implement the technical solutions provided by the foregoing method embodiments.

[0329] Those skilled in the art can understand that all or part of the steps of the foregoing method embodiments can be completed by program instruction related hardware. The foregoing program can be stored in a computer readable storage medium. The program executes to perform the steps of the foregoing method embodiments; and the foregoing storage medium includes a volatile memory, a non-volatile memory, and various media that can store program codes.

[0330] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A fault location method, characterized in that, include: Obtain the operating information of the computing device; wherein the operating information includes at least one of the following: memory usage information of each process, or cache information of each file, wherein the memory usage information of each process includes the actual memory usage size corresponding to the multiple virtual memory segments allocated to the process, and the cache information of each file includes the file cache size of the file cached in memory; based on the operating information, determine the target virtual memory segment in the multiple virtual memory segments corresponding to at least one process and / or the target file in at least one file; Based on the target virtual memory segment and / or the target file, determine the fault information of the computing device; the fault information is used to indicate a first program code exception and / or a second program code exception: the first program code is the code in the program code of the process corresponding to the target virtual memory segment that corresponds to the target virtual memory segment, and the second program code is the code in the program code of the target process that accesses the target file that accesses the target file.

2. The method according to claim 1, characterized in that, The runtime information includes memory usage information for each process; determining the target virtual memory segment among multiple virtual memory segments corresponding to at least one process based on the runtime information includes: The virtual memory segments corresponding to the at least one process are sorted in descending order of their actual memory usage, and the top N virtual memory segments after sorting are determined as the target virtual memory segment, where N is an integer greater than or equal to 1; or, The virtual memory segment whose actual memory usage is greater than or equal to the first threshold is determined as the target virtual memory segment.

3. The method according to claim 1, characterized in that, Based on the target virtual memory segment, the fault information is determined, including: The first program code corresponding to the target virtual memory segment is determined from the program code of the process corresponding to the target virtual memory segment; The fault information is determined, and the fault information is used to indicate that the first program code is abnormal.

4. The method according to claim 2, characterized in that, Based on the target virtual memory segment, the fault information is determined, including: The first program code corresponding to the target virtual memory segment is determined from the program code of the process corresponding to the target virtual memory segment; The fault information is determined, and the fault information is used to indicate that the first program code is abnormal.

5. The method according to any one of claims 1-4, characterized in that, The cache information of each file in the runtime information package; Based on the target file, the fault information of the computing device is determined, including: Determine the target process that will access the target file; Based on the target file, determine the second program code that accesses the target file in the program code corresponding to the target process; The fault information is determined, and the fault information is used to indicate that the second program code is abnormal.

6. The method according to claim 5, characterized in that, Determining the target process that accesses the target file includes: Determine the file access information of each process in the at least one process, wherein the file access information includes the identifier of the file accessed by the process; The target process is determined based on the file access information and the identifier of the target file.

7. The method according to claim 3, characterized in that, The operational information also includes kernel space memory usage information; the computing device includes multiple kernel modules; the kernel space memory usage information includes the memory size occupied by each kernel module and the total memory size occupied by the kernel space; the method further includes: For any given kernel module, the memory usage ratio of the kernel module is determined based on the memory size occupied by the kernel module and the total memory size. Kernel modules whose memory usage ratio is greater than or equal to the third threshold are identified as target kernel modules; The method further includes: Based on the target kernel module, auxiliary fault information is determined, which is used to indicate that the program code corresponding to the target kernel module is abnormal; the fault information also includes the auxiliary fault information.

8. The method according to claim 4, characterized in that, The operational information also includes kernel space memory usage information; the computing device includes multiple kernel modules; the kernel space memory usage information includes the memory size occupied by each kernel module and the total memory size occupied by the kernel space; the method further includes: For any given kernel module, the memory usage ratio of the kernel module is determined based on the memory size occupied by the kernel module and the total memory size. Kernel modules whose memory usage ratio is greater than or equal to the third threshold are identified as target kernel modules; The method further includes: Based on the target kernel module, auxiliary fault information is determined, which is used to indicate that the program code corresponding to the target kernel module is abnormal; the fault information also includes the auxiliary fault information.

9. The method according to claim 6, characterized in that, The operational information also includes kernel space memory usage information; the computing device includes multiple kernel modules; the kernel space memory usage information includes the memory size occupied by each kernel module and the total memory size occupied by the kernel space; the method further includes: For any given kernel module, the memory usage ratio of the kernel module is determined based on the memory size occupied by the kernel module and the total memory size. Kernel modules whose memory usage ratio is greater than or equal to the third threshold are identified as target kernel modules; The method further includes: Based on the target kernel module, auxiliary fault information is determined, which is used to indicate that the program code corresponding to the target kernel module is abnormal; the fault information also includes the auxiliary fault information.

10. The method according to any one of claims 1-4 or 6-9, characterized in that, Obtain operational information from computing devices, including: When memory overflow occurs, the operating information of the computing device is obtained based on the values ​​of the total running information interface, the virtual memory segment enable interface, and the file cache enable interface.

11. A computing device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory is used to store computer-executed instructions; The processor is used to execute computer execution instructions stored in the memory to implement the fault location method according to any one of claims 1-10.

Citation Information

Patent Citations

  • Method and device for processing lagging

    CN113407344A