CN114371949A - Application program exception handling method, device, equipment and storage medium - Google Patents

Application program exception handling method, device, equipment and storage medium Download PDF

Info

Publication number
CN114371949A
CN114371949A CN202011101982.5A CN202011101982A CN114371949A CN 114371949 A CN114371949 A CN 114371949A CN 202011101982 A CN202011101982 A CN 202011101982A CN 114371949 A CN114371949 A CN 114371949A
Authority
CN
China
Prior art keywords
exception
application program
target
thread
application
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011101982.5A
Other languages
Chinese (zh)
Inventor
刘渭宁
陈锦海
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202011101982.5A priority Critical patent/CN114371949A/en
Publication of CN114371949A publication Critical patent/CN114371949A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0793Remedial or corrective actions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system

Abstract

The application discloses a method, a device, equipment and a storage medium for processing application program exception, wherein the method comprises the following steps: monitoring the running state of the application program; when the application program runs abnormally, determining a system architecture layer corresponding to the abnormality; when the exception is located in an application layer, determining a category to which the exception belongs; determining an exception handling strategy according to the category of the exception; when the exception is positioned in the local framework layer, monitoring a signal in the exception through a signal processing function; when the exception includes a target signal, acquiring a current value of a target register; and adjusting the current value of the target register to a safe value so that the application program operates normally. By adopting the technical scheme, the method and the device adopt the graded recovery measures for the abnormity of the application program, reduce the flash back condition of the application program, and improve the running stability of the application program, thereby reducing the perception of the user to the abnormity and reducing the user loss of the application program.

Description

Application program exception handling method, device, equipment and storage medium
Technical Field
The present application relates to the field of mobile communications technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing an application exception.
Background
In the method, an application program (APP) needs to monitor whether an abnormality occurs at a user side in advance and collect and report abnormal information, but the user may refuse the APP to collect and report the abnormal information. And the process of making and issuing the patch is generally longer, and more people need to be involved. A certain time is required from the occurrence of flash back (blast) of the user side to the monitoring of a large number of blast triggering alarms of the user side; the patch needs to find a source code of a version on a corresponding line, and after the problem is located and repaired, an apk needs to be reconstructed, and differential processing (diff) is carried out on the apk and the apk of the existing network; after the patch package is manufactured, a tester is required to perform regression testing in a testing environment, and various machine types and ROM versions need to be regressed once and can be released to the existing network after passing; and the gray scale is released to the current network, the repairing effect is observed, the whole process is completed, and the time consumption is generally 2-3 hours. In addition, because it needs certain time to send the patch, probably show constantly Crash in user side, influence the user and normally use APP, can cause the user to run off even.
Therefore, it is necessary to provide a method, an apparatus, a device and a storage medium for processing an application exception, so as to take a hierarchical recovery measure for the exception of the application, thereby reducing the flash back situation of the application and improving the operation stability of the application.
Disclosure of Invention
The application provides a processing method, a device, equipment and a storage medium for application program exception, which can reduce the flash back condition of the application program and improve the running stability of the application program, thereby reducing the perception of the user to the exception and reducing the user loss of the application program.
In one aspect, the present application provides a method for processing an application exception, where the method includes:
monitoring the running state of the application program;
when the application program runs abnormally, determining a system architecture layer corresponding to the abnormality;
when the exception is located in an application layer, determining a category to which the exception belongs;
determining a processing strategy of the exception according to the category of the exception;
when the exception is positioned in a local framework layer, monitoring a signal in the exception through a signal processing function;
when the exception comprises a target signal, acquiring the current value of a target register;
and adjusting the current value of the target register to a safe value so as to enable the application program to run normally.
Another aspect provides an apparatus for processing an application exception, the apparatus comprising:
the state monitoring module is used for monitoring the running state of the application program;
the system architecture layer determining module is used for determining a system architecture layer corresponding to the abnormality when the application program operates abnormally;
the category determining module is used for determining the category to which the exception belongs when the exception is positioned in an application layer;
the processing strategy determining module is used for determining the processing strategy of the abnormity according to the category to which the abnormity belongs;
the signal monitoring module is used for monitoring a signal in the exception through a signal processing function when the exception is positioned in a local framework layer;
a current value acquisition module, configured to acquire a current value of a target register when the abnormality includes a target signal;
and the current value adjusting module is used for adjusting the current value of the target register to a safe value so as to ensure that the application program runs normally.
Another aspect provides an application exception handling device, which includes a processor and a memory, where at least one instruction or at least one program is stored in the memory, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the application exception handling method described above.
Another aspect provides a computer-readable storage medium storing at least one instruction or at least one program, which is loaded and executed by a processor to implement the method for processing application program exceptions as described above.
The application program exception handling method, device, equipment and storage medium have the following technical effects:
in the application, when an application program runs abnormally, a system architecture layer corresponding to the abnormality is determined, and different processing strategies are adopted for the abnormality at different layers; for the application layer exception, adopting a corresponding processing strategy according to the exception category; and for the local framework layer exception, the application program is recovered to be normal by modifying the current value of the register. By adopting the technical scheme, the method and the device adopt the graded recovery measures for the abnormity of the application program, reduce the flash back condition of the application program, and improve the running stability of the application program, thereby reducing the perception of the user to the abnormity and reducing the user loss of the application program.
Drawings
In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a schematic diagram of a system for handling application exceptions according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a method for processing an application exception according to an embodiment of the present application;
fig. 3 is a schematic flowchart of a method for listening to an Exception through a thread Exception Handler (incaught Handler for short) according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating a method for determining a handling policy of an exception according to a category to which the exception belongs according to an embodiment of the present application;
FIG. 5 is a flowchart illustrating an exception handling method according to an embodiment of the present application when an exception is located in an application layer and a category to which the exception belongs cannot be determined;
fig. 6 is a flowchart illustrating an exception handling method when a message handling class is not included in a target thread according to an embodiment of the present application;
FIG. 7 is a flowchart illustrating a method for obtaining a current value of a target register according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a blockchain system according to an embodiment of the present disclosure;
FIG. 9 is a block diagram according to an embodiment of the present disclosure;
FIG. 10 is a schematic structural diagram of an apparatus for processing an application exception according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or server that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Referring to fig. 1, fig. 1 is a schematic diagram of an application exception handling system according to an embodiment of the present disclosure, and as shown in fig. 1, the application exception handling system may include at least a server 01 and a client 02.
Specifically, in this embodiment of the present disclosure, the server 01 may include an independently operating server, or a distributed server, or a server cluster composed of a plurality of servers, and may also be a cloud server that provides basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a CDN (Content Delivery Network), and a big data and artificial intelligence platform. The server 01 may comprise a network communication unit, a processor, a memory, etc. Specifically, the server 01 may be configured to store exception information of an application program and an exception handling policy.
Specifically, in the embodiment of the present disclosure, the client 02 may include a type of physical device such as a smart phone, a desktop computer, a tablet computer, a notebook computer, a digital assistant, a smart wearable device, and a vehicle-mounted terminal, and may also include software running in the physical device, such as a web page provided by some service providers to a user, and an application provided by the service providers to the user. Specifically, the client 02 may be configured to determine an exception type of the application, and perform application exception handling.
The following describes a method for processing an application exception, and fig. 2 is a schematic flowchart of a method for processing an application exception according to an embodiment of the present application, where the present specification provides the method operation steps as described in the embodiment or the flowchart, but may include more or less operation steps based on conventional or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. In practice, the system or server product may be implemented in a sequential or parallel manner (e.g., parallel processor or multi-threaded environment) according to the embodiments or methods shown in the figures. Specifically, as shown in fig. 2, the method may include:
s201: the running state of the application program is monitored.
In the embodiment of the present specification, the application may be an application in a terminal, for example, the application may be a game application, a news application, a multimedia information application, or the like; the running state of the application program is monitored through the terminal, and the running state can comprise a normal running state and an abnormal running state.
S203: and when the application program runs abnormally, determining a system architecture layer corresponding to the abnormality.
In embodiments of the present specification, the system framework layer to which the exception corresponds may include an application layer and a local framework layer. In the Android system, the application layer may be a jvm (Java Virtual machine) layer, which refers to an Android (Android) application layer written by Java/Kotlin, and is generally a dex file, which is an executable file of the Android system and includes all operation instructions and runtime data of an application program; the local framework layer can be a Native layer; the Native layer refers to an Android dynamic link library compiled by c/c + +, and is generally a so file; the so file is a program function library under Linux, i.e. compiled code and data that can be used by other programs. In the running process of the application program, some abnormal conditions may be caused by factors such as insufficient memory, link errors and the like, and if the abnormal conditions are not processed, the application program cannot continue to run normally, and even the application program frequently flashes (blast) occurs. The flash back refers to a situation of sudden exit interruption occurring when an application program is opened or used, and is represented as that the application program pictures flash over and then return to the desktop. At this time, a corresponding exception handling policy may be determined according to a system framework layer corresponding to the exception condition. The technical scheme of the application is not only suitable for an android system, but also can be expanded to an iOS system and a windows system.
In the embodiment of the present specification, before the application program is formally put into use, a tester may perform test analysis on the application program, and may find some exceptions through a test, such as edge path exception, background configuration exception, interface data exception, Read-Only Memory (ROM) compatibility exception, and the like. But there still exists an exception that the tester does not find, i.e. an uncaptured exception, and the exception in the embodiment of the present specification refers to an uncaptured exception.
S205: when the anomaly is located at the application layer, a category to which the anomaly belongs is determined.
In the embodiment of the present specification, in the android system, the application layer may be a jvm (java Virtual machine) layer; the categories to which the exceptions belong may include out-of-memory exceptions, link error exceptions, or other serious exceptions loaded into the blacklist. In the android system, Exception can be monitored by registering thread.
In a specific embodiment, as shown in fig. 3, fig. 3 is a flowchart of a method for monitoring an Exception through a thread _ Uncaught Exception Handler (incaught Handler for short), which includes creating a process in an application program, calling an incaught Handler application program interface, monitoring the process by running the incaught Handler, determining whether the process in the application program is abnormal, if so, searching whether a capture block (catch block) corresponding to the abnormal process exists, determining that the Exception is not captured and destroying an Exception thread, and continuing to return to the step of calling the incaught Handler after the Exception thread is destroyed; and if the capture block corresponding to the abnormal process does not exist, returning to the step of running the Uncaught Handler. Calling the Uncaught Handler application program interface can kill abnormal processes in the application program, and can also send a popup message to the server to inform testers of specific flash crash information. The tester may be a developer of the application; the pop-up message may be sent in the form of a Toast box, which is a modeless pop-up that pops up a small message, typically used to display the result of an operation, or a change in application state, as a reminder or message feedback. For example, when the user sends a short message, the App pops up a Toast to prompt the user that a message has been sent.
S207: and determining the processing strategy of the exception according to the category of the exception.
In this embodiment of the present specification, different functions may be called to determine a processing policy to process the exception according to the category to which the exception belongs, so as to avoid the application program from being flashed back.
Specifically, in this embodiment of the present specification, as shown in fig. 4, the determining, according to the category to which the exception belongs, a processing policy of the exception may include:
s2071: and when the exception is insufficient memory, performing memory cache cleaning and ignoring the exception.
In the embodiment of the present specification, an Out of Memory (OMO) refers to that an internal storage space of an application program is insufficient, and at this time, memory cleaning needs to be performed to release a memory space; when memory cache cleaning is carried out, the memory cache cleaning of the picture library can be carried out; and if the exception is ignored, the application program cannot be flashed back, the current page is still displayed, and when the memory cache is cleaned up, the application program continues to normally run. In the android system, exceptions can be ignored by calling an Application Programming Interface (API) of the fine time out Exception.
S2073: and when the exception is a link error, closing the exception plug-in.
In this embodiment, the link Error may be a link Error, and for the wechat application, the link Error may be a link Error of a friend circle of wechat. At the moment, the corresponding plug-in of the friend circle can be closed, and the phenomenon that the WeChat application program is flashed back is avoided.
Specifically, in this embodiment of the present specification, when the exception is a link error, closing the exception plugin may include:
s20731: when the exception is a link error, determining exception stack information corresponding to the exception;
in this embodiment of the present specification, exception stack information corresponding to an exception may be determined through a Linkage Error application program interface.
S20733: determining an abnormal plug-in according to the abnormal stack information;
in this embodiment of the present specification, an exception plugin corresponding to an exception may be determined through relevant attribute information of an exception stack.
S20735: the abnormal plug-in is closed.
In this embodiment of the present specification, the exception in the application program may be eliminated by closing the exception plug-in, and the application program is prevented from being flashed back.
S2075: and when the abnormality is in the blacklist, restarting the application program and jumping to a target page, wherein the target page is a page before the application program is restarted.
In an embodiment of the present specification, the exception in the blacklist may be an exception defined by a tester; the exception type is generally a serious exception that cannot be handled by the system, for example, the exception in the blacklist may include an exception that cannot be found by the class, an exception that cannot be handled by the SD card, or an exception that cannot be handled by other systems. The target page is a page before the application is restarted, namely, a page where the user last stays before the application is restarted. For the exception, the application program needs to be restarted, and the page after the restart is the page which is stopped by the user before the restart, so that the application program corresponding to the user continues to browse the page which is stopped before, the browsing is not required to be started from the first page of the application program, and the browsing efficiency of the user is improved. In the embodiment of the present specification, a user refers to a user who is using an application program.
In this embodiment of the present specification, as shown in fig. 5, when the exception is located at the application layer and the category to which the exception belongs cannot be determined, the method may further include:
s2061: calling a system application program interface to determine a target thread corresponding to the abnormality;
in this embodiment of the present specification, the system application program interface may be a thread. Handlers are mainly used for the processing of asynchronous messages: when a message is sent, the message enters a message queue first, the function for sending the message returns immediately, and the other part takes out the messages one by one in the message queue and processes the message, namely the message sending and the message receiving are not synchronous processing. Such mechanisms are typically used to handle relatively time consuming operations.
S2063: judging whether the target thread comprises a message processing class or not;
in this embodiment of the present specification, the message processing class may be a Looper class; there is an important member variable Looper in the Handler, and a Message Queue (Message Queue) is maintained in the Looper, and when we use the Handler. post or send Message related methods, the Message is put in the Message Queue. Each thread will have its own Looper.
The Looper class in Android is a class used for encapsulating message loops and message queues, and is used for processing messages in Android threads. A handler can be thought of as a tool class that is used to insert a message into a message queue.
(1) The Looper class is used to open a message loop for a thread.
By default, the thread newly born in the android does not open a message loop. (except for the main thread, which the main thread system will automatically create a Looper object for, open a message loop.)
The Looper object deposits messages and events through a Message Queue. One thread can only have one Looper, corresponding to one Message Queue.
(2) Interaction with Looper is usually through a Handler object. The Handler can be regarded as an interface of the Looper, and is used for sending messages to the specified Looper and defining processing methods.
The Handler will bind to the Looper of the thread it was defined to be by default, e.g., the Handler is defined in the main thread, and it is the Looper binding to the main thread.
S2065: if the target thread comprises a message processing class, judging whether the target thread is a main thread;
specifically, in this embodiment of the present specification, when the target thread includes a message handling class Looper class, it is further determined whether the target thread is a main thread. The main thread is that when a program starts, a process is created by an Operating System (OS) and a thread is run immediately. Because it is executed at the beginning of the program, if a thread needs to be created again, the created thread is the child thread of this main thread. Each process has at least one main thread, which in Winform should be the thread that creates the GUI. The importance of the main thread is embodied in two aspects: 1. is a thread that spawns other child threads; 2. it must often be done last to perform, for example, various closing actions. Each thread has a unique identifier to distinguish the primary and secondary relationships among the threads.
Thread unique identifier: thread, current thread, managedthreadid; for example, both the UI interface and the Main function are Main threads. The "method body" or "delegate" contained by Thread is a child Thread. Delegation may include multiple method bodies, using this. Various methods may also be defined and placed inside Thread to perform. The method is a sub-thread.
In this embodiment, whether a target thread is a main thread may be determined by a first function; loop () may be a loop.
S2067: if the target thread is the main thread, closing the current page corresponding to the target thread;
in this embodiment of the present specification, when the target thread is a main thread, the current page corresponding to the target thread needs to be closed, so as to avoid the application program from being flashed back.
S2069: and if the target thread is a non-main thread, continuing to run the target thread.
In this embodiment, when the target thread is a non-main thread, the target thread may be a sub-thread, and when the target thread is a sub-thread, the exception may be ignored, and the target thread continues to be run.
Specifically, in this embodiment of the present specification, as shown in fig. 6, if the target thread does not include the message processing class, the method may further include:
s20661: judging whether the target thread is an abnormal thread;
in this embodiment, whether a target thread is an abnormal thread may be determined through a second function; run () may be the second function.
S20663: if the target thread is an abnormal thread, closing the abnormal thread;
in the embodiment of the present specification, by finding and closing the exception thread, the application program can be prevented from being flashed back.
S20665: and if the target thread is a non-abnormal thread, continuing to run the target thread.
S209: when the exception is located in the local framework layer, the signal in the exception is monitored through a signal processing function.
In the embodiment of the present specification, in the android system, the local framework layer may be a Native layer, where the signal processing function may be a signal function, and the signal in the anomaly may be listened for by registering the signal function.
S2011: when the target signal is included in the exception, the current value of the target register is acquired.
In this embodiment, the target signal may include sigsegv, sigabrt, and so on, and when the target signal is sensed, the current value of the target register is obtained.
In the embodiment of the present specification, as shown in fig. 7, when the target signal is included in the exception, acquiring the current value of the target register includes:
s20111: when the target signal is included in the abnormity, acquiring the abnormal context information;
in the embodiment of the present specification, the context information (context) of the exception may include values and state information of respective registers.
S20113: and acquiring the current value of the target register according to the abnormal context information.
In this specification embodiment, the current value of the target register may be determined by context. The destination register may include a PC register and an SP register; the PC register is responsible for storing a memory address, the address refers to a next instruction to be executed, and the value of the PC register can be automatically updated to the address of the next instruction after the next instruction is explained and executed; the PC is a 16-bit Program Counter (Program Counter) that does not fall into the special function register category and the programmer does not access the PC as it does to special function registers. The SP (Stack pointer) register refers to a stack pointer register that indicates the top address of the stack.
S2013: and adjusting the current value of the target register to a safe value so that the application program operates normally.
In this embodiment of the present specification, when an exception occurs, the current value of the target register is an exception value, the value of the target register may be modified to a safe value, and the exception method may be bypassed, and another method is adopted to continue executing the current flow of the application program, thereby ensuring that the application program operates normally.
Specifically, in this embodiment of the present specification, before the step of adjusting the current value of the target register to a safe value so that the application program operates normally, the method may further include:
and backtracking the abnormal call stack through the abnormal context information.
Specifically, in the embodiment of the present specification, the abnormal context information, that is, the stack frame of the signal processing function records the address of the current stack, the value of the register, and the address of the return value (ret) of the function, and the call stack can be traced back through the information, which is the principle of the back trace.
In the embodiment of the present specification, a Call stack (Call stack), which is simply referred to as "stack" (the stack), is referred to as: an execution stack (execution stack), a control stack (control stack), a run-time stack (run-time stack), and a machine stack (machine stack) are stacks in computer science that store messages about running subroutines. Sometimes referred to as a "stack" only, but not necessarily storing only subroutine messages in the stack. Almost all computer programs rely on a call stack, however high-level languages typically hide the details of the call stack to the background.
The call stack is most often used to deposit the return address of the subroutine. When any subprogram is called, the main program must temporarily store the address to which the subprogram should be returned after the subprogram is completely run. Therefore, if the called subroutine calls another subroutine, its own return address must be stored in the call stack and retrieved after it has been run. In a recursive program, each level of recursion must add an address to the call stack, so if the program appears to recurse indefinitely (or only a plethora of recursive levels), the call stack will produce stack overflow.
The main function of the call stack is to deposit the return address. In addition, the call stack is also used to deposit:
local variables: the variables of the subprogram can be stored in the call stack, so that the function of separating the variables among different subprograms can be achieved.
Parameter transfer: if the registers are not sufficient to hold the parameters of the subroutine, the parameters may be stored on the call stack.
Environment transfer: some languages (e.g., Pascal and Ada) support "multi-level subroutines," i.e., subroutines that utilize local variables of the main program. These variables may be passed into the subroutine through the call stack.
In this embodiment, adjusting the current value of the target register to a safe value to enable the application program to normally run includes:
and adjusting the value of the target register to a safe value through a call stack so as to ensure that the application program runs normally.
In this embodiment of the present specification, the value of the target register may be modified through a call stack, for example, the values of the PC register and the SP register may be modified to be within a safe range of each register through the call stack, so as to avoid the application program from being flashed back.
In the embodiment of the specification, when an abnormality occurs, modes such as automatic retry, neglect and the like are adopted for the non-serious abnormality, so that the user perception is reduced; aiming at serious abnormity, the page where the user stays last can be automatically restarted, and the user is prevented from being disturbed by popup; because of the adoption of the graded recovery measures, the perception of the user to the abnormity is greatly reduced, the use experience of the main path is ensured, more time is strived for sending the patch package (patch), the stability of the application program is improved, and the complaint of the user is reduced.
In this embodiment, when the application program runs abnormally and returns to normal running, the method further includes:
and sending a prompt message to the server, wherein the prompt message comprises the exception information of the application program and the exception handling strategy.
In this embodiment of the present description, after exception handling of an application program is completed, a prompt message may be sent to a backend server corresponding to the application program, so that the server stores exception information of the application program and an exception handling policy.
Specifically, in an embodiment of this specification, the method may further include:
the server stores the exception information of the application program and an exception handling strategy based on a blockchain system, wherein the blockchain system comprises a plurality of nodes, and a point-to-point network is formed among the nodes.
In some embodiments, the blockchain system may be the structure shown in fig. 8, a Peer-To-Peer (P2P) network is formed among a plurality of nodes, and the P2P Protocol is an application layer Protocol operating on top of a Transmission Control Protocol (TCP). In the blockchain system, any machine such as a server and a terminal can be added to become a node, and the node comprises a hardware layer, a middle layer, an operating system layer and an application layer.
The functions of each node in the blockchain system shown in fig. 8 include:
1) routing, a basic function that a node has, is used to support communication between nodes.
Besides the routing function, the node may also have the following functions:
2) the application is used for being deployed in a block chain, realizing specific services according to actual service requirements, recording data related to the realization functions to form recording data, carrying a digital signature in the recording data to represent a source of task data, and sending the recording data to other nodes in the block chain system, so that the other nodes add the recording data to a temporary block when the source and integrity of the recording data are verified successfully.
3) And the Block chain comprises a series of blocks (blocks) which are mutually connected according to the generated chronological order, new blocks cannot be removed once being added into the Block chain, and recorded data submitted by nodes in the Block chain system are recorded in the blocks.
In some embodiments, the Block Structure (Block Structure) may be the Structure shown in fig. 9, where each Block includes a hash value of the Block storing the transaction record (hash value of the Block) and a hash value of a previous Block, and the blocks are connected by the hash values to form a Block chain. The block may include information such as a time stamp at the time of block generation. A Block chain (Block chain), which is essentially a decentralized database, is a series of data blocks associated by using cryptography, and each data Block contains related information for verifying the validity (anti-counterfeiting) of the information and generating a next Block.
As can be seen from the technical solutions provided in the embodiments of the present specification, when an application program runs abnormally, a system architecture layer corresponding to the abnormality is determined, and different processing strategies are adopted for the abnormalities located in different layers; for the application layer exception, adopting a corresponding processing strategy according to the exception category; and for the local framework layer exception, the application program is recovered to be normal by modifying the current value of the register. By adopting the technical scheme, the method and the device adopt the graded recovery measures for the abnormity of the application program, reduce the flash back condition of the application program, and improve the running stability of the application program, thereby reducing the perception of the user to the abnormity and reducing the user loss of the application program.
An embodiment of the present application further provides a device for processing an application exception, as shown in fig. 10, the device includes:
a state monitoring module 1010, configured to monitor an operating state of the application;
a system architecture layer determining module 1020, configured to determine, when the application program runs abnormally, a system architecture layer corresponding to the abnormality;
a category determining module 1030, configured to determine, when the exception is located in the application layer, a category to which the exception belongs;
the processing policy determining module 1040 is configured to determine, according to the category to which the exception belongs, a processing policy of the exception;
the signal monitoring module 1050 is configured to monitor a signal in the exception through a signal processing function when the exception is located in the local framework layer;
a current value acquisition module 1060, configured to acquire a current value of the target register when the target signal is included in the exception;
and the current value adjusting module 1070 is configured to adjust the current value of the target register to a safe value, so that the application program operates normally.
In some embodiments, the processing policy determination module may include:
the first processing module is used for performing memory cache cleaning and ignoring the exception when the exception is insufficient memory;
the second processing module is used for closing the exception plug-in when the exception is a link error;
and the third processing module is used for restarting the application program and jumping to a target page when the abnormality is in the blacklist, wherein the target page is a page before the application program is restarted.
In some embodiments, the second processing module may include:
an exception stack information determining unit, configured to determine, when the exception is a link error, exception stack information corresponding to the exception;
the abnormal plug-in determining unit is used for determining the abnormal plug-in according to the abnormal stack information;
and the abnormal plug-in closing unit is used for closing the abnormal plug-in.
In some embodiments, when the exception is at an application layer and the category to which the exception belongs cannot be determined, the apparatus may further include:
the target thread determining module is used for calling a system application program interface to determine a target thread corresponding to the abnormality;
the first judgment module is used for judging whether the target thread comprises a message processing class or not;
the second judgment module is used for judging whether the target thread is a main thread or not if the target thread comprises a message processing class;
a current page closing module, configured to close a current page corresponding to the target thread if the target thread is a main thread;
and the first target thread running module is used for continuously running the target thread if the target thread is a non-main thread.
In some embodiments, if the target thread does not include a message handling class, the apparatus may further include:
the abnormal thread judging module is used for judging whether the target thread is an abnormal thread;
an abnormal thread closing module, configured to close the abnormal thread if the target thread is an abnormal thread;
and the second target thread running module is used for continuing running the target thread if the target thread is a non-abnormal thread.
In some embodiments, the current value acquisition module may include:
a context information acquiring unit configured to acquire context information of the abnormality when the abnormality includes a target signal;
and the current value acquisition unit is used for acquiring the current value of the target register according to the abnormal context information.
In some embodiments, the apparatus may further comprise:
and the call stack backtracking module is used for backtracking the abnormal call stack through the abnormal context information.
In some embodiments, the current value adjustment module may include:
and the current value adjusting unit is used for adjusting the value of the target register to be a safe value through the call stack so as to enable the application program to normally run.
The device and method embodiments in the device embodiment are based on the same inventive concept.
The embodiment of the application provides an application exception handling device, which comprises a processor and a memory, wherein at least one instruction or at least one program is stored in the memory, and the at least one instruction or the at least one program is loaded and executed by the processor to realize the application exception handling method provided by the above method embodiment.
Embodiments of the present application further provide a computer-readable storage medium, which may be disposed in a terminal to store at least one instruction or at least one program for implementing a method for handling an application exception in the method embodiments, where the at least one instruction or the at least one program is loaded and executed by the processor to implement the method for handling an application exception provided in the method embodiments.
Alternatively, in the present specification embodiment, the storage medium may be located at least one network server among a plurality of network servers of a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The memory of the embodiments of the present disclosure may be used to store software programs and modules, and the processor may execute various functional applications and data processing by operating the software programs and modules stored in the memory. The memory can mainly comprise a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs needed by functions and the like; the storage data area may store data created according to use of the device, and the like. Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory may also include a memory controller to provide the processor access to the memory.
The embodiment of the method for processing the application program exception provided by the embodiment of the application program can be executed in a mobile terminal, a computer terminal, a server or a similar operation device. Taking an example of the application running on a server, fig. 11 is a hardware structure block diagram of the server according to the method for processing an application exception provided in the embodiment of the present application. As shown in fig. 11, the server 1100 may have a relatively large difference due to different configurations or performances, and may include one or more Central Processing Units (CPUs) 1110 (the processors 1110 may include but are not limited to Processing devices such as a microprocessor MCU or a programmable logic device FPGA), a memory 1130 for storing data, and one or more storage media 1120 (e.g., one or more mass storage devices) for storing applications 1123 or data 1122. The memory 1130 and the storage medium 1120 may be, among other things, transient storage or persistent storage. The program stored in the storage medium 1120 may include one or more modules, each of which may include a series of instruction operations for a server. Still further, the central processor 1110 may be configured to communicate with the storage medium 1120, and execute a series of instruction operations in the storage medium 1120 on the server 1100. The server 1100 may also include one or more power supplies 1160, one or more wired or wireless network interfaces 1150, one or more input-output interfaces 1140, and/or one or more operating systems 1121, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
The input output interface 1140 may be used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the server 1100. In one example, i/o Interface 1140 includes a Network adapter (NIC) that may be coupled to other Network devices via a base station to communicate with the internet. In one example, the input/output interface 1140 can be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
It will be understood by those skilled in the art that the structure shown in fig. 11 is only an illustration and is not intended to limit the structure of the electronic device. For example, server 1100 may also include more or fewer components than shown in FIG. 11, or have a different configuration than shown in FIG. 11.
A computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the method provided in the various alternative implementations described above.
As can be seen from the above embodiments of the processing method, apparatus, device or storage medium for application program exception provided by the present application, in the present application, when an application program runs abnormally, a system architecture layer corresponding to the exception is determined, and different processing strategies are adopted for the exceptions located in different layers; for the application layer exception, adopting a corresponding processing strategy according to the exception category; and for the local framework layer exception, the application program is recovered to be normal by modifying the current value of the register. By adopting the technical scheme, the method and the device adopt the graded recovery measures for the abnormity of the application program, reduce the flash back condition of the application program, and improve the running stability of the application program, thereby reducing the perception of the user to the abnormity and reducing the user loss of the application program.
It should be noted that: the sequence of the embodiments of the present application is only for description, and does not represent the advantages and disadvantages of the embodiments. And specific embodiments thereof have been described above. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus, device, and storage medium embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference may be made to some descriptions of the method embodiments for relevant points.
It will be understood by those skilled in the art that all or part of the steps of implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, and the program may be stored in a computer storage medium, and the above storage medium may be a read-only memory, a magnetic disk, an optical disk, or the like.
The present invention is not intended to be limited to the particular embodiments shown and described, but is to be accorded the widest scope consistent with the principles and novel features herein disclosed.

Claims (10)

1. A method for handling application exceptions, the method comprising:
monitoring the running state of the application program;
when the application program runs abnormally, determining a system architecture layer corresponding to the abnormality;
when the exception is located in an application layer, determining a category to which the exception belongs;
determining a processing strategy of the exception according to the category of the exception;
when the exception is positioned in a local framework layer, monitoring a signal in the exception through a signal processing function;
when the exception comprises a target signal, acquiring the current value of a target register;
and adjusting the current value of the target register to a safe value so as to enable the application program to run normally.
2. The method of claim 1, wherein determining a handling policy for the exception based on the class to which the exception belongs comprises:
when the exception is insufficient memory, memory cache cleaning is carried out and the exception is ignored;
when the exception is a link error, closing the exception plug-in;
and when the abnormality is in the blacklist, restarting the application program and jumping to a target page, wherein the target page is a page before the application program is restarted.
3. The method of claim 2, wherein closing an exception plug-in when the exception is a link error comprises:
when the exception is a link error, determining exception stack information corresponding to the exception;
determining an abnormal plug-in according to the abnormal stack information;
and closing the abnormal plug-in.
4. The method of claim 1, wherein when the anomaly is at an application layer and the class to which the anomaly belongs cannot be determined, the method further comprises:
calling a system application program interface to determine a target thread corresponding to the abnormality;
judging whether the target thread comprises a message processing class or not;
if the target thread comprises a message processing class, judging whether the target thread is a main thread;
if the target thread is a main thread, closing a current page corresponding to the target thread;
and if the target thread is a non-main thread, continuing to run the target thread.
5. The method of claim 4, wherein if the target thread does not include a message handling class, the method further comprises:
judging whether the target thread is an abnormal thread;
if the target thread is an abnormal thread, closing the abnormal thread;
and if the target thread is a non-abnormal thread, continuing to run the target thread.
6. The method of claim 1, wherein obtaining a current value of a target register when a target signal is included in the exception comprises:
when the abnormality comprises a target signal, acquiring context information of the abnormality;
and acquiring the current value of the target register according to the abnormal context information.
7. The method of claim 1, wherein prior to the step of adjusting the current value of the target register to a safe value for the application to function properly, the method further comprises:
backtracking the abnormal call stack through the abnormal context information;
the adjusting the current value of the target register to a safe value so that the application program runs normally comprises:
and adjusting the value of the target register to a safe value through the call stack so as to ensure that the application program operates normally.
8. An apparatus for processing application exceptions, the apparatus comprising:
the state monitoring module is used for monitoring the running state of the application program;
the system architecture layer determining module is used for determining a system architecture layer corresponding to the abnormality when the application program operates abnormally;
the category determining module is used for determining the category to which the exception belongs when the exception is positioned in an application layer;
the processing strategy determining module is used for determining the processing strategy of the abnormity according to the category to which the abnormity belongs;
the signal monitoring module is used for monitoring a signal in the exception through a signal processing function when the exception is positioned in a local framework layer;
a current value acquisition module, configured to acquire a current value of a target register when the abnormality includes a target signal;
and the current value adjusting module is used for adjusting the current value of the target register to a safe value so as to ensure that the application program runs normally.
9. An application exception handling apparatus comprising a processor and a memory, wherein at least one instruction or at least one program is stored in the memory, and wherein the at least one instruction or the at least one program is loaded and executed by the processor to implement the method of handling an application exception as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, in which at least one instruction or at least one program is stored, the at least one instruction or the at least one program being loaded and executed by a processor to implement the method for processing application program exceptions according to any one of claims 1-7.
CN202011101982.5A 2020-10-15 2020-10-15 Application program exception handling method, device, equipment and storage medium Pending CN114371949A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011101982.5A CN114371949A (en) 2020-10-15 2020-10-15 Application program exception handling method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011101982.5A CN114371949A (en) 2020-10-15 2020-10-15 Application program exception handling method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114371949A true CN114371949A (en) 2022-04-19

Family

ID=81138601

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011101982.5A Pending CN114371949A (en) 2020-10-15 2020-10-15 Application program exception handling method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114371949A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114996098A (en) * 2022-06-24 2022-09-02 中电金信软件有限公司 Exception handling method and device
CN117234698A (en) * 2023-11-16 2023-12-15 荣耀终端有限公司 Program exception handling method, electronic equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114996098A (en) * 2022-06-24 2022-09-02 中电金信软件有限公司 Exception handling method and device
CN114996098B (en) * 2022-06-24 2024-04-09 中电金信软件有限公司 Exception handling method and device
CN117234698A (en) * 2023-11-16 2023-12-15 荣耀终端有限公司 Program exception handling method, electronic equipment and storage medium
CN117234698B (en) * 2023-11-16 2024-04-26 荣耀终端有限公司 Program exception handling method, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN106844136B (en) Method and system for collecting program crash information
US7908521B2 (en) Process reflection
CN111124906B (en) Tracking method, compiling method and device based on dynamic embedded points and electronic equipment
Hanappi et al. Asserting reliable convergence for configuration management scripts
US20050120273A1 (en) Automatic root cause analysis and diagnostics engine
CN109408393B (en) Application testing method, device and equipment and computer readable storage medium
US20130047036A1 (en) Self validating applications
US20200034282A1 (en) Object-oriented regression-candidate filter
CN114371949A (en) Application program exception handling method, device, equipment and storage medium
US10795793B1 (en) Method and system for simulating system failures using domain-specific language constructs
US11321078B2 (en) Continuous in-place software updates with fault isolation and resiliency
CN107357731A (en) Process produces monitoring, analysis and the processing method of core dump problems
CN112099880B (en) Method and system for reducing application program driven by scene
CN114721809A (en) Application deployment method and device of kubernets cluster
US11151020B1 (en) Method and system for managing deployment of software application components in a continuous development pipeline
Stuardo et al. {ScaleCheck}: A {Single-Machine} Approach for Discovering Scalability Bugs in Large Distributed Systems
CN112540808B (en) Recording method of program behavior hierarchy call relationship and related equipment
CN111859399A (en) Vulnerability detection method and device based on oval
CN104484176B (en) A kind of Android system window object acquisition methods and device
CN110162477B (en) Automatic abnormal debugging system and method for third-party library version upgrading
US20200117482A1 (en) Dynamic loading of a java agent into a running process through direct process memory manipulation
US11630714B2 (en) Automated crash recovery
CN115617668A (en) Compatibility testing method, device and equipment
CN114253587A (en) Application program updating method and device, electronic equipment and readable storage medium
CN108228208A (en) A kind of dynamic updating method and device of JAVA application programs

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination