A method, device and storage medium for repairing abnormal running of a programming language program
By automating exception log parsing and large language model analysis, the problem of relying on manual troubleshooting for programming language program exceptions has been solved, enabling efficient and accurate exception repair and resource optimization, and ensuring the stability of online services.
Patent Information
- Application Number
- CN202611607354.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-16
- Publication Date
- 2026-11-27
AI Technical Summary
In existing technologies, the analysis and repair of programming language program anomalies rely on manual investigation, which results in low timeliness and efficiency in anomaly detection, as well as low resource utilization, affecting the stability of online services and user experience.
By setting a polling interval, abnormal logs are automatically retrieved, structured parsed, deduplicated, and compared for stack types. Priorities are assigned based on server type, and a large language model is used for reasoning analysis to generate a repair plan and push it to staff.
It improved the timeliness of anomaly detection and analysis efficiency, optimized resource utilization, ensured priority handling of important anomalies, enhanced analysis accuracy and repair efficiency, and reduced the time window for manual intervention.
Smart Images

Figure CN123178151A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of large-scale model application technology, and in particular to a method, device and storage medium for repairing abnormal operation of programming language programs. Background Technology
[0002] In server-side development and maintenance, programming languages, such as Python, are widely used as the primary language for implementing business logic. As the system architecture of development projects becomes increasingly complex, the number and types of program exception stack traces generated during online operation are enormous. When program exceptions occur, the efficiency of exception analysis and repair directly impacts the stability of online services and user experience.
[0003] Currently, the analysis and repair of program runtime anomalies typically employs manual troubleshooting. This involves developers periodically logging into the server to check log files, manually searching for anomaly keywords, analyzing stack traces, searching for corresponding code files in the source code repository, and combining their personal experience to deduce the cause of the failure and output a repair solution. However, this method relies entirely on human initiative and experience. From anomaly discovery to outputting a repair solution, multiple sequential steps are required, resulting in low timeliness of anomaly discovery and low efficiency and accuracy of anomaly analysis. Furthermore, when faced with a large number of anomalies, this method often uses a first-come, first-served approach to analyze anomalies, significantly reducing system resource utilization. The timeliness of handling high-importance anomalies is low, which may further affect the stability of the entire project's online services and user experience. Summary of the Invention
[0004] This invention provides a method, device, and storage medium for repairing abnormal program execution in a programming language, thereby improving the timeliness of detecting abnormal stacks and enhancing the accuracy and efficiency of abnormal stack analysis.
[0005] In a first aspect, an embodiment of the present invention provides a method for repairing abnormal operation of a programming language program, the method comprising: The exception logs retrieved from the target server according to the set polling interval are parsed in a structured manner to obtain the exception stack; the exception logs are logs containing the exception stacks generated when errors occur during the execution of programming language programs; The exception stack is compared with the existing stacks in the stack repository to determine the stack type of the exception stack; If the stack type of the exception stack is a newly added stack, then the exception stack is assigned a priority according to the server type of the target server corresponding to the exception stack; According to the priority and first-in-first-out principle, for each exception stack assigned the priority, the project knowledge of the project corresponding to the exception stack, the source code content in the source code file corresponding to the exception stack, and the caller code related to the source code content are read. The project knowledge, the exception stack, the source code content, and the caller code are then input into a preset large language model for reasoning analysis to obtain the analysis results. The analysis results include a repair solution. The analysis results are pushed to the target communication tool; the target communication tool is used to distribute the analysis results to the modification staff so that the modification staff can fix the program defects corresponding to the exception stack according to the repair plan.
[0006] Secondly, an embodiment of the present invention provides a repair device for abnormal operation of a programming language program, the device comprising: The exception stack acquisition module is used to perform structured parsing on the exception logs pulled from the target server according to a set polling interval to obtain the exception stack; the exception logs are logs containing the exception stacks generated when errors occur during the execution of programming language programs; The stack type determination module is used to compare the exception stack with the stacks already stored in the stack repository to determine the stack type of the exception stack. The priority assignment module is used to assign a priority to the exception stack according to the server type of the target server corresponding to the exception stack if the stack type of the exception stack is a newly added stack. The analysis result reasoning module is used to read the project knowledge of the project corresponding to each exception stack, the source code content of the source code file corresponding to the exception stack, and the caller code related to the source code content, according to the priority and first-in-first-out principle. The project knowledge, the exception stack, the source code content, and the caller code are then input into a preset large language model for reasoning analysis to obtain the analysis result. The analysis result includes a repair solution. An anomaly repair module is used to push the analysis results to a target communication tool; the target communication tool is used to distribute the analysis results to the modification staff, so that the modification staff can repair the program defects corresponding to the anomaly stack according to the repair plan.
[0007] Thirdly, embodiments of the present invention also provide a computer device, the computer device comprising: One or more processors; Storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method for repairing abnormal operation of programming language programs as provided in the first aspect of the present invention.
[0008] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for repairing abnormal operation of a programming language program as provided in the first aspect of the present invention.
[0009] Fifthly, embodiments of the present invention also provide a computer program product, the computer program product comprising a computer program, which, when executed by a processor, implements the method for repairing abnormal operation of a programming language program as provided in the first aspect of the present invention.
[0010] In this embodiment of the invention, the exception logs retrieved from the target server according to a set polling interval are structured and parsed to obtain exception stacks. The exception stacks are compared with the stacks already stored in the stack repository to determine the stack type of the exception stack. If the stack type of the exception stack is a newly added stack, the exception stack is assigned a priority according to the server type of the target server corresponding to the exception stack. According to the priority and first-in-first-out principle, for each priority exception stack, the project knowledge of the project corresponding to the exception stack, the source code content in the source code file corresponding to the exception stack, and the caller code related to the source code content are read. The project knowledge, exception stack, source code content, and caller code are input into a preset large language model for reasoning analysis to obtain analysis results. The analysis results include a repair plan. The analysis results are pushed to the target communication tool. The target communication tool is used to distribute the analysis results to the modification staff so that the modification staff can repair the program defects corresponding to the exception stack according to the repair plan. This embodiment improves the timeliness of anomaly detection by retrieving anomaly logs at set polling intervals. It transforms the anomaly logs into anomaly stacks, allowing for automatic and clear anomaly information retrieval immediately after an anomaly occurs without manual log review, further enhancing the timeliness of anomaly detection. Furthermore, it deduplicates the anomaly stacks, ensuring that the same program defect is analyzed only once within a short period, avoiding repeated analysis of identical anomalies and improving the efficiency of anomaly analysis. Newly generated anomaly stacks are assigned priorities, allowing anomalies of varying impact to be processed in different orders, with higher-priority anomalies entering the analysis process first, thereby improving the utilization of analysis resources when resources are limited. Using a large language model in conjunction with project knowledge, source code content, and caller code for deep reasoning to locate specific root causes and production remediation solutions improves the efficiency and accuracy of anomaly analysis. Finally, the analysis results are pushed to specific modification personnel to fix the program defects in the anomaly stacks. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 A flowchart illustrating a method for repairing abnormal operation of a programming language program according to Embodiment 1 of the present invention; Figure 2 This is a structural block diagram of a repair device for abnormal operation of a programming language program provided in Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of the structure of a computer device provided in Embodiment 3 of the present invention. Detailed Implementation
[0013] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0014] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be used interchangeably where appropriate so that the embodiments of the invention described herein can cover implementations in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0015] Example 1 See Figure 1This diagram illustrates a flowchart of a method for repairing abnormal operation of a programming language program according to Embodiment 1 of the present invention. This embodiment is applicable to situations where exception logs are extracted from a server corresponding to a project, exception stacks matching the criteria for inclusion in the database are assigned priorities, and each exception stack is analyzed and reasoned using a large language model according to priority and first-in-first-out order to obtain a repair solution. This method can be executed by a program abnormal operation repair device, which can be implemented in hardware and / or software and can be configured in a computer device. Figure 1 As shown, the method includes: Step 101: Perform structured parsing on the exception logs pulled from the target server according to the set polling interval to obtain the exception stack.
[0016] Typically, running a project requires multiple servers; in this case, the project could be a game. To determine if a game is experiencing any issues, you can check the logs of the server running that game. These logs record various information generated during the game's execution.
[0017] To monitor the operation of a game, exception logs can be retrieved from the target server of the game at a set polling interval. The exception logs contain exception stacks generated when errors occur during the execution of the programming language program.
[0018] Each polling interval retrieves new exception logs from the target server since the last retrieval, avoiding repeated retrieval of processed historical exception logs. The polling interval can be set according to the size of the exception logs, for example, 60 seconds or 5 minutes. For projects with a large amount of exception logs, a shorter polling interval should be set to ensure that exceptions are obtained in a timely manner.
[0019] In this embodiment, the exception log contains a large amount of information, including a significant amount of redundant information unrelated to exception analysis. The exception log records the function call information at the time of the exception frame by frame from top to bottom, with each call frame arranged in the order of the calls. To reduce the impact of redundant information on the analysis, the exception log is structured and parsed to extract information relevant to exception analysis, thus obtaining the exception stack trace.
[0020] For example, the exception stack includes the exception type, error message, file path, line number, and call chain. The exception type is the exception class name of the programming language program, used to indicate the type of exception. The programming language program can be a Python program, a C++ program, a Java program, etc.; the error message is the error description information output when the exception occurs; the file path is the compilation path of the programming language program during runtime; the line number is the line number of the error code in the file corresponding to the compilation path; the call chain is the nested order of function calls when the exception occurs, used to reflect the triggering path of the exception.
[0021] This invention automatically retrieves anomaly logs at set polling intervals, eliminating reliance on personnel initiative and on-duty status for anomaly detection. Anomaly logs can be continuously retrieved even at night and on holidays, reducing potential time gaps that may occur with manual inspections and ensuring that project anomalies can be resolved within the set timeframe.
[0022] Step 102: Compare the exception stack with the existing stacks in the stack repository to determine the stack type of the exception stack.
[0023] In real-world environments, exceptions caused by the same code defect often trigger repeatedly over time. If the defect remains unfixed, each trigger will generate an exception log entry; the same exception may also occur simultaneously on multiple target servers. Performing subsequent reading and inference analysis on each identical exception stack trace would not only repeatedly consume the computational resources of the large language model inference but also repeatedly push the same issue to and disturb personnel. To address this, this embodiment performs a deduplication comparison between the parsed exception stack trace and the existing stack traces in the stack trace repository. During this deduplication comparison, the stack type of the exception stack can be determined.
[0024] For example, stack types include duplicate stacks and newly added stacks; a duplicate stack indicates that the stack repository already has a stored stack with the same content as the exception stack in the short term, and this type of exception stack will not be stored in the stack repository again. A newly added stack indicates that the stack repository does not have a stored stack with the same content as the exception stack in the short term, and this type of exception stack will be stored in the stack repository.
[0025] For example, the deduplication comparison process is as follows: Each exception stack trace typically has a unique timestamp and unique runtime data, which varies with the runtime environment. Runtime data usually includes thread identifiers, process identifiers, memory addresses, request identifiers, etc. The stack trace repository is a centralized storage area for historical exception stack traces. Stored stacks are exception stacks already stored in the stack trace repository, with timestamps and runtime data removed. Therefore, before comparing an exception stack with a stored stack in the stack trace repository, the timestamps and runtime data in the exception stack are removed to preserve stable structural information such as exception type, error message, file path, line number, and call chain.
[0026] Once the exception stack has been de-timed and the runtime data has been removed, the stack repository is queried to see if there is a stored stack that matches the contents of the exception stack.
[0027] If a stored stack exists that matches the contents of the exception stack, and the difference between the timestamp of the stored stack and the current timestamp is within a preset first time range, then the exception is considered a recently active old issue. The stack type of the exception stack is determined to be a duplicate stack. The occurrence count is accumulated on the stored stack, and the timestamp value of the stored stack is replaced with the current timestamp. The timestamp value of the stored stack is then updated. Exception stacks determined to be duplicate stacks do not need to be newly created and stored in the stack repository. The first time range is usually set to 7 days. Based on the 7-day example, "within the first time range" means within 7 days.
[0028] If there exists a stored stack that matches the contents of the exception stack, and the difference between the timestamp of the stored stack and the current timestamp is outside the preset first time range, it means that the exception has the same origin as the old record but has been dormant for a long time. The stack type of the exception stack is determined as a new storage stack. This exception stack is also written to the stack repository as a new storage stack, becoming a new record, which is independent of the dormant old record, coexists and is not merged.
[0029] If no existing stack exists that matches the contents of the exception stack, it means that the exception is being encountered for the first time. The stack type of the exception stack is determined to be a newly added stack, and the exception stack of the newly added stack is written to the stack repository.
[0030] The deduplication process in this embodiment ensures that the analysis is performed only once within the same error window period. Continuously active anomalies will not be misjudged as new problems and repeatedly occupy analysis resources. The same anomaly occurring across servers is automatically aggregated into a single record.
[0031] Step 103: If the stack type of the exception stack is a newly added stack, then assign priority to the exception stack according to the server type of the target server corresponding to the exception stack.
[0032] In this embodiment, a project is typically deployed across multiple target servers. These target servers usually have different purposes and levels of importance. For example, they may be categorized by purpose as production environment servers hosting online business and external test servers used for pre-deployment testing and verification. Anomalies occurring on these two types of target servers have different impacts on the business. Furthermore, the system's analytical resources are limited, making it difficult to analyze all newly added stack traces simultaneously. Therefore, anomaly stacks are prioritized based on the server type of the target server corresponding to them. This determines the order in which each anomaly stack is analyzed, ensuring that the processing order matches the actual impact of the anomaly.
[0033] By prioritizing exception stacks based on server type, exceptions originating from higher-importance target servers are analyzed first, allowing for faster problem response; exceptions originating from lower-importance target servers are processed later, preventing them from consuming limited analysis resources and achieving a reasonable allocation of analysis resources.
[0034] For example, when the same exception first appears, it is entered into the database as a newly added stack trace, and is given priority and enters the subsequent analysis process at that time. If the exception reappears within the same time frame and is determined to be a duplicate stack trace, giving it priority again and analyzing it repeatedly would consume analysis resources repeatedly, while the subsequent analysis results would be no different from the first time. Therefore, duplicate stack traces are no longer given priority; instead, the occurrence count is accumulated in the already stored stack traces, and the trigger time is updated.
[0035] For example, the priority includes a first priority and a second priority; the first priority is greater than the second priority.
[0036] If the target server corresponding to the exception stack is a production environment server, the exception stack is assigned the first priority; if the target server corresponding to the exception stack is an external test server, the exception stack is assigned the second priority. Production environment servers host online business, and exceptions on them directly affect user experience and may even cause actual losses. They are usually handled as quickly as possible, so they are assigned the first priority. External test servers are only used for testing, and the impact of exceptions on them is limited, so they can be handled later, and therefore are assigned the second priority.
[0037] Step 104: Following the priority and first-in-first-out principle, for each priority exception stack, read the project knowledge of the project corresponding to the exception stack, the source code content in the source code file corresponding to the exception stack, and the caller code related to the source code content. Input the project knowledge, exception stack, source code content, and caller code into the preset large language model for reasoning analysis to obtain the analysis results.
[0038] In a typical polling interval, multiple exception stacks with different priorities are generated. The different target servers of the exception stacks result in different levels of importance. Usually, exceptions with higher importance need to be processed first. Therefore, these exception stacks with different priorities are analyzed one by one according to the priority and first-in-first-out principle. Exception stacks with the first priority are processed before exceptions with the second priority. Exception stacks with the same priority are processed according to the first-in-first-out principle.
[0039] In this embodiment, after following the order of priority and first-in-first-out principle, an exception stack to be analyzed is selected, and the project knowledge of the project corresponding to the exception stack, the source code content in the source code file corresponding to the exception stack, and the caller code related to the source code content are read.
[0040] The exception stack trace records information such as the exception type, file path, and line number, but it does not contain the actual code content of the source file. The subsequent large language model will perform inference and analysis based on the source code content to ultimately determine the root cause of the exception stack and the solution. Therefore, the source code content of the exception stack is read before subsequent inference. Secondly, the caller code is read because many exceptions are not due to errors in the line itself, but rather to incorrect types or illegal values passed by the upstream caller. Usually, tracing along the call chain can restore the complete trigger path, which helps the large language model understand and locate the true cause of the exception. Reading project knowledge is to fill in the missing business context in the large language model and prevent the general model from making inferences that are divorced from the actual project.
[0041] For example, project knowledge, source code content, and caller code can be read through the following process: The project knowledge base retrieves project knowledge corresponding to the exception stack trace from the project knowledge base. Project knowledge includes code maps, skill libraries, and prompts. Code maps record the functionality, class descriptions, and dependencies between modules within the project. The skill library includes multiple skill documents describing module troubleshooting guidelines, common exception patterns, and business rules. Prompts are used to instruct the pre-built large language model on the project's analysis requirements. The project knowledge base is a centralized storage area for background knowledge of various projects and serves as the unified source for retrieving project knowledge. Project knowledge may also include MCP (Model Context Protocol) tool configurations. MCP tool configurations are external tool integration configurations used to connect to external tools such as semantic code search services, extending the tool capabilities of the large language model.
[0042] Read the source code content from the source file based on the file path in the exception stack trace. Read the caller code related to the source code content based on the call chain of the exception stack trace.
[0043] In one embodiment of the present invention, the source code content in the source code file is read according to the file path of the exception stack trace, as follows: Based on the preset mapping relationship between the compilation path prefix and the source code path prefix, the compilation path prefix in the file path of the exception stack is replaced with the corresponding source code path prefix to obtain the source code path of the source code repository; the file path refers to the compilation path; the source code repository is a storage area that centrally stores the source code files of the project; based on the source code path, the corresponding source code file is located from the source code repository.
[0044] The source code file contains a large amount of content, much of which is irrelevant to the current exception and does not need to be input into the large language model for inference. Therefore, we read the source code content related to the current exception from the source code file. The source code content includes the line of error identified in the source code file based on the line number in the exception stack trace, and the context code of the line of error.
[0045] In this embodiment, after selecting an exception stack and obtaining project knowledge, source code content, and caller code according to priority and the first-in-first-out principle, the project knowledge, exception stack, source code content, and caller code are further input into a pre-set Large Language Model (LLM) for inference analysis to obtain the analysis results of the exception stack. During the inference process, project knowledge is used to supplement background information such as the project's architectural responsibilities, dependencies, and business rules, enabling the LLM to perform inference in the correct business context; the source code content, i.e., the line of error and its context code, enables the LLM to make judgments based on real code logic rather than empirical guesses; the caller code traces upstream along the call chain to reconstruct the complete causal path of the exception being triggered. The analysis results include a remediation plan and a root cause analysis of the current exception stack.
[0046] During the reasoning and analysis process, the large language model can reconstruct the exception triggering path based on the caller's code, tracing the error step by step from the stack entry point to the location of the error and understanding the data flow. It can also determine the direct cause of the exception by combining the source code content, such as type mismatch, null references, or out-of-bounds access. Furthermore, it can assess the potential business scope affected by the exception by combining the module functions, dependencies, and business rules recorded in the project knowledge. Based on this, a repair plan is generated, including the modification location, modification content, and reason for modification. Because the reasoning is based on real source code and project knowledge, the analysis results no longer stop at a superficial interpretation of the exception type but delve into the root cause location at the line-of-code level, providing a repair plan that can directly guide code modification.
[0047] For example, the analysis results can be presented in the form of a structured report, which includes fields such as summary, anomaly type, error location, root cause analysis, and solution; where the summary is used to describe the nature of the anomaly in one sentence, the root cause analysis is the analysis of the root cause, and the solution is the remediation plan.
[0048] In addition, each exception stack is processed sequentially according to priority and first-in-first-out principles, so that high-priority exception stacks are analyzed first, and stacks of the same priority are processed in the order of arrival, thereby ensuring the rational allocation of analysis resources and the orderly nature of the processing.
[0049] For example, this embodiment uses a dual queue to implement the order according to priority and the first-in-first-out principle. The specific process is as follows: After exception stacks are assigned a first or second priority, it's difficult to achieve ordered processing based solely on priority markers. In practice, a data structure is needed to organize exception stacks of different priorities separately. If first-priority and second-priority exception stacks are mixed in the same queue, the first-in, first-out (FIFO) principle means that second-priority exception stacks might be queued before first-priority exception stacks, preventing higher-priority exceptions from being processed first. Therefore, exception stacks assigned first priority are added to a first-priority queue, and those assigned second priority are added to a second-priority queue. This separates and isolates exception stacks of different priorities, allowing for priority reading of source code content from exception stacks in the first-priority queue, ensuring that first-priority exceptions are processed before second-priority exceptions, and that higher-priority exceptions receive analysis resources first.
[0050] If the current timestamp is within the second time range, then following the first-in-first-out principle, for each exception stack in the first priority queue, read the project knowledge of the project corresponding to the exception stack, the source code content in the source code file corresponding to the exception stack, and the caller code related to the source code content. Then, input the project knowledge, exception stack, source code content, and caller code into the preset large language model for reasoning analysis to obtain the analysis results.
[0051] If the current timestamp is outside the second time range, the exception stacks in the second priority queue are sorted after the first priority queue. Following the first-in-first-out principle, for each exception stack in the first and second priority queues, the project knowledge of the project corresponding to the exception stack, the source code content in the source code file corresponding to the exception stack, and the caller code related to the source code content are read. The project knowledge, exception stack, source code content, and caller code are then input into a pre-set large language model for reasoning and analysis to obtain the analysis results.
[0052] First-priority anomalies impact online operations and require immediate handling regardless of whether they occur within the second priority timeframe. Second-priority anomalies only affect testing and have a lower urgency. The second priority timeframe typically runs from 8 AM to 11 PM, representing a peak period for online operations and anomaly occurrences. Production servers experience more anomalies, leading to limited analytical resources. Therefore, system analytical resources are prioritized for first-priority anomalies. When the current timestamp falls outside the second priority timeframe, anomaly stacks in the second priority queue are then processed after those in the first priority queue, ensuring that anomalies from production servers are prioritized and external test servers are handled at off-peak times.
[0053] In one embodiment of the present invention, if the exception stack is a duplicate stack, the target server corresponding to the exception stack is a production environment server, and the stored stack consistent with the content of the exception stack is located in the second priority queue, it indicates that the exception not only occurs on the external test server but also on the production server. The exception on the production server may affect the user experience and should be handled with priority. The second priority of the stored stack consistent with the content of the exception stack located in the second priority queue is replaced with the first priority to avoid delaying the handling of the exception and amplifying the impact of the online failure due to the continued use of the second priority, thus ensuring the intelligence and timeliness of the scheduling strategy.
[0054] In one implementation, an independent switch and pause / resume mechanism is provided for external test server anomalies. When paused, the anomaly stack of the external test server no longer enters the second priority queue. When resumed, the anomaly stack to be processed is automatically re-queued into the second priority queue according to priority, without affecting the analysis of anomalies in the production environment server.
[0055] Step 105: Push the analysis results to the target communication tool.
[0056] In this embodiment, after performing reasoning analysis on each priority exception stack, each exception stack will obtain an analysis result, which includes a repair plan. Therefore, the analysis result is pushed to the target communication tool, which is used to distribute the analysis result to the modification staff so that the modification staff can repair the program defects corresponding to the exception stack according to the repair plan.
[0057] For example, typically, when a staff member edits a source code file, they leave an editor's identification ID so that the specific staff member can be identified for subsequent project maintenance. When an exception occurs in the project, an exception stack is generated, which records line numbers. These line numbers can be used to locate the line of error in the source code file. Therefore, the process involves querying the source code file corresponding to the error line and the corresponding staff member who made the modification. This staff member carries the source code submission account. A pre-defined account mapping table is used to look up the corresponding communication account for the source code submission account. The account mapping table records the correspondence between source code submission accounts and communication accounts. The analysis results are then pushed to the communication account via a target communication tool, so that the staff member corresponding to the communication account receives the analysis results. After receiving the analysis results, they can fix the program defect indicated by the exception stack according to the repair plan in the analysis results.
[0058] For example, the analysis results pushed can include information such as server information, the first trigger time and the latest trigger time of the exception stack; the push can use a concise mode to save space, or a detailed mode to push complete analysis conclusions so that personnel can quickly grasp the full picture of the exception.
[0059] In one implementation, after the reasoning analysis is completed, the modification staff can continue to ask follow-up questions about the exception stack. The follow-up questions are related to the session context that shares the same exception stack with the large language model. The large language model remembers all the content of the previous analysis (source code content, reasoning process, analysis results) without having to repeat the explanation. The sessions between different exception stacks are independent of each other and do not interfere with each other.
[0060] In one implementation, a management interface for multiple exception stacks can also be provided. Each exception stack has status markers such as pending analysis, in analysis, and analyzed. Status changes are synchronized in real time. It also supports batch triggering of analysis, batch stopping of analysis, and marking exception stacks that do not need attention as ignored. Ignored exception stacks do not participate in automatic analysis.
[0061] In one embodiment of the present invention, the system implementing the method provided in this embodiment adopts a three-layer architecture, including a front-end layer, a back-end service layer, and an intelligent agent layer. The front-end layer is a browser that provides a visual multi-stack management interface, maintains a real-time connection with the back-end service via WebSocket, receives analysis progress pushes and status updates, and interacts with the back-end via HTTPAPI (Application Programming Interface based on Hypertext Transfer Protocol), where WebSocket is a network communication protocol. The back-end service layer carries functions such as stack storage, periodic retrieval of exception logs, exception stack scheduling, and push of analysis results. The intelligent agent layer is an intelligent agent built based on a large language model, possessing tool invocation capabilities such as code map understanding and skill library loading, and is responsible for performing deep reasoning analysis on each exception stack. For example, the back-end service layer interacts with the intelligent agent layer through the Claude SDK (Claude Software Development Kit), sending analysis requests and receiving analysis results. The intelligent agent layer reads local resources such as project source code content, code map, and skill library through tool invocation.
[0062] In this embodiment of the invention, the exception logs retrieved from the target server according to a set polling interval are structured and parsed to obtain exception stacks. The exception stacks are compared with the stacks already stored in the stack repository to determine the stack type of the exception stack. If the stack type of the exception stack is a newly added stack, the exception stack is assigned a priority according to the server type of the target server corresponding to the exception stack. According to the priority and first-in-first-out principle, for each priority exception stack, the project knowledge of the project corresponding to the exception stack, the source code content in the source code file corresponding to the exception stack, and the caller code related to the source code content are read. The project knowledge, exception stack, source code content, and caller code are input into a preset large language model for reasoning analysis to obtain analysis results. The analysis results include a repair plan. The analysis results are pushed to the target communication tool. The target communication tool is used to distribute the analysis results to the modification staff so that the modification staff can repair the program defects corresponding to the exception stack according to the repair plan. This embodiment improves the timeliness of anomaly detection by retrieving anomaly logs at set polling intervals. It transforms the anomaly logs into anomaly stacks, allowing for automatic and clear anomaly information retrieval immediately after an anomaly occurs without manual log review, further enhancing the timeliness of anomaly detection. Furthermore, it deduplicates the anomaly stacks, ensuring that the same program defect is analyzed only once within a short period, avoiding repeated analysis of identical anomalies and improving the efficiency of anomaly analysis. Newly generated anomaly stacks are assigned priorities, allowing anomalies of varying impact to be processed in different orders, with higher-priority anomalies entering the analysis process first, thereby improving the utilization of analysis resources when resources are limited. Using a large language model in conjunction with project knowledge, source code content, and caller code for deep reasoning to locate specific root causes and production remediation solutions improves the efficiency and accuracy of anomaly analysis. Finally, the analysis results are pushed to specific modification personnel to fix the program defects in the anomaly stacks.
[0063] Example 2 Figure 2 This is a schematic diagram of a repair device for abnormal operation of a programming language program provided in Embodiment 2 of the present invention, as shown below. Figure 2 As shown, the device includes: The exception stack acquisition module 201 is used to perform structured parsing on the exception logs pulled from the target server according to a set polling interval to obtain the exception stack; the exception logs are logs containing the exception stacks generated when errors occur during the execution of programming language programs; The stack type determination module 202 is used to compare the exception stack with the stacks already stored in the stack repository to determine the stack type of the exception stack. The priority assignment module 203 is used to assign a priority to the exception stack according to the server type of the target server corresponding to the exception stack if the stack type of the exception stack is a newly added stack. The analysis result reasoning module 204 is used to read the project knowledge of the project corresponding to each exception stack, the source code content of the source code file corresponding to the exception stack, and the caller code related to the source code content, according to the priority and first-in-first-out principle. The project knowledge, the exception stack, the source code content, and the caller code are then input into a preset large language model for reasoning analysis to obtain the analysis result. The analysis result includes a repair solution. The anomaly repair module 205 is used to push the analysis results to the target communication tool; the target communication tool is used to distribute the analysis results to the modification staff so that the modification staff can repair the program defects corresponding to the anomaly stack according to the repair plan.
[0064] In one embodiment of the present invention, the stack type includes a duplicate stack and a newly added stack, and the stack type determination module 202 includes: The data removal module is used to remove timestamps and runtime data from the exception stack. The stack query module is used to query the stack repository to see if there is a stored stack that matches the contents of the abnormal stack after the removal is completed. The duplicate stack determination module is used to determine the stack type of the abnormal stack as a duplicate stack if there is a stored stack that is consistent with the contents of the abnormal stack, and the difference between the timestamp of the stored stack and the current timestamp is within a preset first time range. The module accumulates the occurrence count on the stored stack and replaces the value of the timestamp of the stored stack with the current timestamp. The first inbound stack determination module is used to determine the stack type of the abnormal stack as a new inbound stack if there is an existing stack that is consistent with the contents of the abnormal stack, and the difference between the timestamp of the existing stack and the current timestamp is outside a preset first time range. The second stack determination module is used to determine the stack type of the exception stack as a new stack if there is no stored stack that matches the contents of the exception stack, and to write the exception stack of the new stack into the stack repository.
[0065] In one embodiment of the present invention, the priority includes a first priority and a second priority; the priority assignment module 203 includes: The first priority assignment module is used to assign a first priority to the exception stack if the server type of the target server corresponding to the exception stack is a production environment server. The second priority assignment module is used to assign a second priority to the exception stack if the server type of the target server corresponding to the exception stack is an external test server.
[0066] In one embodiment of the present invention, the analysis result reasoning module 204 includes: The first priority queue addition module is used to add the exception stack that has been assigned the first priority to the first priority queue. The second priority queue addition module is used to add the exception stack that has been assigned the second priority to the second priority queue. The first analysis result reasoning module is used to, if the current timestamp is within the second time range, read the project knowledge of the project corresponding to the exception stack, the source code content in the source code file corresponding to the exception stack, and the caller code related to the source code content for each exception stack in the first priority queue according to the first-in-first-out principle, and input the project knowledge, the exception stack, the source code content and the caller code into a preset large language model for reasoning analysis to obtain the analysis result; The second analysis result reasoning module is used to sort the exception stacks in the second priority queue after the first priority queue if the current timestamp is outside the second time range. Following the first-in-first-out principle, for each exception stack in the first priority queue and the second priority queue, it reads the project knowledge of the project corresponding to the exception stack, the source code content in the source code file corresponding to the exception stack, and the caller code related to the source code content. The project knowledge, the exception stack, the source code content, and the caller code are then input into a preset large language model for reasoning analysis to obtain the analysis result.
[0067] In one embodiment of the present invention, it further includes: The priority replacement module is used to replace the second priority of the stored stack that is consistent with the content of the exception stack in the second priority queue with the first priority if the exception stack is the duplicate stack, the target server corresponding to the exception stack is the production environment server, and the stored stack that is consistent with the content of the exception stack is located in the second priority queue.
[0068] In one embodiment of the present invention, the analysis result reasoning module 204 includes: The project knowledge retrieval module is used to retrieve project knowledge corresponding to the exception stack from the project knowledge base. The project knowledge includes a code map, a skill library, and prompt words. The code map records the functions, class descriptions, and dependencies between modules in the project. The skill library includes multiple skill documents, which describe the troubleshooting specifications for each module, the common patterns when an exception occurs in that module, and the business rules of that module. The prompt words are used to indicate the analysis requirements of the project to a pre-defined large language model. The source code content reading module is used to read the source code content in the source code file based on the file path of the exception stack; The caller code reading module is used to read the caller code related to the source code content based on the call chain of the exception stack.
[0069] In one embodiment of the present invention, the source code content reading module includes: The source code path determination module is used to replace the compilation path prefix in the file path of the exception stack with the corresponding source code path prefix according to the preset mapping relationship between the compilation path prefix and the source code path prefix, so as to obtain the source code path of the source code repository. The source code file location module is used to locate the corresponding source code file from the source code repository based on the source code path. The source code content determination module is used to read the source code content in the source code file; the source code content includes the error line determined in the source code file according to the line number in the exception stack and the context code of the error line.
[0070] In one embodiment of the present invention, the anomaly repair module 205 includes: The modification staff query module is used to query the modification staff corresponding to the error line in the source code file corresponding to the analysis result; the modification staff carries the source code submission account. The communication account mapping module is used to query the communication account corresponding to the source code submission account through a preset account mapping table; The analysis result push module is used to push the analysis results to the communication account through the target communication tool, so that the modification staff corresponding to the communication account can receive the analysis results.
[0071] The program language program abnormal operation repair device provided in the embodiments of the present invention can execute the program language program abnormal operation repair method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the program language program abnormal operation repair method.
[0072] Example 3 See Figure 3 This diagram illustrates a structural schematic of a computer device according to an embodiment of the present invention. The term "computer device" is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, blade servers, mainframe computers, and other suitable computers. The computer device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0073] like Figure 3 As shown, the computer device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer programs stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the computer device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0074] Multiple components in computer device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of monitors, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows computer device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0075] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as methods for repairing abnormal operation of programming language programs.
[0076] In some embodiments, the method for repairing abnormal operation of a programming language program can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the computer device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the method for repairing abnormal operation of a programming language program described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the method for repairing abnormal operation of a programming language program by any other suitable means (e.g., by means of firmware).
[0077] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0078] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0079] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0080] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer device having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0081] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0082] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0083] Example 4 This invention also provides a computer program product, which includes a computer program that, when executed by a processor, implements a method for repairing abnormal operation of a programming language program as provided in any embodiment of this invention.
[0084] In implementing the computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0085] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0086] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for repairing abnormal program execution in a programming language, characterized in that, The method includes: The exception logs retrieved from the target server according to the set polling interval are parsed in a structured manner to obtain the exception stack; the exception logs are logs containing the exception stacks generated when errors occur during the execution of programming language programs; The exception stack is compared with the existing stacks in the stack repository to determine the stack type of the exception stack; If the stack type of the exception stack is a newly added stack, then the exception stack is assigned a priority according to the server type of the target server corresponding to the exception stack; According to the priority and first-in-first-out principle, for each exception stack assigned the priority, the project knowledge of the project corresponding to the exception stack, the source code content in the source code file corresponding to the exception stack, and the caller code related to the source code content are read. The project knowledge, the exception stack, the source code content, and the caller code are then input into a preset large language model for reasoning analysis to obtain the analysis results. The analysis results include a repair solution. The analysis results are pushed to the target communication tool; the target communication tool is used to distribute the analysis results to the modification staff so that the modification staff can fix the program defects corresponding to the exception stack according to the repair plan.
2. The method according to claim 1, characterized in that, The stack types include duplicate stacks and newly added stacks. The step of comparing the exception stack with the already stored stacks in the stack repository to determine the stack type of the exception stack includes: Remove the timestamps and runtime data from the exception stack; If the removal is complete, query the stack repository to see if there is a stored stack that matches the contents of the exception stack. If there exists a stored stack that is consistent with the contents of the exception stack, and the difference between the timestamp of the stored stack and the current timestamp is within a preset first time range, then the stack type of the exception stack is determined to be a duplicate stack, the occurrence count is accumulated on the stored stack, and the value of the timestamp of the stored stack is replaced with the current timestamp. If there exists a stored stack that matches the contents of the exception stack, and the difference between the timestamp of the stored stack and the current timestamp is outside a preset first time range, then the stack type of the exception stack is determined as a newly added stack. If no stored stack exists that matches the contents of the exception stack, then the stack type of the exception stack is determined as a new storage stack, and the exception stack of the new storage stack is written to the stack repository.
3. The method according to claim 2, characterized in that, The priority includes a first priority and a second priority; assigning priority to the exception stack based on the server type of the target server corresponding to the exception stack includes: If the server type of the target server corresponding to the exception stack is a production environment server, then the exception stack is given the first priority. If the server type of the target server corresponding to the exception stack is an external test server, then the exception stack is given a second priority.
4. The method according to claim 3, characterized in that, The process involves, according to the priority and first-in-first-out principle, reading project knowledge of the project corresponding to each exception stack, source code content in the source code file corresponding to the exception stack, and caller code related to the source code content, for each exception stack assigned the priority. The project knowledge, exception stack, source code content, and caller code are then input into a pre-set large language model for inference analysis to obtain analysis results, including: Add the exception stack assigned the first priority to the first priority queue; Add the exception stack assigned to the second priority to the second priority queue; If the current timestamp is within the second time range, then according to the first-in-first-out principle, for each exception stack in the first priority queue, read the project knowledge of the project corresponding to the exception stack, the source code content in the source code file corresponding to the exception stack, and the caller code related to the source code content, and input the project knowledge, the exception stack, the source code content and the caller code into a preset large language model for reasoning analysis to obtain the analysis results; If the current timestamp is outside the second time range, the exception stacks in the second priority queue are sorted after the first priority queue. Following the first-in-first-out principle, for each exception stack in the first priority queue and the second priority queue, the project knowledge of the project corresponding to the exception stack, the source code content in the source code file corresponding to the exception stack, and the caller code related to the source code content are read. The project knowledge, the exception stack, the source code content, and the caller code are then input into a preset large language model for reasoning analysis to obtain the analysis results.
5. The method according to claim 4, characterized in that, Also includes: If the exception stack is the duplicate stack, the target server corresponding to the exception stack is the production environment server, and the stored stack that matches the content of the exception stack is located in the second priority queue, then the second priority of the stored stack that matches the content of the exception stack and is located in the second priority queue is replaced with the first priority.
6. The method according to claim 1, characterized in that, The process of reading the project knowledge of the project corresponding to the exception stack, the source code content in the source code file corresponding to the exception stack, and the caller code related to the source code content includes: The project knowledge corresponding to the exception stack is retrieved from the project knowledge base. This project knowledge includes a code map, a skill library, and prompts. The code map records the functions, class descriptions, and dependencies between modules within the project. The skill library includes multiple skill documents, which describe the troubleshooting guidelines for each module, the common patterns when an exception occurs in that module, and the business rules of that module. The prompts are used to indicate the analysis requirements of the project to a pre-defined large language model. Read the source code content from the source code file based on the file path of the exception stack; Based on the call chain of the exception stack, read the caller code related to the source code content.
7. The method according to claim 6, characterized in that, The step of reading the source code content from the source code file based on the file path of the exception stack includes: Based on the preset mapping relationship between the compilation path prefix and the source code path prefix, the compilation path prefix in the file path of the exception stack is replaced with the corresponding source code path prefix to obtain the source code path of the source code repository. Based on the source code path, locate the corresponding source code file from the source code repository; Read the source code content from the source code file; the source code content includes the error line determined in the source code file according to the line number in the exception stack and the context code of the error line.
8. The method according to claim 7, characterized in that, The step of pushing the analysis results to the target communication tool includes: The source code file corresponding to the analysis result is searched for the modification staff member who made the modification; the modification staff member carries the source code submission account. The communication account corresponding to the source code submission account is queried through a preset account mapping table; The analysis results are pushed to the communication account via the target communication tool, so that the modification staff corresponding to the communication account can receive the analysis results.
9. A computer device, characterized in that, The computer device includes: One or more processors; Storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method for repairing abnormal operation of a programming language program as described in any one of claims 1-8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, this program implements the method for repairing abnormal operation of a programming language program as described in any one of claims 1-8.
