Application program exception handling method and device, electronic equipment and storage medium
By customizing the operating system kernel configuration information to generate abnormal data and obtain container indication information, the problem of inconvenient location of application crashes in the container environment is solved, and rapid location and efficient alarm processing are achieved.
Patent Information
- Application Number
- CN202410280459.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-12
- Publication Date
- 2025-09-16
AI Technical Summary
In a container environment, existing technologies cannot quickly locate the cause of application crashes, and the lack of crash site data makes it difficult to locate exceptions.
By customizing and modifying the kernel configuration information of the operating system, abnormal data is generated and container indication information is obtained, stored in a non-local storage area, and alarm processing is performed, supporting multi-threaded compression and analysis.
It enables rapid location of anomalies in containerized applications, improves the timeliness and effectiveness of anomaly alerts, facilitates the acquisition of on-site data, and improves the convenience of anomaly analysis.
Smart Images

Figure CN120653533A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud technology, and in particular to a method, device, electronic device, and storage medium for handling exceptions in an application program. Background Art
[0002] With the development of cloud technology, container technology has become increasingly mature, and more and more organizations are migrating their infrastructure to container clusters.
[0003] In the related art, in order to ensure the normal operation of containerized applications on the container environment platform, program crash events are often detected and abnormal alarms are performed. However, the abnormal handling solutions in the related art are generally directly based on the Linux system. For example, in the Linux environment, a core dump (core dump file) is generated when a program crashes, and the detection system reports to the alarm system when the core dump file generation is detected. However, the solution in the above-mentioned related art, although a program abnormality (crash) alarm is performed, the crash file (i.e., core dump file) is not reported. In addition, in the container environment, multiple applications of different users may be running on a node. Only by detecting the generation of core dump files and performing abnormal alarms, the user needs to find and log in to the machine to locate the problem according to the alarm, and cannot quickly locate the cause of the application crash. There are problems such as inconvenience in locating program abnormalities and lack of crash site data. Summary of the Invention
[0004] The present application provides an application exception handling method, apparatus, device, storage medium, and computer program product, which can quickly locate the container where the exception occurs, thereby greatly improving the convenience and efficiency of locating program anomaly points on the node, and on the basis of improving the timeliness and effectiveness of anomaly alarms, facilitating relevant personnel to obtain anomaly on-site data, thereby better improving the convenience of subsequent anomaly analysis and positioning.
[0005] In one aspect, the present application provides a method for handling exceptions in an application program, the method comprising:
[0006] When a target application is started, custom modification is performed on preset kernel configuration information corresponding to the current operating system to obtain target kernel configuration information, wherein the target kernel configuration information includes the preset kernel configuration information and custom configuration information, and the preset kernel configuration information is used to generate corresponding exception data when an exception occurs in any containerized application running in the current operating system; the custom configuration information includes container configuration information, and the container configuration information is used to obtain container indication information corresponding to the containerized application that has an exception; the target application is any containerized application in the current node;
[0007] In the event that an exception occurs in the target application, the current operating system generates target exception data corresponding to the target application based on the preset kernel configuration information, and obtains target container indication information corresponding to the target application based on the container configuration information;
[0008] The target abnormal data is stored in a non-local first preset storage area, and an alarm process is performed based on the target container indication information.
[0009] In an optional embodiment, the custom configuration information further includes compression configuration information, where the compression configuration information is used to compress exception data corresponding to the containerized application program that has an exception. The method further includes:
[0010] The current operating system performs multi-threaded parallel compression processing on the target abnormal data based on the compression configuration information to obtain target compressed abnormal data;
[0011] The storing the target abnormal data in a non-local first preset storage area includes:
[0012] The target compression exception data is stored in the first preset storage area.
[0013] In an optional embodiment, the custom configuration information further includes: writing configuration information, wherein the writing configuration information is used to write compressed exception data corresponding to the containerized application that has an exception to a local second preset storage area; the method further includes:
[0014] The current operating system writes the target compression exception data into the second preset storage area based on the write configuration information.
[0015] In an optional embodiment, the method further includes:
[0016] performing a new addition detection on the second preset storage area;
[0017] The storing the target compressed exception data in the first preset storage area includes:
[0018] When it is detected that the target compression exception data is newly added in the second preset storage area, the target compression exception data is stored in the first preset storage area.
[0019] In an optional embodiment, after performing alarm processing based on the target container indication information, the method further includes:
[0020] Automatically triggering an abnormal data analysis task to obtain the target abnormal data from the first preset storage area, and analyzing the target abnormal data to obtain an abnormality analysis result, wherein the abnormality analysis result is summary data in the target abnormal data for locating the abnormal position of the target application;
[0021] The abnormality analysis result is sent to the management terminal corresponding to the target application.
[0022] In an optional embodiment, the method further includes:
[0023] Deploy an anomaly detection alarm agent at the current node;
[0024] Starting the anomaly detection alarm agent;
[0025] When the target application is started, customizing and modifying the preset kernel configuration information corresponding to the current operating system to obtain the target kernel configuration information includes:
[0026] When the target application is started, the anomaly detection alarm agent automatically customizes the preset kernel configuration information corresponding to the current operating system to obtain the target kernel configuration information;
[0027] The storing the target abnormal data in a non-local first preset storage area and performing alarm processing based on the target container indication information includes:
[0028] The anomaly detection alarm agent stores the target anomaly data in a non-local first preset storage area, and performs an alarm process based on the target container indication information.
[0029] In an optional embodiment, the performing alarm processing based on the target container indication information includes:
[0030] An abnormality alarm instruction including the target container indication information is sent to a preset alarm system, so that the alarm system sends an alarm message including the target container indication information to a management terminal corresponding to the target application.
[0031] Another aspect provides an exception handling device for an application program, the device comprising:
[0032] A kernel configuration modification module is configured to, when a target application is started, perform custom modifications to preset kernel configuration information corresponding to the current operating system online to obtain target kernel configuration information, wherein the target kernel configuration information includes the preset kernel configuration information and custom configuration information. The preset kernel configuration information is used to generate corresponding exception data when an exception occurs in any containerized application running in the current operating system; the custom configuration information includes container configuration information, and the container configuration information is used to obtain container indication information corresponding to the containerized application that has an exception; the target application is any containerized application in the current node;
[0033] a data acquisition module configured to execute, when an exception occurs in the target application, the current operating system generating target exception data corresponding to the target application based on the preset kernel configuration information, and acquiring target container indication information corresponding to the target application based on the container configuration information;
[0034] An abnormal data storage module is configured to store the target abnormal data in a first non-local preset storage area;
[0035] The alarm processing module is configured to perform alarm processing based on the target container indication information.
[0036] In an optional embodiment, the custom configuration information further includes compression configuration information, where the compression configuration information is used to compress abnormal data corresponding to the abnormal containerized application; and the device further includes:
[0037] A parallel compression processing module is configured to execute the current operating system to perform multi-threaded parallel compression processing on the target abnormal data based on the compression configuration information to obtain target compressed abnormal data;
[0038] The abnormal data storage module is specifically configured to store the target compressed abnormal data in the first preset storage area.
[0039] In an optional embodiment, the custom configuration information further includes: writing configuration information, wherein the writing configuration information is used to write compressed exception data corresponding to the containerized application that has an exception to a local second preset storage area; the device further includes:
[0040] The abnormal data writing module is configured to execute the current operating system to write the target compressed abnormal data into the second preset storage area based on the writing configuration information.
[0041] In an optional embodiment, the device further comprises:
[0042] a new addition detection module, configured to perform a new addition detection on the second preset storage area;
[0043] The abnormal data storage module is specifically configured to execute, when it is detected that the target compressed abnormal data is newly added in the second preset storage area, storing the target compressed abnormal data in the first preset storage area.
[0044] In an optional embodiment, the device further comprises:
[0045] an abnormal data analysis module configured to automatically trigger an abnormal data analysis task after performing the alarm processing based on the target container indication information, to obtain the target abnormal data from the first preset storage area, and analyze the target abnormal data to obtain an abnormality analysis result, wherein the abnormality analysis result is summary data in the target abnormal data for locating the abnormal position of the target application;
[0046] The abnormality analysis result sending module is configured to send the abnormality analysis result to the management terminal corresponding to the target application.
[0047] In an optional embodiment, the device further comprises:
[0048] An anomaly detection alarm agent deployment module is configured to execute deployment of an anomaly detection alarm agent on the current node;
[0049] An anomaly detection alarm agent startup module is configured to execute startup of the anomaly detection alarm agent;
[0050] The kernel configuration modification module is specifically configured to execute, when the target application is started, the anomaly detection alarm agent automatically customizes the preset kernel configuration information corresponding to the current operating system to obtain the target kernel configuration information;
[0051] The abnormality data storage module is specifically configured to execute the abnormality detection alarm agent to store the target abnormality data in a non-local first preset storage area;
[0052] The alarm processing module is specifically configured to execute the anomaly detection alarm agent to perform alarm processing based on the target container indication information.
[0053] In an optional embodiment, the alarm processing module includes:
[0054] The abnormal alarm instruction sending unit is configured to execute an abnormal alarm instruction including the target container indication information to a preset alarm system, so that the alarm system sends an alarm message including the target container indication information to a management terminal corresponding to the target application.
[0055] Another aspect provides an electronic device, comprising: a processor;
[0056] a memory for storing instructions executable by the processor;
[0057] The processor is configured to execute the instructions to implement any one of the above-mentioned exception handling methods for the application.
[0058] On the other hand, a computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute any of the above-mentioned exception handling methods for containerized applications.
[0059] Another aspect provides a computer program product or computer program, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the application exception handling method provided in the various optional implementations described above.
[0060] The application exception handling method, apparatus, device, storage medium, and computer program product provided in this application have the following technical effects:
[0061] When any containerized application in a node is started, the present application modifies the preset kernel configuration information corresponding to the current operating system. This can facilitate the containerized application to obtain the container indication information corresponding to the abnormal containerized application through the operating system when an abnormality occurs, while generating abnormal data reflecting the abnormal situation of the application. The container where the abnormality occurs can be quickly located, thereby greatly improving the convenience and efficiency of locating the program abnormal point on the node. In addition, when the abnormal data is stored in a non-local first preset storage area, abnormal alarm processing is performed based on the container indication information. On the basis of improving the timeliness and effectiveness of the abnormal alarm, it can facilitate relevant personnel to obtain abnormal on-site data, thereby better improving the convenience of subsequent abnormal analysis and positioning. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present application or the prior art, the following is a brief introduction to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0063] Figure 1 Schematic diagram of an application environment of an exception handling method for an application program provided in an embodiment of the present application;
[0064] Figure 2 This is a flowchart of an exception handling method for an application program provided in an embodiment of the present application;
[0065] Figure 3 This is a schematic diagram of a node deployed with an anomaly detection alarm agent provided by an embodiment of the present application;
[0066] Figure 4 This is a flowchart of another application exception handling process provided by an embodiment of the present application;
[0067] Figure 5 This is a schematic diagram of the structure of an exception handling device for an application program provided in an embodiment of the present application;
[0068] Figure 6 This is a block diagram of an electronic device for application exception handling provided by an embodiment of the present application;
[0069] Figure 7 This is a block diagram of another electronic device for application exception handling provided in an embodiment of the present application. DETAILED DESCRIPTION
[0070] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0071] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.
[0072] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0073] The following first introduces the relevant terms involved in the embodiments of this application:
[0074] Containers (Pods): Container technology allows you to package and isolate an application along with its entire runtime environment (including all required files). This makes it easy to migrate applications between different environments (such as development, testing, and production) while preserving their full functionality.
[0075] Kubernetes: Also known as K8s, is an open source system for automating the deployment, scaling, and management of containerized applications.
[0076] DaemonSet: A workload resource (i.e., a daemon process) that ensures that a Pod runs on all or some nodes in a cluster. When a node joins the cluster, a Pod is added for that node. When a node is removed from the cluster, the Pod associated with that node is also recycled. Deleting a DaemonSet also deletes all the Pods it created.
[0077] core dump: A core dump file is a file in which the operating system writes the contents of the process address space and information about the process status to a disk file when the process receives certain signals and terminates.
[0078] Object storage is a technology for storing and managing data in unstructured formats, called objects. Modern organizations need to create and analyze large amounts of unstructured data, such as photos, videos, emails, web pages, sensor data, and audio files. Cloud object storage systems distribute this data across multiple physical devices but allow users to efficiently access the content from a single virtual repository.
[0079] See also Figure 1 , Figure 1 This is a schematic diagram of an application environment of an exception handling method for an application provided in an embodiment of the present application. The application environment may include at least a node cluster 100, an alarm system 200 and a terminal 300.
[0080] In an optional embodiment, the node cluster 100 may include multiple nodes. Specifically, at least one containerized application may run on each node, and each node may perform anomaly detection, reporting, and other processing on the containerized application running on the node; specifically, the node may be a server, and accordingly, the node cluster 100 may be a server cluster composed of multiple physical servers, or it may be a cloud server cluster that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms; optionally, the node may also be a terminal device, and accordingly, the node cluster 100 may be a terminal device cluster composed of multiple terminal devices.
[0081] In an optional embodiment, the alarm system 200 can send an alarm message to the terminal 300 corresponding to the corresponding application based on the abnormal situation reported by the node; specifically, the alarm system 200 can be an alarm system such as Prometheus based on cloud native.
[0082] In a specific embodiment, the terminal 300 can be a management terminal corresponding to the containerized application. Specifically, the terminal 300 can include but is not limited to smart phones, desktop computers, tablet computers, laptops, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, smart wearable devices, vehicle-mounted terminals, smart TVs and other types of electronic devices; it can also be software running on the above electronic devices, such as applications, applets, etc. The operating system running on the electronic device in the embodiment of the present application can include but is not limited to Android, IOS, Linux, Windows, etc.
[0083] In addition, it should be noted that Figure 1What is shown is merely an application environment of an exception handling method for an application program, and the embodiments of this specification are not limited to the above.
[0084] In the embodiments of this specification, the node cluster 100, the alarm system 200 and the terminal 300 may be directly or indirectly connected via wired or wireless communication, which is not limited in this application.
[0085] The following describes an exception handling method for an application program of this application. Figure 2 It is a flowchart of an exception handling method for an application provided in an embodiment of the present application. This specification provides method operation steps such as the embodiment or flowchart, but may include more or fewer operation steps based on conventional or non-creative work. The order of steps listed in the embodiment is only one way of executing the order of many steps and does not represent the only execution order. When the actual system or server product is executed, it can be executed in sequence or in parallel (for example, in a parallel processor or multi-threaded processing environment) according to the method shown in the embodiment or the accompanying drawings. Specifically, Figure 2 As shown, the method may include:
[0086] S201: When a target application is started, custom modification is performed on preset kernel configuration information corresponding to the current operating system to obtain target kernel configuration information.
[0087] In a specific embodiment, the current operating system may be the operating system on the current node where the target application is located; the preset kernel configuration information belongs to the kernel configuration information of the current operating system. Specifically, the preset kernel configuration information may be used to generate corresponding exception data when an exception occurs in any containerized application running in the current operating system. Specifically, an exception in a containerized application may be the termination of a process in the containerized application. Specifically, the exception data may be a core dump file (i.e., the contents of the process address space and information about the process status when the application is abnormal). Specifically, the target application may be any containerized application in the current node. Optionally, taking the current operating system as the Linux operating system as an example, the preset kernel configuration information may be the kernel parameter configuration "kernel.core_pattern".
[0088] In a specific embodiment, the above-mentioned target kernel configuration information may include preset kernel configuration information and custom configuration information; specifically, the custom configuration information is a customizable kernel configuration script, specifically, the custom configuration information may include (customized) container configuration information, and the container configuration information may be used to obtain container indication information corresponding to the containerized application that has an exception; specifically, each application (containerized application) corresponds to a container (i.e., a shell that packages and isolates the application and its entire runtime environment); the container indication information corresponding to the containerized application may be indication information of the container corresponding to the containerized application, specifically, the container indication information may include container identification information of the container corresponding to the containerized application, space identification information of the namespace to which the container belongs, and cluster identification information of the cluster to which the namespace belongs, and other environment variable information.
[0089] In an embodiment of the present application, by customizing and modifying the preset kernel configuration information corresponding to the current operating system, target kernel configuration information with added custom configuration information is obtained. This can facilitate obtaining container indication information corresponding to the abnormal containerized application through the operating system when an abnormality occurs in the containerized application, thereby improving the convenience and efficiency of locating program abnormality points on the node.
[0090] S203: When an exception occurs in the target application, the current operating system generates target exception data corresponding to the target application based on the preset kernel configuration information, and obtains target container indication information corresponding to the target application based on the container configuration information;
[0091] In a specific embodiment, the current operating system can detect an exception in the corresponding application by detecting a process crash event (i.e., an event in which the process terminates running) in the application. Accordingly, the above-mentioned exception (crash) in the target application can be the termination of the process in the target application; specifically, the target exception data can be a core dump file containing the contents of the process address space at the time of the target application exception and relevant process status information. The target container indication information can be the indication information of the container corresponding to the target application. Specifically, the target container indication information can include the container identification information of the container corresponding to the target application (such as the container name and version number, etc.), the space identification information of the namespace to which the container corresponding to the target application belongs, and the cluster identification information of the cluster to which the namespace belongs, and other environmental variable information.
[0092] S203: Storing the target abnormal data in a non-local first preset storage area, and performing alarm processing based on the target container indication information.
[0093] In actual applications, for security reasons, development and operation and maintenance personnel are generally prohibited from directly accessing the online applications and the hosts (nodes) where they are located; accordingly, the target abnormal data that can reflect the abnormal on-site conditions of the target application can be stored in a non-local first preset storage area, which can facilitate subsequent relevant personnel to pull the target abnormal data at any time for abnormal analysis, greatly improving the convenience and efficiency of pulling the target abnormal data; specifically, the above-mentioned first preset storage area can be stored in an unstructured format, that is, data can be stored through object storage.
[0094] In an optional embodiment, the alarm processing based on the target container indication information may include:
[0095] An abnormal alarm instruction including the target container indication information is sent to a preset alarm system, so that the alarm system sends an alarm message including the target container indication information to a management terminal corresponding to the target application.
[0096] In a specific embodiment, the alarm message can be sent to the management terminal corresponding to the target application via a management group message, SMS, email, etc. In actual applications, when an exception occurs in the target application, the current operating system can also obtain information such as the time when the exception occurred and the service identifier of the service corresponding to the process. Accordingly, the above-mentioned exception alarm instruction can also include information such as the time when the exception occurred and the service identifier of the service corresponding to the process; accordingly, the above-mentioned alarm message can also include information such as the time when the exception occurred and the service identifier of the service corresponding to the process.
[0097] It can be seen from the technical solutions provided by the above embodiments of the present application that, in the embodiments of the present application, when any containerized application in a node is started, by modifying the preset kernel configuration information corresponding to the current operating system, it is possible to facilitate the containerized application to obtain the container indication information corresponding to the containerized application where the exception occurs through the operating system while generating exception data reflecting the on-site situation of the application exception, so as to quickly locate the container where the exception occurs, thereby greatly improving the convenience and efficiency of locating the program exception point on the node, and when the exception data is stored in the non-local first preset storage area, performing exception alarm processing based on the container indication information can facilitate relevant personnel to obtain exception on-site data on the basis of improving the timeliness and effectiveness of the exception alarm, thereby better improving the convenience of subsequent exception analysis and positioning.
[0098] In an optional embodiment, the custom configuration information may further include compression configuration information, which may be used to compress exception data corresponding to the containerized application that has an exception. Accordingly, the method may further include:
[0099] The current operating system performs multi-threaded parallel compression processing on the target abnormal data based on the compression configuration information to obtain the target compressed abnormal data;
[0100] Accordingly, storing the target abnormal data in the non-local first preset storage area may include:
[0101] The target compressed exception data is stored in a first preset storage area.
[0102] In actual applications, core dump files include the contents of program memory space and therefore contain a large amount of low-entropy data. Accordingly, multi-threaded parallel compression can greatly reduce the size of the final output file (target compressed exception data), reduce disk IO, and thus accelerate the rapid recovery of the container.
[0103] In an optional embodiment, the custom configuration information may further include: writing configuration information, where the writing configuration information is used to write compressed exception data corresponding to the containerized application that has an exception to a local second preset storage area; accordingly, the method may further include:
[0104] The current operating system writes the target compression exception data into the second preset storage area based on the write configuration information.
[0105] In a specific embodiment, the second preset storage area may be a preset storage space for local storage of abnormal data.
[0106] In an optional embodiment, the above method may further include:
[0107] Performing a new detection on the second preset storage area;
[0108] Storing the target compressed exception data in the first preset storage area includes:
[0109] When newly added target compression abnormal data is detected in the second preset storage area, the target compression abnormal data is stored in the first preset storage area.
[0110] In the above embodiment, by configuring the customized write configuration information, the operating system can store abnormal data in a customized storage area when a program is abnormal, thereby facilitating abnormality detection and uploading abnormal data to a non-local first preset storage area.
[0111] In an optional embodiment, after performing alarm processing based on the target container indication information, the above method may further include:
[0112] Automatically triggering an abnormal data analysis task to obtain target abnormal data from a first preset storage area, and analyzing the target abnormal data to obtain an abnormal analysis result;
[0113] Send the abnormal analysis results to the management terminal corresponding to the target application.
[0114] In a specific embodiment, an exception analysis result can be extracted from the target exception data. The above exception analysis result is summary data in the target exception data used to locate the abnormal position of the target application; optionally, the exception analysis result may include program stack information and brief memory information of the target application.
[0115] In a specific embodiment, the data format of the abnormality analysis result can be in a table, word, etc., which can be set in combination with actual applications.
[0116] In the above embodiment, after the alarm is processed, the target abnormal data can be analyzed by automatically triggering the abnormal data analysis task, and summary data for locating the abnormal location of the target application can be obtained and pushed to the management terminal, which can further speed up the development and other related personnel to understand the abnormal problem and quickly solve the abnormal problem.
[0117] In an optional embodiment, an anomaly detection and alarm agent may be pre-deployed on each node, and then the anomaly detection and alarm agent may be used to perform anomaly detection and alarm processing on the containerized application. Accordingly, the above method may further include:
[0118] Deploy an anomaly detection alarm agent on the current node;
[0119] Start the anomaly detection alarm agent;
[0120] Accordingly, when the target application is started, the preset kernel configuration information corresponding to the current operating system is customized and modified to obtain the target kernel configuration information, which may include:
[0121] When the target application is started, the anomaly detection alarm agent automatically customizes the preset kernel configuration information corresponding to the current operating system to obtain the target kernel configuration information;
[0122] The storing of the target abnormal data in the non-local first preset storage area and performing alarm processing based on the target container indication information may include:
[0123] The anomaly detection alarm agent stores the target anomaly data in a non-local first preset storage area, and performs alarm processing based on the target container indication information.
[0124] The aforementioned additional detection of the second preset storage area may include:
[0125] The anomaly detection alarm agent performs a new detection on the second preset storage area.
[0126] In a specific embodiment, the anomaly detection alarm agent can be deployed on the node in a daemonset manner, that is, the anomaly detection alarm agent is packaged and isolated through container technology. Figure 3 As shown, Figure 3 This is a schematic diagram of a node deployed with an anomaly detection and alarm agent provided by an embodiment of the present application. Specifically, the node may include multiple containerized applications and anomaly detection and alarm agents packaged and isolated using container technology.
[0127] In the above embodiment, by deploying an anomaly detection alarm agent on each node, the anomaly detection alarm agent can modify the kernel configuration information, and then obtain the container indication information corresponding to the abnormal containerized application through customized kernel configuration information for alarm processing, thereby realizing cloud-native design and supporting container environment program crash management and detection.
[0128] In a specific embodiment, Figure 4 As shown, Figure 4 It is a flowchart of an exception handling of another application provided by an embodiment of the present application. Specifically, an anomaly detection alarm agent can be deployed to a node with a container environment, and then the anomaly detection alarm agent is started; then, when any containerized application is started on the node, the anomaly detection alarm agent can be used to automatically customize the preset kernel configuration information corresponding to the current operating system; and detect whether new abnormal data is added to the specified directory (the second local preset storage area); in addition, when any containerized application crashes (an exception occurs), the current operating system generates abnormal data corresponding to the crashed containerized application and obtains the container indication information corresponding to the crashed containerized application, and the current operating system performs multi-threaded parallel compression on the abnormal data; the current operating system writes the compressed abnormal data to the specified directory (the second local preset storage area); accordingly, the anomaly detection alarm agent detects the addition of abnormal data to the specified directory (the compressed abnormal data corresponding to the crashed containerized application), and can upload the compressed abnormal data to the non-local first preset storage area, and report to the alarm system for alarm processing; in addition, the anomaly detection alarm agent analyzes the compressed abnormal data, and pushes the abnormal analysis results to the management terminal corresponding to the crashed containerized application.
[0129] The exception handling method for an application provided in the embodiment of the present application can realize abnormal detection and alarm of cloud native design, support program crash detection and alarm processing in the k8s container environment, and support multi-threaded compression of crash files (abnormal data), reduce space occupancy and generation time consumption, speed up the recovery process, and upload crash files to object storage to facilitate subsequent analysis and statistics; and report to a unified alarm system, so that relevant personnel such as development and operation and maintenance can obtain abnormal situations in a timely manner, and by pushing abnormal analysis results including program stack information and brief memory information, further accelerate the analysis and resolution of the causes of the crash.
[0130] The present application also provides an exception handling device for an application program. Figure 5 This is a schematic diagram of the structure of an exception handling device for an application provided in an embodiment of the present application. Figure 5 As shown, the above device includes:
[0131] The kernel configuration modification module 510 is configured to, when a target application is started, perform custom modifications to the preset kernel configuration information corresponding to the current operating system to obtain target kernel configuration information. The target kernel configuration information includes preset kernel configuration information and custom configuration information. The preset kernel configuration information is used to generate corresponding exception data when any containerized application running in the current operating system encounters an exception. The custom configuration information includes container configuration information, which is used to obtain container indication information corresponding to the containerized application encountering the exception. The target application is any containerized application in the current node.
[0132] The data acquisition module 520 is configured to execute, when an exception occurs in the target application, the current operating system generates target exception data corresponding to the target application based on preset kernel configuration information, and obtains target container indication information corresponding to the target application based on the container configuration information;
[0133] The abnormal data storage module 530 is configured to store the target abnormal data in a non-local first preset storage area;
[0134] The alarm processing module 540 is configured to perform alarm processing based on the target container indication information.
[0135] In an optional embodiment, the custom configuration information further includes compression configuration information, where the compression configuration information is used to compress abnormal data corresponding to the abnormal containerized application; and the above-mentioned apparatus further includes:
[0136] The parallel compression processing module is configured to execute the current operating system to perform multi-threaded parallel compression processing on the target abnormal data based on the compression configuration information to obtain the target compressed abnormal data;
[0137] The abnormal data storage module 530 is specifically configured to store the target compressed abnormal data in a first preset storage area.
[0138] In an optional embodiment, the custom configuration information further includes: writing configuration information, the writing configuration information being used to write compressed exception data corresponding to the containerized application program that has an exception into a local second preset storage area; and the above-mentioned apparatus further includes:
[0139] The abnormal data writing module is configured to execute the current operating system to write the target compressed abnormal data into the second preset storage area based on the write configuration information.
[0140] In an optional embodiment, the above device further includes:
[0141] a new addition detection module, configured to perform a new addition detection on the second preset storage area;
[0142] The abnormal data storage module 530 is specifically configured to store the target compressed abnormal data in the first preset storage area when newly added target compressed abnormal data is detected in the second preset storage area.
[0143] In an optional embodiment, the above device further includes:
[0144] an abnormal data analysis module configured to automatically trigger an abnormal data analysis task after executing an alarm processing based on the target container indication information, to obtain target abnormal data from a first preset storage area, and to analyze the target abnormal data to obtain an abnormality analysis result, wherein the abnormality analysis result is summary data in the target abnormal data for locating the abnormal location of the target application;
[0145] The abnormality analysis result sending module is configured to execute and send the abnormality analysis result to the management terminal corresponding to the target application.
[0146] In an optional embodiment, the above device further includes:
[0147] An anomaly detection alarm agent deployment module is configured to execute deployment of an anomaly detection alarm agent on the current node;
[0148] An anomaly detection alarm agent startup module is configured to execute startup of the anomaly detection alarm agent;
[0149] The kernel configuration modification module is specifically configured to execute, when the target application is started, the anomaly detection alarm agent automatically customizes the preset kernel configuration information corresponding to the current operating system to obtain the target kernel configuration information;
[0150] The abnormal data storage module 530 is specifically configured to execute the abnormality detection alarm agent to store the target abnormal data in a non-local first preset storage area;
[0151] The alarm processing module 540 is specifically configured to execute an anomaly detection alarm agent to perform alarm processing based on the target container indication information.
[0152] In an optional embodiment, the alarm processing module 540 includes:
[0153] The abnormal alarm instruction sending unit is configured to execute an abnormal alarm instruction including target container indication information to a preset alarm system, so that the alarm system sends an alarm message including target container indication information to a management terminal corresponding to the target application.
[0154] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0155] Figure 6 This is a block diagram of an electronic device for application exception handling provided by an embodiment of the present application. The electronic device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 6 As shown. The electronic device includes a processor, a memory, a network interface, a display screen and an input device connected via a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, an exception handling method for an application is implemented. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device can be a touch layer covering the display screen, or a button, trackball or touchpad provided on the housing of the electronic device, or an external keyboard, touchpad or mouse, etc.
[0156] Figure 7 This is a block diagram of another electronic device for application exception handling provided by an embodiment of the present application. The electronic device may be a server, and its internal structure diagram may be as shown in FIG. Figure 7As shown. The electronic device includes a processor, a memory, and a network interface connected via a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. 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 electronic 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 exception handling method for an application.
[0157] Those skilled in the art will understand that Figure 6 or Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present disclosure, and does not constitute a limitation on the electronic device to which the scheme of the present disclosure is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0158] In an exemplary embodiment, an electronic device is further provided, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the exception handling method of the application program in the embodiment of the present disclosure.
[0159] In an exemplary embodiment, a computer-readable storage medium is further provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the exception handling method for the application program in the embodiment of the present disclosure.
[0160] In an exemplary embodiment, a computer program product or computer program is also provided. The computer program product or computer program includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the application exception handling method provided in the various optional implementations described above.
[0161] It is understandable that in the specific implementation of this application, user-related data is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0162] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, which 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 can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0163] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the claims.
[0164] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for handling exceptions in an application, characterized in that: The method comprises: When a target application is started, custom modification is performed on preset kernel configuration information corresponding to the current operating system to obtain target kernel configuration information, wherein the target kernel configuration information includes the preset kernel configuration information and custom configuration information, and the preset kernel configuration information is used to generate corresponding exception data when an exception occurs in any containerized application running in the current operating system; the custom configuration information includes container configuration information, and the container configuration information is used to obtain container indication information corresponding to the containerized application that has an exception; the target application is any containerized application in the current node; In the event that an exception occurs in the target application, the current operating system generates target exception data corresponding to the target application based on the preset kernel configuration information, and obtains target container indication information corresponding to the target application based on the container configuration information; The target abnormal data is stored in a non-local first preset storage area, and an alarm process is performed based on the target container indication information.
2. The method according to claim 1, characterized in that The custom configuration information further includes compression configuration information, where the compression configuration information is used to compress abnormal data corresponding to the containerized application program that has an abnormality. The method further includes: The current operating system performs multi-threaded parallel compression processing on the target abnormal data based on the compression configuration information to obtain target compressed abnormal data; The storing the target abnormal data in a non-local first preset storage area includes: The target compression exception data is stored in the first preset storage area.
3. The method according to claim 2, characterized in that The custom configuration information further includes: writing configuration information, wherein the writing configuration information is used to write compressed exception data corresponding to the containerized application program that has an exception into a local second preset storage area; the method further includes: The current operating system writes the target compression exception data into the second preset storage area based on the write configuration information.
4. The method according to claim 3, characterized in that The method further comprises: performing a new addition detection on the second preset storage area; The storing the target compressed exception data in the first preset storage area includes: When it is detected that the target compression exception data is newly added in the second preset storage area, the target compression exception data is stored in the first preset storage area.
5. The method according to claim 1, wherein After performing alarm processing based on the target container indication information, the method further includes: Automatically triggering an abnormal data analysis task to obtain the target abnormal data from the first preset storage area, and analyzing the target abnormal data to obtain an abnormality analysis result, wherein the abnormality analysis result is summary data in the target abnormal data for locating the abnormal position of the target application; The abnormality analysis result is sent to the management terminal corresponding to the target application.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Deploy an anomaly detection alarm agent at the current node; Starting the anomaly detection alarm agent; When the target application is started, customizing and modifying the preset kernel configuration information corresponding to the current operating system to obtain the target kernel configuration information includes: When the target application is started, the anomaly detection alarm agent automatically customizes the preset kernel configuration information corresponding to the current operating system to obtain the target kernel configuration information; The storing the target abnormal data in a non-local first preset storage area and performing alarm processing based on the target container indication information includes: The anomaly detection alarm agent stores the target anomaly data in a non-local first preset storage area, and performs an alarm process based on the target container indication information.
7. The method according to any one of claims 1 to 5, characterized in that: The performing alarm processing based on the target container indication information includes: An abnormality alarm instruction including the target container indication information is sent to a preset alarm system, so that the alarm system sends an alarm message including the target container indication information to a management terminal corresponding to the target application.
8. An exception handling device for an application, characterized in that: The device comprises: A kernel configuration modification module is configured to, when a target application is started, perform custom modifications to preset kernel configuration information corresponding to the current operating system online to obtain target kernel configuration information, wherein the target kernel configuration information includes the preset kernel configuration information and custom configuration information. The preset kernel configuration information is used to generate corresponding exception data when an exception occurs in any containerized application running in the current operating system; the custom configuration information includes container configuration information, and the container configuration information is used to obtain container indication information corresponding to the containerized application that has an exception; the target application is any containerized application in the current node; a data acquisition module configured to execute, when an exception occurs in the target application, the current operating system generating target exception data corresponding to the target application based on the preset kernel configuration information, and acquiring target container indication information corresponding to the target application based on the container configuration information; An abnormal data storage module is configured to store the target abnormal data in a first non-local preset storage area; The alarm processing module is configured to perform alarm processing based on the target container indication information.
9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the exception handling method for the application program according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the exception handling method for an application program according to any one of claims 1 to 7.