Crash handling method, device, computer equipment and medium
By analyzing the degree of repairability and determining the processing method, the problem of high cost and low efficiency of application crash repair in the existing technology is solved, and efficient repair and compatibility improvement is achieved.
Patent Information
- Application Number
- CN202011505937.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-18
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2040-12-18
AI Technical Summary
In the case of application crashes, the current technology cannot effectively determine the degree of repairability of the crash, resulting in high repair costs and low efficiency.
By obtaining the crash log, parsing the crash log to get the crash address and cause, calculating the degree of repairability of the crash, and determining whether to call the pretrained crash repair model for self-repair based on the preset threshold, or closing the relevant stack entrance to hide the crash page.
Improves the repair efficiency of the application, reduces the repair cost, avoids frequent version upgrades through self-healing, improves application compatibility, and hides crash pages to prevent the application from exiting abnormally.
Smart Images

Figure CN112559234B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a crash processing method, device, computer equipment and medium. Background Art
[0002] With the continuous development and progress of computer technology, applications on smart terminals such as smartphones and tablet computers provide more and more services. Applications may crash during operation due to various reasons. When an application crashes, it is usually necessary to repair the application.
[0003] In some program repair methods of related technologies, usually after the application crashes, the staff repairs the entire application to obtain an updated version of the program. The updated version of the program is then sent to the smart terminal to update the program version. However, the above technical solution does not judge the degree of repairability of the crash. For some low-level errors, such as only a type error of the JSON entity or a small bug that occurs due to negligence during the development and testing process, if the entire application still needs to be repaired, it will undoubtedly increase the repair cost of the application and reduce the repair efficiency of the application.
[0004] Therefore, it is necessary to provide an application-based crash handling method that can reduce the repair cost of the application and improve the repair efficiency of the application. Summary of the invention
[0005] In view of the above, it is necessary to propose a crash handling method, a crash handling device, a computer device and a medium, which can determine the best crash handling method for different repairability levels and improve the repair efficiency of the application.
[0006] A first aspect of an embodiment of the present application provides a crash processing method, the crash processing method comprising:
[0007] Starting an application, and when the application crashes, obtaining a crash log corresponding to the crash;
[0008] Parsing the crash log to obtain target information of the crash, the target information including the crash address and the crash cause;
[0009] Calculating the repairability of the crash according to the target information;
[0010] Detecting whether the degree of repairability exceeds a preset threshold range of the degree of repairability;
[0011] When the detection result shows that the repairability exceeds a preset repairability threshold range, calling a pre-trained crash repair model to self-repair the crash;
[0012] When the detection result is that the repairability level does not exceed a preset repairability level threshold range, a target stack entry matching the crash is determined and closed.
[0013] Furthermore, in the above crash handling method provided by the present application, determining whether the application crashes includes:
[0014] After the application is started, registering a crash signal processing interface;
[0015] Determining whether the crash signal processing interface intercepts a crash signal;
[0016] When the judgment result is that the crash signal processing interface intercepts the crash signal, it is determined that the application crashes;
[0017] When the judgment result is that the crash signal processing interface does not intercept the crash signal, it is determined that the application program does not crash.
[0018] Furthermore, in the above crash handling method provided by the present application, determining whether the application crashes further includes:
[0019] Get the code data of the application;
[0020] Locating a target position in the code data, and performing point embedding at the target position;
[0021] Parsing feedback data corresponding to the tracking point, and detecting whether the feedback data contains crash information;
[0022] When the detection result is that the feedback data includes crash information, determining that the application crashes;
[0023] When the detection result is that the feedback data does not include crash information, it is determined that the application program has not crashed.
[0024] Furthermore, in the above crash processing method provided in the present application, the calculating the degree of repairability of the crash according to the target information includes:
[0025] determining a first score for the crash address;
[0026] determining a second score for the cause of the crash;
[0027] The repairability of the crash is calculated according to the first score, the second score, and a preset weight.
[0028] Further, in the above crash handling method provided by the present application, the determining of the first score related to the crash address includes:
[0029] Obtaining a crash address of the crash;
[0030] Traversing the preset mapping relationship between addresses and repairability levels to determine a first repairability level corresponding to the crash address;
[0031] A first score is calculated according to the first repairability level.
[0032] Furthermore, in the above-mentioned crash handling method provided by the present application, calling a pre-trained crash repair model to self-repair the crash includes:
[0033] Obtaining the crash address and crash cause of the crash;
[0034] Inputting the crash address and the crash cause into the crash repair model to obtain a crash repair code;
[0035] A crash repair strategy is determined according to the crash repair code, and the crash is self-repaired based on the crash repair strategy.
[0036] Furthermore, in the above crash handling method provided by the present application, the determining and closing the target stack entry matching the crash includes:
[0037] Get the crash address;
[0038] Determine a target stack entry of the application program according to the crash address;
[0039] Close the target stack entry.
[0040] A second aspect of the embodiment of the present application further provides a crash processing device, the crash processing device comprising:
[0041] A log acquisition module, used to start an application and, when the application crashes, acquire a crash log corresponding to the crash;
[0042] A log parsing module, used to parse the crash log to obtain target information of the crash, wherein the target information includes a crash address and a crash cause;
[0043] a degree calculation module, used to calculate the repairability degree of the crash according to the target information;
[0044] A range detection module, used to detect whether the repairability exceeds a preset repairability threshold range;
[0045] A crash repair module, used to call a pre-trained crash repair model to self-repair the crash when the detection result shows that the repairability exceeds a preset repairability threshold range;
[0046] The entry closing module is used to determine and close the target stack entry matching the crash when the detection result shows that the repairability does not exceed a preset repairability threshold range.
[0047] A third aspect of an embodiment of the present application further provides a computer device, the computer device comprising a processor, the processor being configured to implement any one of the above-described crash handling methods when executing a computer program stored in a memory.
[0048] A fourth aspect of an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the crash handling method as described in any one of the above items is implemented.
[0049] The above-mentioned crash handling method, crash handling device, computer equipment and computer-readable storage medium provided in the embodiments of the present application calculate the repairability of the crash based on the crash log, and determine the optimal crash handling method for different repairability levels, which can improve the repair efficiency of the application; and the present application completes self-repair of crashes with high repairability through machine learning, avoiding the problem of high repair costs caused by manually solving the crash, and can avoid frequent version upgrades through self-repair, thereby improving the compatibility of the application; in addition, the present application hides the crash page by closing the stack entry of the crash that cannot be self-repaired, making the crash page invisible to the user, avoiding the problem of abnormal exit of the application due to the user's operation on the crash page, which is conducive to promoting the development of smart medical care and the construction of smart cities. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a flowchart of the crash handling method provided by the first embodiment of the present invention.
[0051] Figure 2 It is a schematic diagram of the structure of a computer device according to one embodiment of the present invention.
[0052] Figure 3 yes Figure 2 An exemplary functional module diagram of a computer device is shown.
[0053] The following specific implementation manner will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0054] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0055] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. The embodiments described are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0056] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0057] Figure 1 FIG. 1 is a flowchart of a crash handling method according to a first embodiment of the present invention. Figure 1 As shown, the crash handling method may include the following steps:
[0058] S11. Start an application program, and when the application program crashes, obtain a crash log corresponding to the crash.
[0059] In at least one embodiment of the present application, an application is started, and after the application is started, it is necessary to determine whether the application crashes. Optionally, a global crash capture method is used to determine whether the application crashes. The determination of whether the application crashes includes: after the application is started, registering a crash signal processing interface; determining whether the crash signal processing interface intercepts a crash signal; when the judgment result is that the crash signal processing interface intercepts a crash signal, determining that the application crashes; when the judgment result is that the crash signal processing interface does not intercept the crash signal, determining that the application does not crash.
[0060] The crash information processing interface is used to intercept the crash signal of the application. In one embodiment, the crash information processing interface may be an UncaughtExceptionHandler interface, which can monitor the running of the application globally at all times to see whether a crash occurs.
[0061] Optionally, it is also possible to determine whether the application has crashed by placing a tracking point at a specific location of the application, and the determination of whether the application has crashed also includes: obtaining code data of the application; locating a target location in the code data, and placing a tracking point at the target location; parsing feedback data corresponding to the tracking point, and detecting whether the feedback data contains crash information; when the detection result is that the feedback data contains crash information, determining that the application has crashed; when the detection result is that the feedback data does not contain crash information, determining that the application has not crashed.
[0062] Among them, tracking points is a method of adding monitoring points in the APP, and the running process of the application is monitored by tracking points to obtain feedback data. The target location can be pre-set by the developer according to the places where anomalies may exist in the application development process, or it can be set by big data learning. Optionally, the method for determining the target location of the code data includes: determining the target functional module contained in the application; obtaining other applications whose similarity with the target functional module exceeds a preset similarity threshold range; determining the crash information corresponding to the other applications, and obtaining the crash address and crash frequency of the other applications based on the crash information; selecting the crash address whose crash frequency exceeds the preset frequency threshold as the target location.
[0063] Exemplarily, when the application is a video service application, the target functional modules included in the application include a video service module, a member management module, a recommendation module and a mall module, which are not limited here. The number of the other applications is multiple. If an application includes any one or more of the video service module, the member management module, the recommendation module and the mall module, or the functional modules included in an application have a similarity with any one or more of the above-mentioned video service module, the member management module, the recommendation module and the mall module that exceeds the preset similarity threshold range, then the application is determined to be another application.
[0064] When the application is a medical service application, the target functional modules included in the application include an appointment registration module, an online follow-up consultation module, a report query module, and an outpatient payment module. If an application includes any one or more of the appointment registration module, the online follow-up consultation module, the report query module, and the outpatient payment module, or the functional modules included in an application have a similarity with any one or more of the above-mentioned appointment registration module, the online follow-up consultation module, the report query module, and the outpatient payment module that exceeds the preset similarity threshold range, then the application is determined to be another application.
[0065] The crash information may include information such as the crash address, crash cause, crash time, and crash frequency, and the crash frequency may be determined based on the crash frequency within a period of time. The code logic of the same functional modules is similar and / or identical, and the addresses and causes of the crashes are common. The target location where the current application may crash can be determined by determining the crash address and crash frequency of the same and / or similar functional modules.
[0066] S12: parse the crash log to obtain target information of the crash, where the target information includes a crash address and a crash cause.
[0067] In at least one embodiment of the present application, a crash log refers to log information recorded when an application crashes, which helps to understand the specific cause of the application crash so that the application can be processed accordingly according to the crash cause. The crash log includes information such as the crash address, crash cause, and crash time.
[0068] Optionally, parsing the crash log to obtain target information of the crash includes: obtaining an original crash log, which is an unstructured log; capturing a target field from the original crash log according to a pre-configured regular expression, wherein the regular expression includes the name of the target field; and combining the target field with its name to obtain structured data in the form of key-value pairs.
[0069] Among them, a preset plug-in can be embedded in the application to parse the crash log. The regular expression uses a single string to describe and capture a series of strings that meet a certain feature. The regular expression can be a regular expression customized by the user according to actual conditions. For example, the regular expression is time: \d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d, where time is the name of the target field and 2020-08-03 is the target field. The structured data in the form of key-value pairs generally consists of two parts: a key and a value. The name of the target field can be used as the key, and the captured target field can be used as the value. The two can be combined to obtain the structured data in the form of key-value pairs.
[0070] Exemplarily, the original crash log is:
[0071] 2020-08-03 11:27:10.616 15307-15307 / ? E / CrashHandler:In thread:Thread[main,5,main]
[0072] UncaughtException detected:java.lang.ArithmeticException:divide byzero at com.test.MenuFragment.onViewCreated(MenuFragment.java:85)
[0073] By parsing the above crash log, we can clearly see the divide by zero exception in the log. The exception code is line 85, in the onViewCreated function of the MenuFragment class.
[0074] S13. Calculate the repairability of the crash according to the target information.
[0075] In at least one embodiment of the present application, the degree of repairability is used to reflect whether the crash can be self-repaired. When the degree of repairability is high, the crash can be self-repaired; when the degree of repairability is low, the crash cannot be self-repaired. The present application comprehensively evaluates the degree of repairability of the crash by setting multiple configuration items and calculating the score of each configuration item. In one embodiment, the number of the configuration items is 2, and the configuration items include the crash address and the crash cause.
[0076] Optionally, the calculating the degree of repairability of the crash according to the target information includes: determining a first score for the crash address; determining a second score for the cause of the crash; and calculating the degree of repairability of the crash according to the first score, the second score, and a preset weight. The preset weight is a weight preset by a developer, and the preset weight can be dynamically adjusted according to the comparison result between the actual repair result and the predicted degree of repairability.
[0077] Optionally, determining the first score about the crash address includes: obtaining the crash address of the crash; traversing a mapping relationship between preset addresses and repairability levels to determine a first repairability level corresponding to the crash address; and calculating a first score based on the first repairability level.
[0078] Among them, a target node of the blockchain is established, and the target node stores a mapping relationship between a historical crash address and an actual repairability degree. By traversing the mapping relationship, the first repairability degree of the crash address can be obtained.
[0079] Optionally, determining a second score regarding the cause of the crash includes: obtaining the cause of the crash; traversing a mapping relationship between preset causes and repairability to determine a second repairability corresponding to the cause of the crash; and calculating a second score based on the second repairability.
[0080] The target node also stores a mapping relationship between historical crash causes and actual repairability. By traversing the mapping relationship, the second repairability of the crash cause can be obtained.
[0081] S14, detecting whether the degree of repairability exceeds a preset threshold range of the degree of repairability. When the detection result shows that the degree of repairability exceeds the preset threshold range of the degree of repairability, executing step S15; otherwise, executing step S16.
[0082] In at least one embodiment of the present application, the preset repairability threshold is pre-set, for example, the preset repairability threshold is 80%. When the detection result shows that the repairability exceeds the preset repairability threshold range, it indicates that the crash can be self-repaired; when the detection result shows that the repairability does not exceed the preset repairability threshold range, it indicates that the crash cannot be self-repaired.
[0083] S15. Call a pre-trained crash repair model to self-repair the crash.
[0084] In at least one embodiment of the present application, in the case where the detection result shows that the repairability exceeds a preset repairability threshold range, the crash can be self-repaired by machine learning.
[0085] Optionally, the training method of the crash repair model includes: obtaining historical crash information, and dividing the historical crash information into a training set and a test set; training an initial crash repair model according to the training set to obtain a trained crash repair model; detecting whether the accurate value of the crash repair model meets a preset accurate value threshold range according to the test set, and when the detection result is that the accurate value of the crash repair model meets the preset accurate threshold range, determining that the crash repair model training is completed.
[0086] The historical crash information includes a crash log and a crash repair code, and the crash log includes a crash address and a crash cause. The crash address and the crash cause are used as input data, and the crash repair code is used as output data to train an initial crash repair model. The preset accuracy threshold is a pre-set value, for example, the preset accuracy threshold is 85%.
[0087] Optionally, calling a pre-trained crash repair model to self-repair the crash includes: obtaining the crash address and the crash cause of the crash; inputting the crash address and the crash cause into the crash repair model to obtain a crash repair code; determining a crash repair strategy according to the crash repair code, and self-repairing the crash based on the crash repair strategy.
[0088] Wherein, the crash repair code corresponds to the crash address, and for each crash address, there is a crash repair code corresponding thereto. The crash repair strategy includes one of simple code replacement and overall code replacement, wherein the simple code replacement refers to replacing only the code at the crash location, and the overall code replacement refers to replacing the entire block of code including the crash location. Optionally, determining the crash repair strategy according to the crash repair code includes: determining the location to be repaired of the application according to the crash repair code; calculating the number of the locations to be repaired, and detecting whether the number exceeds a preset number threshold range; when the detection result is that the number exceeds the preset number threshold range, determining that the crash repair strategy is an overall code replacement strategy; when the detection result is that the number does not exceed the preset number threshold range, determining that the crash repair strategy is a simple code replacement strategy. Because the crash repair code corresponds to the crash address, the location to be repaired of the application can also be determined according to the crash address. The preset number threshold is a preset value.
[0089] In at least one embodiment of the present application, after calling a pre-trained crash repair model to self-repair the crash, the method further includes: obtaining a repair result of the corresponding crash repair code; and adjusting the crash repair model according to the repair result.
[0090] The repair result includes the current crash repair success and the current crash repair failure. The repair results of the corresponding crash repair code are collected at a certain time interval, and the crash repair model is adjusted based on the repair result, so that the crash repair model can correctly handle more crashes. When the repair result is that the current crash repair fails, the reason for the crash repair failure can be obtained and uploaded to the server, and the developer repairs the current crash to determine the updated crash repair code. The crash address, crash cause and updated crash repair code are used as a training set to retrain the crash repair model.
[0091] In at least one embodiment of the present application, the method further includes: detecting whether the crash completes self-repair within a preset time interval; when the detection result is that the crash does not complete self-repair within the preset time interval, outputting the crash. In one embodiment, the preset time interval is pre-set by the developer. In another embodiment, the preset time interval can be dynamically set according to the degree of repairability of the crash. The higher the degree of repairability, the lower the current self-repair difficulty, and the preset time interval is set to be smaller; the lower the degree of repairability, the higher the current self-repair difficulty, and the preset time interval is set to be higher. By setting the preset time interval to dynamically adjust with the degree of repairability, it is possible to avoid waiting for a long time to determine whether the crash has completed self-repair when a low-level error occurs, which can reduce the waiting time and thereby improve the repair efficiency of the application.
[0092] For example, taking the Android system as an example, generally speaking, the Android system will add exception capture in the UncaughtExceptionHandler. At this time, the default exception handling mechanism of the system that kills the application by default will be replaced by the custom action set by the developer. It is understandable that the core of preventing the application from crashing is that the main process cannot crash. Referring to the Android source code ActivityThread.java, the real entry function of the Android program is in the main method. This function is not long, and the core is Looper.loop(). Once this method exits abnormally, it will directly lead to the throw newRuntimeException() method, and the system exits. Therefore, the core of crash handling is that the Looper.loop() method cannot exit directly when there are some basic errors. Entering the function, it can be clearly seen that the execution of the Android message mechanism is essentially a dead loop of for(;;){} to capture data from the message queue. Therefore, it can be considered to perform try{}catch() exception capture inside the for loop. If a message in the queue crashes, the exception will be caught directly in the catch. At this time, the crash data can be analyzed through the crash log to obtain the crash cause and crash address. When the degree of repairability of the crash reaches the preset threshold range of the degree of repairability, the crash repair code is determined to perform self-repair, and then the crash repair code is reinserted into the top level of the message queue, so that the for infinite loop re-retrieves the message, and the application will self-repair without the user's perception.
[0093] S16: Determine and close the target stack entry that matches the crash.
[0094] In at least one embodiment of the present application, for the case where the detection result is that the degree of repairability does not exceed the preset threshold range of the degree of repairability, the abnormal exit of the application can be avoided by hiding the crash. The page conversion of the application is implemented in a stack manner. For example, the A page of the application corresponds to the A stack, and the B page corresponds to the B stack. Jumping from the A page of the application to the B page is to enter the B stack entrance from the A stack entrance. When the B page of the application crashes, the B stack entrance corresponding to the B page is determined and closed, so that the relevant functional modules of the B page are invisible to the user, which can avoid the abnormal exit of the application caused by the user's operation on the B page, so that the application will not exit abnormally due to the crash of the B page.
[0095] Optionally, determining and closing a target stack entry that matches the crash includes: acquiring a crash address; determining a target stack entry of an application program according to the crash address; and closing the target stack entry.
[0096] For example, whether Kotlin or Java is used in the Android system, it will essentially be parsed as Java-like processing, but Android will use extension packages such as C or C++ through jni. Therefore, crashes in Android are generally classified as Java layer crashes and jni layer crashes. Java layer crashes can handle most problems in the above-mentioned self-repair, but jni layer crashes will be fatal and unsolvable. Therefore, if jni type crashes appear in log analysis, self-repair can be performed by ignoring jni code and not executing related methods. For unhandled exceptions, it is better to not execute than to crash; or the stack entry corresponding to the crash can be hidden to make the crashed functional module invisible to the user.
[0097] In at least one embodiment of the present application, before determining and closing the target stack entry that matches the crash, the method also includes: detecting whether there is a target backup package associated with the crash; when the detection result is that there is a target backup package associated with the crash, calling the target backup package, and self-repairing the crash according to the target backup package; judging whether the crash is self-repaired successfully; when the judgment result is that the crash self-repair is successful, the crash repair is completed; when the judgment result is that the crash self-repair fails, determining and closing the target stack entry that matches the crash.
[0098] Among them, the backup package refers to another set of replacement codes set up by the developer during the application development process because the developer believes that there may be an exception in a certain code. For the current crash, the number of the backup packages may be one or more, which is not limited here. When the detection result is that there is no target backup package associated with the crash, determine and close the target stack entry that matches the crash.
[0099] The above-mentioned crash handling method provided in the embodiment of the present application calculates the repairability of the crash based on the crash log, and determines the optimal crash handling method for different repairability levels, which can improve the repair efficiency of the application; and the present application completes self-repair of crashes with high repairability through machine learning, avoiding the problem of high repair costs caused by manual resolution of crashes, and can avoid frequent version upgrades through self-repair, thereby improving the compatibility of the application; in addition, the present application hides the crash page by closing the stack entry of the crash that cannot be self-repaired, making the crash page invisible to the user, avoiding the problem of abnormal exit of the application caused by the user's operation on the crash page, which is conducive to promoting the development of smart healthcare and the construction of smart cities.
[0100] The above is a detailed description of the method provided by the embodiment of the present invention. According to different requirements, the execution order of the blocks in the flowchart can be changed, and some blocks can be omitted. The computer device 1 provided by the embodiment of the present invention is described below.
[0101] Figure 2 Schematic diagram of the structure of a computer device according to an embodiment of the present invention. Figure 2 As shown, the computer device 1 includes a memory 10, in which the crash processing device 300 is stored. The computer device 1 can be an electronic device such as a computer, a tablet computer, a personal digital assistant, etc., which has functions such as data processing, analysis, program execution and display. The crash processing device 300 can start an application, and when the application crashes, obtain a crash log corresponding to the crash; parse the crash log to obtain the target information of the crash, and the target information includes the crash address and the crash cause; calculate the repairability of the crash according to the target information; detect whether the repairability exceeds the preset repairability threshold range; when the detection result is that the repairability exceeds the preset repairability threshold range, call a pre-trained crash repair model to self-repair the crash; when the detection result is that the repairability does not exceed the preset repairability threshold range, determine and close the target stack entry matching the crash. Through this application, the best crash handling method can be determined for different repairability levels, which can improve the repair efficiency of the application, and is conducive to promoting the development of smart medical care and the construction of smart cities.
[0102] In this embodiment, the computer device 1 may further include a display screen 20 and a processor 30. The memory 10 and the display screen 20 may be electrically connected to the processor 30 respectively.
[0103] The memory 10 can be different types of storage devices for storing various types of data. For example, it can be the memory or internal memory of the computer device 1, or it can be a storage card that can be externally connected to the computer device 1, such as a flash memory, a SM card (SmartMedia Card), an SD card (Secure Digital Card), etc. In addition, the memory 10 can include non-volatile memory and volatile memory, such as a hard disk, internal memory, a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other storage devices. The memory 10 is used to store various types of data, for example, various types of applications installed in the computer device 1, data set and obtained by applying the above-mentioned crash handling method, and other information.
[0104] The display screen 20 is installed on the computer device 1 and is used to display information.
[0105] The processor 30 is used to execute the crash handling method and various software installed in the computer device 1, such as an operating system and application display software. The processor 30 includes but is not limited to a processor (Central Processing Unit, CPU), a microcontroller unit (Micro Controller Unit, MCU) and other devices used to interpret computer instructions and process data in computer software.
[0106] The crash handling device 300 may include one or more modules, which are stored in the memory 10 of the computer device 1 and configured to be executed by one or more processors (a processor 30 in this embodiment) to implement the embodiment of the present invention. Figure 3 As shown, the crash processing device 300 may include a log acquisition module 301, a log analysis module 302, a degree calculation module 303, a range detection module 304, a crash repair module 305, and an entry closing module 306. The module referred to in the embodiment of the present invention may be a program segment that completes a specific function, which is more suitable for describing the execution process of the software in the processor 30 than a program.
[0107] It can be understood that, corresponding to each implementation of the above crash processing method, the crash processing device 300 may include: Figure 3 Part or all of the functional modules shown in the figure, the functions of each module will be specifically introduced below. It should be noted that the same nouns and related nouns and their specific explanations in each implementation of the above crash handling method can also be applied to the following functional introduction of each module. In order to save space and avoid repetition, they will not be repeated here.
[0108] The log acquisition module 301 can be used to start an application program and, when the application program crashes, acquire a crash log corresponding to the crash.
[0109] The log parsing module 302 may be used to parse the crash log to obtain target information of the crash, where the target information includes a crash address and a crash cause.
[0110] The degree calculation module 303 may be used to calculate the repairability degree of the crash according to the target information.
[0111] The range detection module 304 may be configured to detect whether the repairability exceeds a preset repairability threshold range.
[0112] The crash repair module 306 may be configured to call a pre-trained crash repair model to self-repair the crash when the detection result indicates that the repairability exceeds a preset repairability threshold range.
[0113] The entry closing module 306 may be configured to determine and close a target stack entry matching the crash when the detection result indicates that the repairability level does not exceed a preset repairability level threshold range.
[0114] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by the processor 30, the steps of the crash handling method in any of the above-mentioned embodiments are implemented.
[0115] If the crash processing device 300 / computer device 1 / module / unit integrated in the computer device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned implementation method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor 30, the steps of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable storage medium may include: any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory, etc.
[0116] The processor 30 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor 30 is the control center of the crash processing device 300 / computer device 1, and uses various interfaces and lines to connect various parts of the entire crash processing device 300 / computer device 1.
[0117] The memory 10 is used to store the computer program and / or module, and the processor 30 implements various functions of the crash processing device 300 / computer device 1 by running or executing the computer program and / or module stored in the memory 10, and calling the data stored in the memory 10. The memory 10 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device 1, etc.
[0118] In the several specific embodiments provided by the present invention, it should be understood that the disclosed computer device and method can be implemented in other ways. For example, the system implementation described above is only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0119] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0120] It is obvious to those skilled in the art that the embodiments of the present invention are not limited to the details of the exemplary embodiments described above, and that the embodiments of the present invention can be implemented in other specific forms without departing from the spirit or essential features of the embodiments of the present invention. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the embodiments of the present invention is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the embodiments of the present invention. Any figure mark in a claim should not be regarded as limiting the claim involved. Multiple units, modules or devices stated in a system, device or computer equipment claim may also be implemented by the same unit, module or device through software or hardware.
[0121] The above implementation modes are only used to illustrate the technical solutions of the embodiments of the present invention and are not intended to limit the present invention. Although the embodiments of the present invention are described in detail with reference to the above preferred implementation modes, those skilled in the art should understand that the technical solutions of the embodiments of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A crash handling method, characterized in that: The crash handling method comprises: Starting an application, and when the application crashes, obtaining a crash log corresponding to the crash; Parsing the crash log to obtain target information of the crash, the target information including the crash address and the crash cause; Calculating the degree of repairability of the crash according to the target information includes: determining a first score regarding the crash address; determining a second score regarding the cause of the crash; and calculating the degree of repairability of the crash according to the first score, the second score, and a preset weight; Detecting whether the degree of repairability exceeds a preset threshold range of the degree of repairability; When the detection result shows that the repairability exceeds a preset repairability threshold range, calling a pre-trained crash repair model to self-repair the crash; When the detection result is that the repairability does not exceed a preset repairability threshold range, a target stack entry matching the crash is determined and closed, so that a page of the application corresponding to the target stack entry is invisible to the user.
2. The crash handling method according to claim 1, characterized in that: Determining whether the application crashes includes: After the application is started, registering a crash signal processing interface; Determining whether the crash signal processing interface intercepts a crash signal; When the judgment result is that the crash signal processing interface intercepts the crash signal, it is determined that the application crashes; When the judgment result is that the crash signal processing interface does not intercept the crash signal, it is determined that the application program does not crash.
3. The crash handling method according to claim 1, characterized in that: Determining whether the application crashes further includes: Get the code data of the application; Locating a target position in the code data, and performing point embedding at the target position; Parsing feedback data corresponding to the tracking point, and detecting whether the feedback data contains crash information; When the detection result is that the feedback data includes crash information, determining that the application crashes; When the detection result is that the feedback data does not include crash information, it is determined that the application program has not crashed.
4. The crash handling method according to claim 1, characterized in that: The determining a first score for the crash address comprises: Obtaining a crash address of the crash; Traversing the preset mapping relationship between addresses and repairability levels to determine a first repairability level corresponding to the crash address; A first score is calculated according to the first repairability level.
5. The crash handling method according to claim 1, characterized in that: The calling of a pre-trained crash repair model to self-repair the crash comprises: Obtaining the crash address and crash cause of the crash; Inputting the crash address and the crash cause into the crash repair model to obtain a crash repair code; A crash repair strategy is determined according to the crash repair code, and the crash is self-repaired based on the crash repair strategy.
6. The crash handling method according to claim 1, characterized in that: Determining and closing a target stack entry matching the crash comprises: Get the crash address; Determine a target stack entry of the application program according to the crash address; Close the target stack entry.
7. A crash handling device, characterized in that: The crash processing device comprises: A log acquisition module, used to start an application and, when the application crashes, acquire a crash log corresponding to the crash; A log parsing module, used to parse the crash log to obtain target information of the crash, wherein the target information includes a crash address and a crash cause; a degree calculation module, configured to calculate the degree of repairability of the crash according to the target information, comprising: determining a first score regarding the crash address; determining a second score regarding the crash cause; and calculating the degree of repairability of the crash according to the first score, the second score, and a preset weight; A range detection module, used to detect whether the repairability exceeds a preset repairability threshold range; A crash repair module, used to call a pre-trained crash repair model to self-repair the crash when the detection result shows that the repairability exceeds a preset repairability threshold range; The entry closing module is used to determine and close the target stack entry matching the crash when the detection result shows that the repairability does not exceed a preset repairability threshold range, so that the page of the application corresponding to the target stack entry is invisible to the user.
8. A computer device, characterized in that: The computer device comprises a processor, and the processor is used to implement the crash handling method according to any one of claims 1 to 6 when executing a computer program stored in a memory.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the crash handling method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Application crash processing method and device
CN111552586A
Application crash processing method, device and system
CN111708655A