Application program repairing method and system, computer equipment and storage medium
Through automated crash log analysis and patch generation, the problem of inefficient repair when application crashes is solved, a fast and automatic repair process is achieved, and the application stability and user experience is improved.
Patent Information
- Application Number
- CN202510357389.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-25
- Publication Date
- 2025-08-15
AI Technical Summary
In the prior art, when an application crashes, manual repair efficiency is inefficient and cannot be quickly completed in a short time for the user.
By obtaining the crash log and crash rate of the target application, using the log analysis model and patch code generation model, automatically analyze and generate crash repair code and patches, and achieve automatic repair.
Improves the efficiency of application crash repair, reduces manual intervention time, and improves user experience.
Smart Images

Figure CN120491936A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of terminal application programs, and in particular to an application program repair method, system, computer equipment, and storage medium. Background Art
[0002] With the continuous development of science and technology, terminal devices, such as mobile phones and tablets, have become an integral part of people's lives. A large number of applications are usually installed in terminal devices. When a user clicks an application or jumps to a page in an application, the page output by the application may crash. For example, a large amount of garbled characters may appear on the page output by the application, or the page output by the application may be a blank page (white screen). Crashed applications need to be repaired in a timely manner to ensure the execution of the corresponding functions of the application and avoid a bad user experience.
[0003] Currently, repairing application crashes typically requires technicians to obtain the application's crash logs, analyze the crash logs to determine the cause of the crash, and then develop a patch package based on the cause. This patch package is then deployed to the management backend, allowing users to download the patch package upon re-accessing the application, thus repairing the application. However, when an application crashes, users often reopen the application in a very short period of time, leaving technicians with insufficient time to develop a patch package. Consequently, manual application repairs are inefficient. Summary of the Invention
[0004] The embodiments of the present invention provide an application repair method, system, computer device and storage medium to solve the problem of low repair efficiency when repairing an application manually.
[0005] A method for repairing an application, the method comprising: Obtaining a first crash log and a first crash rate of a target application, and storing the first crash log in a preset log database; When the first crash rate is greater than a preset first crash threshold, extracting the first crash log from the log database and analyzing the first crash log to obtain a log analysis result; the log analysis result includes at least application information of the target application, a crash cause, and a crash code; Inputting the log analysis results into a patch code generation model to obtain crash repair code for the target application; A crash repair patch is generated based on the crash repair code, and the target application is repaired based on the crash repair patch.
[0006] In the above application repair method, optionally, the first crash rate is calculated as follows: Record the number of times the target application is opened and the number of times the target application crashes by tracking points; The first crash rate is calculated based on the number of opens and the number of crashes.
[0007] In the above application repair method, optionally, analyzing the first crash log to obtain a log analysis result includes: Cleaning redundant data from the first crash log to remove invalid data from the first crash log and obtaining log content to be analyzed; The log content to be analyzed is input into a log analysis model to obtain the log analysis result.
[0008] Optionally, the above-mentioned application repair method, generating a crash repair patch based on the crash repair code, includes: The crash repair code is submitted to a code repository to generate a crash repair patch corresponding to the crash repair code and a patch link corresponding to the crash repair patch in the code repository. The patch link is deployed to the backend of the target application so that when the target application is opened again, the crash repair patch is downloaded from the code repository according to the patch link to repair the target application.
[0009] Optionally, the above-mentioned application repair method, repairing the target application based on the crash repair patch, includes: Determining a first number of test applications from the target application, and distributing the crash repair patch to the test applications to repair the test applications; Obtaining a second crash log and a second crash rate of the test application, and storing the second crash log in the log database; When the second crash rate is less than the second crash threshold, distributing the crash repair patch to all the target applications to repair the target applications; When the second crash rate is greater than the second crash threshold, new crash repair code is generated based on the second crash log, and execution returns to the step of loading the crash repair patch to repair the test application when the test application is opened, until the first crash rate is less than or equal to the second crash threshold, and the crash repair patch is distributed to all the target applications to repair the target applications.
[0010] An application repair system, comprising: a crash monitoring system and a patch generation system; wherein: The crash monitoring system obtains a first crash log and a first crash rate of a target application, and stores the first crash log in a preset log database; when the first crash rate is greater than a preset first crash threshold, sends an application repair instruction to the patch generation system; The patch generation system, in response to the application repair instruction, extracts the first crash log from the log database, and analyzes the first crash log to obtain a log analysis result; the log analysis result includes at least application information of the target application, the crash cause, and the crash code; the log analysis result is input into a patch code generation model to obtain a crash repair code for the target application; a crash repair patch is generated based on the crash repair code, and the target application is repaired based on the crash repair patch.
[0011] The above application repair system, optionally, The crash monitoring system records the number of times a target application is opened and the number of times the target application crashes by tracking points; and calculates the first crash rate based on the number of times the target application is opened and the number of times the target application crashes.
[0012] The above-mentioned application repair system, optionally, the patch generation system cleans up redundant data in the first crash log to eliminate invalid data in the first crash log to obtain log content to be analyzed; and inputs the log content to be analyzed into a log analysis model to obtain the log analysis result.
[0013] A computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any one of the above-mentioned application repair methods when executing the computer program.
[0014] A computer-readable storage medium stores a computer program, wherein the computer program implements any of the above-mentioned application repair methods when executed by a processor.
[0015] The above-mentioned application repair method, system, computer device, and storage medium extract a first crash log from a log database when the first crash rate of the target application is greater than a preset first crash threshold, analyze the first crash log, obtain a log analysis result, input the log analysis result into a patch code generation model, obtain crash repair code for the target application, generate a crash repair patch based on the crash repair code, and repair the target application based on the crash repair patch. It can be seen that the present invention uses a patch code generation model to generate crash repair code based on the log analysis results, and generates a crash repair patch based on the crash repair code to complete the repair of the target application. Compared with manually repairing application crash problems, it can achieve the purpose of improving application repair efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0017] Figure 1 This is a flowchart of an implementation method of an application repair method according to an embodiment of the present invention; Figure 2 This is a partial implementation flow chart of an application repair method according to an embodiment of the present invention; Figure 3 This is a partial implementation flow chart of an application repair method according to an embodiment of the present invention; Figure 4 This is a partial implementation flow chart of an application repair method according to an embodiment of the present invention; Figure 5 is a schematic diagram of the structure of an application repair system in one embodiment of the present invention; Figure 6 It is a structural diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0018] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0019] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.
[0020] It will also be understood that the term "and / or" used in the present description and appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0021] As used in the present specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0022] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0023] References to "one embodiment" or "some embodiments" in the present specification mean that a particular feature, structure, or characteristic described in connection with that embodiment is included in one or more embodiments of the present invention. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in yet other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically stated. The terms "including," "comprising," "having," and variations thereof mean "including but not limited to," unless otherwise specifically stated.
[0024] The present invention discloses an application repair method, system, computer device and storage medium. When the first crash rate of the target application is greater than a preset first crash threshold, a first crash log is extracted from a log database, and the first crash log is analyzed to obtain a log analysis result. The log analysis result is input into a patch code generation model to obtain a crash repair code for the target application, a crash repair patch is generated based on the crash repair code, and the target application is repaired based on the crash repair patch. It can be seen that the present invention generates a crash repair code based on the log analysis result through a patch code generation model, and generates a crash repair patch based on the crash repair code to complete the repair of the target application. Compared with repairing application crash problems manually, the purpose of improving the efficiency of application repair can be achieved. This will be explained below through specific embodiments.
[0025] like Figure 1 FIG. 1 is a flowchart of an implementation method for repairing an application program disclosed in an embodiment of the present invention. This method is applicable to terminal devices with application programs installed, such as mobile phones, tablet computers, and other devices. The method in this embodiment specifically includes the following steps: S101: Obtain a first crash log and a first crash rate of a target application, and store the first crash log in a preset log database.
[0026] The first crash rate indicates the probability of the target application crashing during use. A higher first crash rate indicates a higher number of page crashes during use, meaning the target application is less stable. A lower first crash rate indicates a lower number of page crashes during use, meaning the target application is more stable. The first crash log refers to the log generated when the target application crashes. The first crash log can reflect the time the target application crashed, the page that crashed, the cause of the crash, and more. The first crash log can be obtained in a variety of ways, as shown below: First, in this embodiment, the first crash log can be automatically generated by the operating system of the electronic device where the target application is installed (such as the Android system, iOS system, or HarmonyOS system, etc.). These first crash logs will be stored in a specific location in the electronic device and can be obtained through developer tools or adb commands.
[0027] Secondly, in this embodiment, a log collection tool can also be integrated into the target application, such as integrating third-party tools such as PLCrashReporter and KSCrash to collect the first crash log, and the first crash log can be captured by the log collection tool when the target application crashes.
[0028] Thirdly, in this embodiment, a dedicated log system can also be deployed in the target application to record the running status and error information of the target application. When the target application crashes, the log system will generate a corresponding first crash log.
[0029] It should be noted that the above are only some of the methods for obtaining the first crash log in this embodiment. In this embodiment, the first crash log can also be obtained by other methods. This embodiment does not limit the specific method for obtaining the first crash log.
[0030] S102: When the first crash rate is greater than a preset first crash threshold, extract a first crash log from a log database, and analyze the first crash log to obtain a log analysis result.
[0031] Among them, the log analysis results include at least the application information, crash cause and crash code of the target application. The log database can be a database specifically for storing logs. The log database can not only contain the first crash log, but also the normal log of the target application. To facilitate the acquisition of the first crash log, the first crash log can be stored separately from the daily log.
[0032] It should be understood that when the first crash rate is greater than the preset first crash threshold, the first crash log is extracted from the log database, and the first crash log is analyzed to obtain a log analysis result including the cause of the target application crash; when the first crash rate is less than or equal to the preset first crash threshold, the first crash rate is continuously calculated until the first crash rate is greater than the preset first crash threshold, the first crash log is extracted from the log database, and the first crash log is analyzed to obtain a log analysis result.
[0033] In a specific implementation, in this embodiment, the first crash log can be analyzed using a log analysis tool to obtain a log analysis result including the cause of the target application crash. Log analysis tools include, but are not limited to, SolarWinds Log & Event Manager, Splunk, XpoLog, etc., and this embodiment does not limit the specific type of log analysis tool. In addition, in this embodiment, the first crash log can also be classified, clustered, or predicted using a pre-trained log analysis model to ultimately obtain a log analysis result. This embodiment does not specifically limit the method for implementing the first crash log analysis.
[0034] S103: Input the log analysis result into the patch code generation model to obtain the crash repair code of the target application.
[0035] In a specific implementation, the patch code generation model in this embodiment includes but is not limited to the GitHub Copilot model, the CodeBERT model, the Codex model, and any one model or a neural network model composed of multiple models in GPT-4. After the log analysis results are input into the patch code generation model, the patch code generation model can modify the original code of the target application based on the log analysis results to obtain the crash repair code of the target application. Among them, the patch code generation model can be trained based on historical crash data and repair data. After the log analysis results are input into the patch code generation model, the patch code generation model modifies the original code of the target application according to the log analysis results to obtain the crash repair code of the target application. In other words, the log analysis results represent the cause of the crash of the original code of the target application. By modifying the original code of the target application according to the log analysis results, the crash repair code can be obtained. Among them, the original code of the target application can be the entire source code of the target application, or it can be the partial source code of the target application where the crash occurs, which is not limited in this embodiment.
[0036] S104: Generate a crash repair patch based on the crash repair code, and repair the target application based on the crash repair patch.
[0037] The crash repair patch may be a hot patch, or the crash repair patch may be a cold patch.
[0038] In a specific implementation, in this embodiment, the crash repair code can be submitted to the code repository to generate a crash repair patch corresponding to the crash repair code in the code repository, and then when the target application is opened again, the crash repair patch is downloaded from the code repository to repair the target application according to the downloaded code repair patch.
[0039] In summary, the present embodiment discloses an application repair method, which extracts a first crash log from a log database when the first crash rate of the target application is greater than a preset first crash threshold, analyzes the first crash log, obtains a log analysis result, inputs the log analysis result into a patch code generation model, obtains a crash repair code for the target application, generates a crash repair patch based on the crash repair code, and repairs the target application based on the crash repair patch. It can be seen that the present invention generates crash repair code based on the log analysis result through the patch code generation model, and generates a crash repair patch based on the crash repair code to complete the repair of the target application. Compared with repairing application crash problems through manual methods, it can achieve the purpose of improving the efficiency of application repair.
[0040] based on Figure 1 In the specific implementation, the first crash rate in this embodiment can be calculated by the following steps: Figure 2As shown: S201: Record the number of times a target application is opened and the number of times the target application crashes by tracking points.
[0041] The target applications include all target applications installed by the client. When any one or more target applications are opened, the opening count is updated. In other words, the opening counts of all target applications installed by the client are accumulated to obtain the total opening count. When any target application is opened by a user, the opening count of the target application is recorded and accumulated. For example, when a user opens the target application for the first time, the opening count is recorded as 1. When the user opens the target application for the second time, the opening count is recorded as 2. And so on, the opening counts of the target application are accumulated.
[0042] Similarly, when any one or more target applications crash, the crash count is updated once. That is, the number of crashes of target applications installed by all clients will be accumulated to obtain the total number of openings. When any target application crashes, the number of crashes of the target application will be recorded, and the number of crashes will be accumulated to obtain the number of crashes.
[0043] In a specific implementation, in this embodiment, the number of times the target application is opened can be recorded during the startup process of the target application, and the number of times the target application crashes when the target application handles the crash process can be recorded. In this way, the number of times the target application is opened and the number of times the target application crashes can be recorded through tracking.
[0044] S202: Calculate a first crash rate of the target application based on the number of opens and the number of crashes.
[0045] The first crash rate of the target application is calculated each time the number of opens and / or the number of crashes is recorded. That is to say, when the calculated first crash rate is not greater than the first crash threshold, the number of opens and crashes of the target application is continuously accumulated and recorded, and the first crash rate of the target application is calculated. When the first crash rate of the target application is greater than the first crash threshold, the target application is repaired once, and then the number of opens and crashes of the target application is recorded again. When the first crash rate of the target application is greater than the first crash threshold again, the target application is repaired again, and so on.
[0046] To sum up, in this embodiment, the first crash rate of the target application is calculated so that the target application is repaired only when the first crash rate of the target application exceeds the first crash threshold. While reducing the repair frequency of the target application, it can also avoid the triggering of the target application's repair mechanism due to crash problems caused by external reasons such as network reasons and equipment reasons, which is conducive to improving the rationality and effectiveness of the target application repair.
[0047] based on Figure 1 In the specific implementation, step S102 in this embodiment can be implemented by the following steps: Figure 3 As shown: S301: Redundant data is cleaned up on the first crash log to remove invalid data in the first crash log, and log content to be analyzed is obtained.
[0048] The redundant data cleaning refers to invalid data in the first crash log, including but not limited to fields corresponding to advertisements and blank lines.
[0049] In a specific implementation, in this embodiment, invalid fields in the crash can be first determined, such as fields corresponding to advertisements, blank fields, etc., and then the invalid fields determined in the first crash log are removed. The remaining first crash log is the log content to be analyzed.
[0050] S302: Input the log content to be analyzed into the log analysis model to obtain the log analysis result.
[0051] After the log content to be analyzed is input into the log analysis model, the log analysis model analyzes the log content to be analyzed and finally outputs the corresponding log analysis results.
[0052] In a specific implementation, the log analysis model in this embodiment includes but is not limited to any one or more models based on the natural language processing model (NLP), recurrent neural network (RNN), long short-term memory network (LSTM), and GPT-4 model.
[0053] In summary, the log analysis model obtained through training in this embodiment analyzes the log content to be analyzed, avoiding the complex manual operations when manually analyzing the log content to be analyzed, which can effectively improve the efficiency of log analysis and thus improve the efficiency of repairing the target application.
[0054] based on Figure 1 In the specific implementation, step S104 in this embodiment can be implemented as follows: Submit the crash repair code to the code repository to generate a crash repair patch corresponding to the crash repair code and a patch link corresponding to the crash repair patch in the code repository. The patch link is deployed to the backend of the target application so that when the target application is opened again, the crash repair patch is downloaded from the code repository according to the patch link to repair the target application.
[0055] Among them, code repositories include but are not limited to code repositories established based on code repository platforms such as Gitee, GitHub and Coding.
[0056] In a specific implementation, in this embodiment, a patch generation command, such as the git format-patch command, can be used to generate a crash repair patch corresponding to the crash repair code, and a patch link corresponding to the crash repair patch can be generated to facilitate subsequent steps of application repair.
[0057] The backend of the target application refers to the programs and services running on the background server of the target application. Although the backend of the target application does not interact directly with the user like the frontend, it is a key part to realize the functions and performance of the target application.
[0058] In a specific implementation, when the target application in this embodiment is opened, the corresponding crash repair patch can be downloaded from the code repository through the patch link deployed by the target application backend. The crash repair patch is usually a file with the suffix "patch". The patch link points to the crash repair patch to download the crash repair patch from the code repository.
[0059] In summary, in this embodiment, a target application is repaired by deploying a hot patch, without releasing a version to repair the target application. This improves the efficiency of repairing the target application and also improves the user experience.
[0060] based on Figure 1 In the specific implementation, step S103 can be implemented by the following steps: Figure 4 As shown: S401: Determine a first number of test applications from target applications, and distribute crash repair patches to the test applications to repair the test applications.
[0061] It can be understood that the target applications include all target applications installed on different clients, and the first number of test applications are target applications installed on some clients. That is, the first number of target applications are screened out from all target applications as test applications, and the crash repair patches are distributed to the test applications to repair the test applications.
[0062] S402: Obtain a second crash log and a second crash rate of a preset test application, and store the second crash log in a log database.
[0063] S403: When the second crash rate is less than the second crash threshold, distribute the crash repair patch to all target applications to repair the target applications.
[0064] S404: When the second crash rate is greater than the second crash threshold, generate new crash repair code based on the second crash log, and return to the step of loading the crash repair patch to repair the test application when the test application is opened, until the first crash rate is less than or equal to the second crash threshold, distribute the crash repair patch to all target applications to repair the target applications.
[0065] In a specific implementation, in this embodiment, the second crash log and the second crash rate of the test application within a certain period of time (such as 24 hours, 48 hours, etc.) after the repair can be obtained, and the second crash log obtained during this period can be stored in the log database.
[0066] When the second crash rate is less than the second crash threshold, it means that the test application has been repaired and the crash repair patch can be distributed to all target applications to repair all target applications. At this point, the repair of the target applications is completed and the process ends. When the second crash rate is greater than the second crash threshold, it means that the crash problem of the test application has not been solved. A second crash log is extracted from the log database, and the second crash log is analyzed to obtain a log analysis result. The log analysis result is then input into a patch code generation model to obtain a new crash repair code. Based on the new crash code, the step of determining a first number of test applications from the target application and distributing the crash repair patch to the test application to repair the test application is returned, that is, step S401 and subsequent steps are executed, and so on, until the second crash rate is less than the second crash threshold, and the crash repair patch is distributed to all target applications to repair the target application.
[0067] In summary, this embodiment selects a first number of target applications from all target applications as test applications to perform code testing on crash repair patches based on the test applications, eliminating the need to prepare a test environment and test cases, thereby effectively improving the repair efficiency of the application.
[0068] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0069] In one embodiment, an application repair system is provided, which corresponds one-to-one to the application repair method in the above embodiment. Figure 5As shown in Figure 1, the application repair system includes a crash monitoring system and a patch generation system. The functional modules are described in detail as follows: The crash monitoring system 100 obtains a first crash log and a first crash rate of a target application, and stores the first crash log in a preset log database; when the first crash rate is greater than a preset first crash threshold, sends an application repair instruction to a patch generation system; The patch generation system 200 responds to the application repair instruction, extracts the first crash log from the log database, and analyzes the first crash log to obtain a log analysis result; the log analysis result includes at least application information of the target application, the crash cause, and the crash code; the log analysis result is input into a patch code generation model to obtain a crash repair code for the target application; a crash repair patch is generated based on the crash repair code, and the target application is repaired based on the crash repair patch.
[0070] The present invention discloses an application repair system. When a first crash rate of a target application is greater than a preset first crash threshold, the system extracts a first crash log from a log database, analyzes the first crash log, obtains a log analysis result, inputs the log analysis result into a patch code generation model, obtains crash repair code for the target application, generates a crash repair patch based on the crash repair code, and repairs the target application based on the crash repair patch. It can be seen that the present invention generates crash repair code based on the log analysis result using a patch code generation model, and generates a crash repair patch based on the crash repair code to complete the repair of the target application. Compared with manually repairing application crash problems, the system can achieve the purpose of improving application repair efficiency.
[0071] In one embodiment, the crash monitoring system 100 records the number of times a target application is opened and the number of times the target application crashes by tracking points; and calculates the first crash rate based on the number of times the target application is opened and the number of times the target application crashes.
[0072] In one embodiment, the patch generation system 200 cleans up redundant data on the first crash log to remove invalid data in the first crash log to obtain log content to be analyzed; and inputs the log content to be analyzed into a log analysis model to obtain the log analysis result.
[0073] In one embodiment, the patch generation system 200 submits the crash repair code to a code repository to generate a crash repair patch corresponding to the crash repair code and a patch link corresponding to the crash repair patch in the code repository. The patch link is deployed to the backend of the target application so that when the target application is opened again, the crash repair patch is downloaded from the code repository according to the patch link to repair the target application.
[0074] In one embodiment, the patch generation system 200 determines a first number of test applications from the target application, and distributes the crash repair patch to the test applications to repair the test applications; Obtaining a second crash log and a second crash rate of the test application, and storing the second crash log in the log database; When the second crash rate is less than the second crash threshold, distributing the crash repair patch to all the target applications to repair the target applications; When the second crash rate is greater than the second crash threshold, new crash repair code is generated based on the second crash log, and execution returns to the step of loading the crash repair patch to repair the test application when the test application is opened, until the first crash rate is less than or equal to the second crash threshold, and the crash repair patch is distributed to all the target applications to repair the target applications.
[0075] The specific definition of the application repair system can be found in the definition of the application repair method above and will not be repeated here. Each module in the aforementioned application repair system may be implemented in whole or in part through software, hardware, or a combination thereof. Each of the aforementioned modules may be embedded in or independent of a processor in a computer device in hardware form, or may be stored in a memory in the computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0076] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, memory, network interface, and database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, it implements an application repair method.
[0077] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following is achieved: Obtaining a first crash log and a first crash rate of a target application, and storing the first crash log in a preset log database; When the first crash rate is greater than a preset first crash threshold, extracting a first crash log from a log database, and analyzing the first crash log to obtain a log analysis result including a crash cause of the target application; Input the log analysis results into the patch code generation model to obtain the crash repair code of the target application; A crash repair patch is generated based on the crash repair code, so that when the target application is opened again, the crash repair patch is loaded to repair the target application.
[0078] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the application program repair method in the above embodiment is implemented.
[0079] In one embodiment, a computer-readable storage medium is provided. When a computer program stored in the computer-readable storage medium is executed by a processor, the computer program implements: Obtaining a first crash log and a first crash rate of a target application, and storing the first crash log in a preset log database; When the first crash rate is greater than a preset first crash threshold, extracting a first crash log from a log database, and analyzing the first crash log to obtain a log analysis result including a crash cause of the target application; Input the log analysis results into the patch code generation model to obtain the crash repair code of the target application; A crash repair patch is generated based on the crash repair code, so that when the target application is opened again, the crash repair patch is loaded to repair the target application.
[0080] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0081] Those skilled in the art will clearly understand that for the sake of convenience and brevity in description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the system can be divided into different functional units or modules to complete all or part of the functions described above.
[0082] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.
Claims
1. An application repair method, characterized in that: The method comprises: Obtaining a first crash log and a first crash rate of a target application, and storing the first crash log in a preset log database; When the first crash rate is greater than a preset first crash threshold, extracting the first crash log from the log database and analyzing the first crash log to obtain a log analysis result; the log analysis result includes at least application information of the target application, a crash cause, and a crash code; Inputting the log analysis results into a patch code generation model to obtain crash repair code for the target application; A crash repair patch is generated based on the crash repair code, and the target application is repaired based on the crash repair patch.
2. The application repair method according to claim 1, characterized in that: The first crash rate is calculated as follows: Record the number of times the target application is opened and the number of times the target application crashes by tracking points; The first crash rate is calculated based on the number of opens and the number of crashes.
3. The application repair method according to claim 1, characterized in that: The analyzing the first crash log to obtain a log analysis result includes: Cleaning redundant data from the first crash log to remove invalid data from the first crash log and obtaining log content to be analyzed; The log content to be analyzed is input into a log analysis model to obtain the log analysis result.
4. The application repair method according to claim 1, characterized in that: Generating a crash repair patch based on the crash repair code includes: The crash repair code is submitted to a code repository to generate a crash repair patch corresponding to the crash repair code and a patch link corresponding to the crash repair patch in the code repository. The patch link is deployed to the backend of the target application so that when the target application is opened again, the crash repair patch is downloaded from the code repository according to the patch link to repair the target application.
5. The application repair method according to claim 1, wherein: Repairing the target application based on the crash repair patch includes: Determining a first number of test applications from the target application, and distributing the crash repair patch to the test applications to repair the test applications; Obtaining a second crash log and a second crash rate of the test application, and storing the second crash log in the log database; When the second crash rate is less than the second crash threshold, distributing the crash repair patch to all the target applications to repair the target applications; When the second crash rate is greater than the second crash threshold, new crash repair code is generated based on the second crash log, and execution returns to the step of loading the crash repair patch to repair the test application when the test application is opened, until the first crash rate is less than or equal to the second crash threshold, and the crash repair patch is distributed to all the target applications to repair the target applications.
6. An application repair system, characterized in that: The system includes: a crash monitoring system and a patch generation system; wherein, The crash monitoring system obtains a first crash log and a first crash rate of a target application, and stores the first crash log in a preset log database; when the first crash rate is greater than a preset first crash threshold, sends an application repair instruction to the patch generation system; The patch generation system, in response to the application repair instruction, extracts the first crash log from the log database, and analyzes the first crash log to obtain a log analysis result; the log analysis result includes at least application information of the target application, the crash cause, and the crash code; the log analysis result is input into a patch code generation model to obtain a crash repair code for the target application; a crash repair patch is generated based on the crash repair code, and the target application is repaired based on the crash repair patch.
7. The application repair system according to claim 6, characterized in that: The crash monitoring system records the number of times the target application is opened and the number of times the target application crashes by tracking points; The first crash rate is calculated based on the number of opens and the number of crashes.
8. The application repair system according to claim 6, wherein: The patch generation system cleans up redundant data on the first crash log to remove invalid data in the first crash log to obtain log content to be analyzed; and inputs the log content to be analyzed into a log analysis model to obtain the log analysis result.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the application repair method according to any one of claims 1 to 5 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the application program repair method according to any one of claims 1 to 5 is implemented.