Cause analysis method, device, electronic device, medium and computer program product
By analyzing the fault log and application log, combined with large objects in the heap dump file, accurately locate transaction requests that cause Java heap memory overflow, the problem of inaccurate positioning in the existing technology is solved and the efficiency and accuracy of problem solving is improved.
Patent Information
- Application Number
- CN202210234778.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-10
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2042-03-10
AI Technical Summary
When analyzing Java heap memory overflow, it is difficult to accurately locate the specific program function points that cause problems, which makes the problems difficult to solve and occur frequently.
By analyzing the fault log and application log, pre-select the transaction request that causes memory overflow, and confirm the correlation with large objects in the heap dump file to determine it as the cause of memory overflow.
It improves the positioning accuracy of memory overflow and the efficiency of solving problems, avoids the problem of not being able to locate programs by relying solely on large objects, and realizes cost-saving analysis methods.
Smart Images

Figure CN114564408B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and more specifically, to a method, device, electronic device, medium and computer program product for analyzing the cause of memory overflow. Background Art
[0002] Java heap memory overflow is the most common fault in Java programs, which is usually caused by large objects or memory leaks in the application. The common analysis method for this type of problem is to collect heapdump files when the memory overflows, analyze the names of objects occupying the Java heap interval, and locate the cause of the large objects. The current analysis method can locate large objects relatively quickly, but in actual practice, developers often report that the large objects occupied are mostly public objects, and it is impossible to locate the specific program function point that caused the problem. Therefore, for many large object problems, developers can only guess and try to make some optimizations, but because the problem point is not really found, the problem is generally difficult to solve, and the problem will occur frequently. Summary of the invention
[0003] In view of this, the present disclosure provides a method, device, electronic device, computer-readable storage medium and computer program product for analyzing the cause of memory overflow with accurate positioning, high efficiency and cost saving.
[0004] One aspect of the present disclosure provides a method for analyzing the cause of a memory overflow, comprising: obtaining a fault record log, wherein the fault record log includes memory occupancy information and first time information corresponding to the memory occupancy information; obtaining an application log, wherein the application log includes a transaction request and second time information corresponding to the transaction request; when the first time information and the second time information meet a matching condition, determining that the transaction request is a pre-selected transaction request that causes the memory overflow; obtaining a heap dump file, wherein the heap dump file includes an object file, and the object file has a storage size; determining a target object in the heap dump file according to the storage size of the object file; confirming the correlation between the pre-selected transaction request and the target object; and when the pre-selected transaction request is correlated with the target object, taking the pre-selected transaction request as the cause of the memory overflow.
[0005] According to the method for analyzing the cause of memory overflow in the embodiment of the present disclosure, by analyzing the fault record log and the application log, the transaction request that caused the memory overflow can be pre-selected, and the transaction request related to the target object, that is, the large object in the heap dump file, can be confirmed to be associated with the transaction request, so that the transaction request related to the large object can be regarded as the cause of the memory overflow. The problem that the program cannot be located by relying solely on large objects in the prior art is solved, and the accuracy of locating the memory overflow and the efficiency of solving the problem are greatly improved. In addition, the present disclosure can perform analysis only by relying on the existing fault record log and application log, without adding additional overhead, thereby achieving the purpose of cost saving.
[0006] In some embodiments, the first time information includes the start time and recovery time of memory occupation, and the second time information includes the initiation time and end time of the transaction request; when the first time information and the second time information meet the matching condition, determining that the transaction request is a pre-selected transaction request that causes memory overflow specifically includes: when the initiation time matches the start time, and the end time matches the recovery time, determining that the transaction request is a pre-selected transaction request that causes memory overflow.
[0007] In some embodiments, determining the target object in the heap dump file based on the storage size of the object file specifically includes: comparing the storage size with a preset storage threshold; and when the storage size meets the storage threshold, using the object file corresponding to the storage size as the target object in the heap dump file.
[0008] In some embodiments, the fault record log is a GC log.
[0009] In some embodiments, the application log is a Web log.
[0010] Another aspect of the present disclosure provides a memory overflow cause analysis device, comprising: a first acquisition module, the first acquisition module is used to execute acquisition of a fault record log, wherein the fault record log includes memory occupancy information and first time information corresponding to the memory occupancy information; a second acquisition module, the second acquisition module is used to execute acquisition of an application log, wherein the application log includes a transaction request and second time information corresponding to the transaction request; a first determination module, the first determination module is used to execute, when the first time information and the second time information meet a matching condition, determining that the transaction request is a pre-selected transaction request that causes the memory overflow; a third acquisition module, the third acquisition module is used to execute acquisition of a heap dump file, wherein the heap dump file includes an object file, and the object file has a storage size; a second determination module, the second determination module is used to execute determination of a target object in the heap dump file according to the storage size of the object file; a judgment module, the judgment module is used to execute correlation confirmation between the pre-selected transaction request and the target object; and a third determination module, the third determination module is used to execute, when the pre-selected transaction request is related to the target object, taking the pre-selected transaction request as the cause of the memory overflow.
[0011] In some embodiments, the second determination module specifically includes: a comparison unit, which is used to compare the storage size with a preset storage threshold; and a determination unit, which is used to execute, when the storage size meets the storage threshold, using the object file corresponding to the storage size as the target object in the heap dump file.
[0012] Another aspect of the present disclosure provides an electronic device, comprising one or more processors and one or more memories, wherein the memories are used to store executable instructions, and when the executable instructions are executed by the processors, the above-mentioned method is implemented.
[0013] Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the above method when executed.
[0014] Another aspect of the present disclosure provides a computer program product, comprising a computer program, wherein the computer program comprises computer executable instructions, and the instructions are used to implement the method as described above when executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0016] Figure 1An exemplary system architecture to which the method and apparatus according to an embodiment of the present disclosure can be applied is schematically shown;
[0017] Figure 2 A flowchart of a method for analyzing the cause of memory overflow according to an embodiment of the present disclosure is schematically shown;
[0018] Figure 3 A flowchart of determining that a transaction request is a pre-selected transaction request that causes a memory overflow according to an embodiment of the present disclosure is schematically shown;
[0019] Figure 4 A flowchart of determining a target object in a heap dump file according to a storage size of the object file according to an embodiment of the present disclosure is schematically shown;
[0020] Figure 5 A structural block diagram of a device for analyzing the cause of memory overflow according to an embodiment of the present disclosure is schematically shown;
[0021] Figure 6 The structure block diagram of the second determination module according to the embodiment of the present disclosure is schematically shown;
[0022] Figure 7 A block diagram of an electronic device according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0023] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0024] In the technical solution of this disclosure, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations, necessary confidentiality measures are taken, and they do not violate public order and good morals. In the technical solution of this disclosure, the acquisition, collection, storage, use, processing, transmission, provision, disclosure and application of data are in compliance with the provisions of relevant laws and regulations, necessary confidentiality measures are taken, and they do not violate public order and good morals.
[0025] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0026] When using expressions such as "at least one of A, B or C, etc.", it should generally be interpreted in accordance with the meaning of the expression generally understood by those skilled in the art (for example, "a system having at least one of A, B or C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.). The terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, features defined as "first" and "second" may explicitly or implicitly include one or more of the said features.
[0027] Java heap memory overflow is the most common fault in Java programs, which is usually caused by large objects or memory leaks in the application. The common analysis method for this type of problem is to collect heapdump files when the memory overflows, analyze the names of objects occupying the Java heap interval, and locate the cause of the large objects. The current analysis method can locate large objects relatively quickly, but in actual practice, developers often report that the large objects occupied are mostly public objects, and it is impossible to locate the specific program function point that caused the problem. Therefore, for many large object problems, developers can only guess and try to make some optimizations, but because the problem point is not really found, the problem is generally difficult to solve, and the problem will occur frequently.
[0028] Embodiments of the present disclosure provide a method, device, electronic device, computer-readable storage medium, and computer program product for analyzing the cause of a memory overflow. The method for analyzing the cause of a memory overflow includes: obtaining a fault record log, wherein the fault record log includes memory occupancy information and first time information corresponding to the memory occupancy information; obtaining an application log, wherein the application log includes a transaction request and second time information corresponding to the transaction request; when the first time information and the second time information meet a matching condition, determining that the transaction request is a pre-selected transaction request that causes a memory overflow; obtaining a heap dump file, wherein the heap dump file includes an object file, and the object file has a storage size; determining a target object in the heap dump file according to the storage size of the object file; confirming the correlation between the pre-selected transaction request and the target object; and when the pre-selected transaction request is related to the target object, taking the pre-selected transaction request as the cause of the memory overflow.
[0029] It should be noted that the memory overflow cause analysis method, device, electronic device, computer-readable storage medium and computer program product disclosed in the present invention can be used in the field of artificial intelligence technology, and can also be used in any field outside the field of artificial intelligence technology, such as the financial field. The field of the present invention is not limited here.
[0030] Figure 1The exemplary system architecture 100 to which the method, apparatus, electronic device, computer-readable storage medium, and computer program product for analyzing the cause of memory overflow according to an embodiment of the present disclosure can be applied is schematically shown. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0031] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0032] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).
[0033] The terminal devices 101 , 102 , and 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0034] The server 105 may be a server that provides various services, such as a background management server (only an example) that provides support for websites browsed by users using the terminal devices 101, 102, and 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0035] It should be noted that the cause analysis method of memory overflow provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the cause analysis device of memory overflow provided in the embodiment of the present disclosure can generally be set in the server 105. The cause analysis method of memory overflow provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105. Accordingly, the cause analysis device of memory overflow provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105.
[0036] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0037] The following will be based on Figure 1 The scene described by Figure 2 to Figure 4 The method for analyzing the cause of memory overflow in an embodiment of the present disclosure is described in detail.
[0038] Figure 2 The flowchart of the method for analyzing the cause of memory overflow according to an embodiment of the present disclosure is schematically shown.
[0039] like Figure 2 As shown, the method for analyzing the cause of memory overflow in this embodiment includes operations S210 to S270.
[0040] In operation S210, a fault record log is obtained, wherein the fault record log includes memory occupation information and first time information corresponding to the memory occupation information.
[0041] As a possible implementation method, the fault record log may be a GC log, which is a log specifically used to record problems in a Java virtual machine. The GC log records the abnormal situation of memory usage information and the corresponding time, which is also the first time information. For example, the memory usage information that is greater than or equal to the memory threshold can be recorded as abnormal information, and the corresponding first time information is recorded.
[0042] In operation S220, an application log is acquired, wherein the application log includes a transaction request and second time information corresponding to the transaction request.
[0043] As a possible implementation method, the application log may be a Web log. For example, the Web log may record the transaction request and the second time information corresponding to the transaction request.
[0044] In operation S230, when the first time information and the second time information satisfy a matching condition, the transaction request is determined to be a pre-selected transaction request that causes a memory overflow.
[0045] As an implementable manner, the first time information may include the start time and the recovery time of the memory usage, and the second time information may include the initiation time and the end time of the transaction request. Figure 3 As shown, operation S230 determines that the transaction request is a pre-selected transaction request that causes memory overflow when the first time information and the second time information meet the matching condition, specifically including operation S231.
[0046] In operation S231 , when the initiation time matches the start time and the end time matches the resume time, it is determined that the transaction request is a pre-selected transaction request that causes a memory overflow.
[0047] Taking IBM HTTP Server as an example, each access transaction request will be recorded in the IHS log, and there is a timestamp for each transaction request. The transaction request will be recorded in the log only after the transaction is completed. Under normal circumstances, transaction requests are recorded in sequence, and there may be a time disorder because the transaction request processing time is long. When the transaction request is processed, it will be recorded in the log, but the timestamp is still the time when the transaction request is initiated. Here, the timestamp time can be understood as the initiation time, and the time when the transaction request is recorded in the log can be understood as the end time.
[0048] The start time of memory usage can be matched with the initiation time, and the recovery time of memory usage can be matched with the end time. When the start time of memory usage is consistent with the initiation time, and the recovery time of memory usage is consistent with the end time, the transaction request can be determined as a pre-selected transaction request that causes memory overflow. Thus, operation S231 can facilitate the determination that the transaction request is a pre-selected transaction request that causes memory overflow when the first time information and the second time information meet the matching condition.
[0049] In operation S240 , a heap dump file, that is, a heapdump file, is obtained, wherein the heap dump file includes an object file, and the object file has a storage size.
[0050] In operation S250 , a target object in the heap dump file is determined according to a storage size of the object file.
[0051] As an implementable approach, Figure 4 As shown, operation S250 determines the target object in the heap dump file according to the storage size of the object file, and specifically includes operation S251 and operation S252.
[0052] In operation S251, the storage size is compared with a preset storage threshold.
[0053] In operation S252, when the storage size meets the storage threshold, the object file corresponding to the storage size is used as the target object in the heap dump file. For example, the set storage threshold may be a, and the storage size of the object file may be b. When b is greater than or equal to a, the object file may be identified as a larger object, and thus the object file may be used as the target object.
[0054] Operations S251 and S252 can facilitate the determination of a target object in a heap dump file according to the storage size of the object file.
[0055] In operation S260 , correlation is confirmed between the pre-selected transaction request and the target object.
[0056] In operation S270 , when the pre-selected transaction request is related to the target object, the pre-selected transaction request is used as a cause of the memory overflow.
[0057] According to the method for analyzing the cause of memory overflow in the embodiment of the present disclosure, by analyzing the fault record log and the application log, the transaction request that caused the memory overflow can be pre-selected, and the transaction request related to the target object, that is, the large object in the heap dump file, can be confirmed to be associated with the transaction request, so that the transaction request related to the large object can be regarded as the cause of the memory overflow. The problem that the program cannot be located by relying solely on large objects in the prior art is solved, and the accuracy of locating the memory overflow and the efficiency of solving the problem are greatly improved. In addition, the present disclosure can perform analysis only by relying on the existing fault record log and application log, without adding additional overhead, thereby achieving the purpose of cost saving.
[0058] The following describes in detail a method for analyzing the cause of memory overflow according to an embodiment of the present disclosure. It is worth noting that the following description is only an exemplary description and is not a specific limitation of the present disclosure.
[0059] According to the method in the prior art, by analyzing the heapdump file, only the object file A that causes the memory overflow can be located. According to the storage size of the object file A, A can be determined as the target object in the heapdump file, that is, a large object. For example, A can be org / apache / poi / hssf / usermodel / HSSF Workbook, which is the public interface poi of apache and is used for Excel operations. Through this analysis, it can only be confirmed that the function related to Excel operation caused the memory overflow. However, because the application has many related operation functions, it is impossible to accurately locate the specific program code. Only the functions involved in form processing can be checked in full, such as whether there is any processing without entry restrictions, etc. Because there is no targeted optimization, the problem is often not effectively and promptly solved and will recur.
[0060] In order to solve this problem, the method disclosed in the present invention can be used to first analyze the GC garbage collection log. For example, the time point when the memory peaked can be located at 11:06 and fell back at 11:12. Then, the Web log analysis can be performed. It should be noted that after the failure occurs, the APP must be stopped first, and then the Web must be stopped to ensure that the complete transaction request record can be obtained in the Web log.
[0061] Searching for 11:12 in the Web log and searching in sequence, we locate the request information at 11:06, which means that the request was initiated at 11:06 but ended at 11:12, which coincides with the time points when the memory surged and fell. It is very likely a transaction request that caused a memory overflow. From the detailed information of the transaction request, it is also the processing of xls (excel) format files, which matches the org / apache / poi / hssf / usermodel / HSSF Workbook large object generated in the heapdump file. It also contains the called page report_statistical_jsp, client address, user information, query range and other information. Finally, based on this information, it is located that a business person caused a memory overflow due to abnormal query data when performing report query and export functions. The problem can be solved by optimizing the program code.
[0062] Based on the above-mentioned memory overflow cause analysis method, the present disclosure also provides a memory overflow cause analysis device 10. Figure 5 The memory overflow cause analysis device 10 is described in detail.
[0063] Figure 5 The structural block diagram of the memory overflow cause analysis device 10 according to an embodiment of the present disclosure is schematically shown.
[0064] The memory overflow cause analysis device 10 comprises a first acquisition module 1 , a second acquisition module 2 , a first determination module 3 , a third acquisition module 4 , a second determination module 5 , a judgment module 6 and a third determination module 7 .
[0065] The first acquisition module 1 is used to perform operation S210: acquiring a fault record log, wherein the fault record log includes memory occupancy information and first time information corresponding to the memory occupancy information.
[0066] The second acquisition module 2 is used to perform operation S220: acquiring an application log, wherein the application log includes a transaction request and second time information corresponding to the transaction request.
[0067] The first determining module 3 is used to perform operation S230: when the first time information and the second time information meet the matching condition, determine that the transaction request is a pre-selected transaction request that causes memory overflow.
[0068] A third acquisition module 4, the third acquisition module 4 is used to perform operation S240: acquiring a heap dump file, wherein the heap dump file includes an object file, and the object file has a storage size;
[0069] The second determining module 5 is used to perform operation S250: determine the target object in the heap dump file according to the storage size of the object file.
[0070] The judgment module 6 is used to perform operation S260: confirm the relevance between the pre-selected transaction request and the target object.
[0071] The third determining module 7 is used to perform operation S270: when the pre-selected transaction request is related to the target object, the pre-selected transaction request is used as a cause of the memory overflow.
[0072] Figure 6 The structural block diagram of the second determination module 5 according to the embodiment of the present disclosure is schematically shown. The second determination module 5 includes a comparison unit 51 and a determination unit 52.
[0073] The comparing unit 51 is used to perform operation S251: comparing the storage size with a preset storage threshold.
[0074] The determining unit 52 is used to perform operation S252: when the storage size meets the storage threshold, use the object file corresponding to the storage size as the target object in the heap dump file.
[0075] According to the memory overflow cause analysis device of the embodiment of the present disclosure, by analyzing the fault record log and the application log, the transaction request that caused the memory overflow can be pre-selected, and the transaction request related to the target object, that is, the large object in the heap dump file, can be confirmed to be associated with the transaction request, so that the transaction request related to the large object is regarded as the cause of the memory overflow. The problem that the program cannot be located by relying solely on large objects in the prior art is solved, and the accuracy of locating the memory overflow and the efficiency of solving the problem are greatly improved. In addition, the present disclosure can perform analysis only by relying on the existing fault record log and application log, without adding additional overhead, thereby achieving the purpose of cost saving.
[0076] In addition, according to an embodiment of the present disclosure, any multiple modules among the first acquisition module 1, the second acquisition module 2, the first determination module 3, the third acquisition module 4, the second determination module 5, the judgment module 6 and the third determination module 7 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module.
[0077] According to an embodiment of the present disclosure, at least one of the first acquisition module 1, the second acquisition module 2, the first determination module 3, the third acquisition module 4, the second determination module 5, the judgment module 6 and the third determination module 7 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application-specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or can be implemented in any one of the three implementation methods of software, hardware and firmware, or in an appropriate combination of any of them.
[0078] Alternatively, at least one of the first acquisition module 1, the second acquisition module 2, the first determination module 3, the third acquisition module 4, the second determination module 5, the judgment module 6 and the third determination module 7 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.
[0079] Figure 7 A block diagram of an electronic device suitable for implementing the above method according to an embodiment of the present disclosure is schematically shown.
[0080] like Figure 7As shown, the electronic device 900 according to an embodiment of the present disclosure includes a processor 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 into a random access memory (RAM) 903. The processor 901 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 901 may also include an onboard memory for caching purposes. The processor 901 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0081] In RAM 903, various programs and data required for the operation of electronic device 900 are stored. Processor 901, ROM 902 and RAM 903 are connected to each other via bus 904. Processor 901 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 902 and / or RAM 903. It should be noted that the program can also be stored in one or more memories other than ROM 902 and RAM 903. Processor 901 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0082] According to an embodiment of the present disclosure, the electronic device 900 may further include an input / output (I / O) interface 905, which is also connected to the bus 904. The electronic device 900 may further include one or more of the following components connected to the I / O interface 905: an input portion 906 including a keyboard, a mouse, etc.; an output portion 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 908 including a hard disk, etc.; and a communication portion 909 including a network interface card such as a LAN card, a modem, etc. The communication portion 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the input / output (I / O) interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage portion 908 as needed.
[0083] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0084] According to an embodiment of the present disclosure, a computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus, or a device. For example, according to an embodiment of the present disclosure, a computer-readable storage medium may include the ROM 902 and / or RAM 903 described above and / or one or more memories other than ROM 902 and RAM 903.
[0085] The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the method of the embodiment of the present disclosure.
[0086] The above functions defined in the system / device of the embodiment of the present disclosure are performed when the computer program is executed by the processor 901. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0087] In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of a signal on a network medium, and downloaded and installed through the communication part 909, and / or installed from a removable medium 911. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0088] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the processor 901, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.
[0089] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0090] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0091] It will be appreciated by those skilled in the art that the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations and / or combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways without departing from the spirit and teachings of the present disclosure. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0092] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A method for analyzing the cause of memory overflow, characterized in that: include: Obtaining a fault record log, wherein the fault record log includes memory occupancy information and first time information corresponding to the memory occupancy information; Acquire an application log, wherein the application log includes a transaction request and second time information corresponding to the transaction request; When the first time information and the second time information meet a matching condition, determining that the transaction request is a pre-selected transaction request that causes a memory overflow; Obtaining a heap dump file, wherein the heap dump file includes an object file, and the object file has a storage size; Determining a target object in the heap dump file according to a storage size of the object file; Confirming the relevance between the pre-selected transaction request and the target object; and When the pre-selected transaction request is related to the target object, taking the pre-selected transaction request as a cause of the memory overflow; The first time information includes the start time and the recovery time of the memory usage, and the second time information includes the initiation time and the end time of the transaction request; When the first time information and the second time information meet a matching condition, determining that the transaction request is a pre-selected transaction request that causes a memory overflow specifically includes: When the initiation time matches the start time, and the end time matches the resumption time, it is determined that the transaction request is a pre-selected transaction request that causes a memory overflow.
2. The method according to claim 1, characterized in that: Determining the target object in the heap dump file according to the storage size of the object file specifically includes: comparing the storage size with a preset storage threshold; and When the storage size meets the storage threshold, the object file corresponding to the storage size is used as the target object in the heap dump file.
3. The method according to claim 1, characterized in that The fault record log is a GC log.
4. The method according to claim 1, characterized in that: The application log is a Web log.
5. A memory overflow cause analysis device, characterized in that: include: A first acquisition module, wherein the first acquisition module is used to execute acquisition of a fault record log, wherein the fault record log includes memory occupancy information and first time information corresponding to the memory occupancy information; A second acquisition module, the second acquisition module is used to execute acquisition of application logs, wherein the application logs include a transaction request and second time information corresponding to the transaction request; a first determining module, configured to determine, when the first time information and the second time information meet a matching condition, that the transaction request is a pre-selected transaction request that causes a memory overflow; a third acquisition module, the third acquisition module being used to execute acquisition of a heap dump file, wherein the heap dump file includes an object file, and the object file has a storage size; a second determination module, the second determination module being configured to determine a target object in the heap dump file according to a storage size of the object file; a determination module, the determination module being used to confirm the relevance between the pre-selected transaction request and the target object; and a third determining module, the third determining module being used to determine, when the pre-selected transaction request is related to the target object, the pre-selected transaction request as a cause of the memory overflow; The first time information includes the start time and the recovery time of the memory usage, and the second time information includes the initiation time and the end time of the transaction request; When the first time information and the second time information meet a matching condition, determining that the transaction request is a pre-selected transaction request that causes a memory overflow specifically includes: When the initiation time matches the start time, and the end time matches the resumption time, it is determined that the transaction request is a pre-selected transaction request that causes a memory overflow.
6. The device according to claim 5, characterized in that The second determination module specifically includes: a comparing unit, the comparing unit being configured to compare the storage size with a preset storage threshold; and A determining unit, wherein the determining unit is configured to execute, when the storage size meets the storage threshold, using the object file corresponding to the storage size as a target object in the heap dump file.
7. An electronic device, characterized in that: include: one or more processors; One or more memories, used to store executable instructions, which, when executed by the processor, implement the method according to any one of claims 1 to 4.
8. A computer-readable storage medium, characterized in that: The storage medium stores executable instructions, which, when executed by a processor, implement the method according to any one of claims 1 to 4.
9. A computer program product, characterized in that The method comprises a computer program, wherein the computer program comprises one or more executable instructions, and when the executable instructions are executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Device and method of automatically acquiring application anomalies based on LOG4J logging framework
CN103488558A
Memory recovery anomaly detection method and device, equipment and medium
CN114048150A