CN113806118A - Self-repairing method, device and equipment for application program and storage medium - Google Patents

Self-repairing method, device and equipment for application program and storage medium Download PDF

Info

Publication number
CN113806118A
CN113806118A CN202010544714.4A CN202010544714A CN113806118A CN 113806118 A CN113806118 A CN 113806118A CN 202010544714 A CN202010544714 A CN 202010544714A CN 113806118 A CN113806118 A CN 113806118A
Authority
CN
China
Prior art keywords
abnormal
end component
file
information
self
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
CN202010544714.4A
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 CN202010544714.4A priority Critical patent/CN113806118A/en
Publication of CN113806118A publication Critical patent/CN113806118A/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
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/656Updates while running

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a self-repairing method, a self-repairing device, an application self-repairing equipment and a storage medium, wherein the method comprises the steps of acquiring abnormal information generated by a front end component, wherein the abnormal information comprises abnormal type information and abnormal position information; reading a target file pointed by the abnormal position information; obtaining a corresponding syntax analysis matcher according to the abnormal type information; analyzing the target file based on the syntax analysis matcher and the abnormal position information to obtain a target abnormal code segment; repairing the target abnormal code segment according to the abnormal type information to obtain a patch file; and repairing the front-end component based on the patch file. The invention can automatically carry out abnormity positioning and abnormity correction on the front-end component, carry out front-end component repair in the form of a patch file, do not need manual participation, can be implemented fully automatically, do not forcibly need interaction with a server, can obviously improve the repair speed, and reduce the labor cost and the communication cost.

Description

Self-repairing method, device and equipment for application program and storage medium
Technical Field
The present invention relates to the field of application program repair, and in particular, to a self-repairing method, apparatus, device and storage medium for an application program.
Background
The hybrid development mode becomes a mainstream mode of application development in the smart terminal market, and compared with the traditional native development and page development, the hybrid development mode can support a hot update technology to repair the application, so that the repair speed of the application is remarkably improved.
However, if the application program is abnormal, even if the hot update technology is used, technicians are required to participate in defect location and code repair, then a patch package is generated and is issued to the intelligent terminal to repair the application program, a large time delay is generated in the process, the dependence degree on the technicians is high, the requirement on network resources is high, and the repair cannot be performed in an off-line state. Moreover, the hot update technology is limited to the publisher of the operating system to some extent, and it is difficult to freely implement fully autonomous hot update.
Disclosure of Invention
The embodiment of the invention discloses a self-repairing method, a self-repairing device, an application program self-repairing device and a self-repairing storage medium for solving the technical problem.
In one aspect, the present invention provides a method of self-healing of an application, the application including a front-end component and a native-end component, the method applied to the native-end component, the method comprising:
if the operation of the front-end component is abnormal, acquiring abnormal information generated by the front-end component, wherein the abnormal information comprises abnormal type information and abnormal position information;
if a self-repairing mechanism is started to repair the abnormity, reading a target file pointed by the abnormal position information;
obtaining a corresponding syntax analysis matcher according to the abnormal type information;
analyzing the target file based on the syntax analysis matcher and the abnormal position information to obtain a target abnormal code segment;
repairing the target abnormal code segment according to the abnormal type information to obtain a patch file;
and repairing the front-end component based on the patch file.
In another aspect, the present invention provides an apparatus for self-healing of an application, the application including a front-end component and a native-end component, the apparatus comprising:
the abnormal information capturing module is used for acquiring abnormal information generated by the front-end component, wherein the abnormal information comprises abnormal type information and abnormal position information;
the target file reading module is used for reading the target file pointed by the abnormal position information if a self-repairing mechanism is started to repair the abnormality;
a syntax analysis matcher obtaining module, configured to obtain a corresponding syntax analysis matcher according to the abnormal type information;
the target abnormal code segment positioning module is used for analyzing the target file based on the syntax analysis matcher and the abnormal position information to obtain a target abnormal code segment;
the patch file generation module is used for repairing the target abnormal code segment according to the abnormal type information to obtain a patch file;
and the repairing module is used for repairing the front-end component based on the patch file.
In another aspect, the present invention provides a computer-readable storage medium, wherein at least one instruction or at least one program is stored in the computer-readable storage medium, and the at least one instruction or the at least one program is loaded and executed by a processor to implement one of the above-mentioned self-healing methods for an application.
In another aspect, the present invention provides an apparatus for self-healing of applications, which includes a processor and a memory, wherein the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded by the processor and executes one of the methods for self-healing of applications.
The invention provides a self-repairing method, a self-repairing device, self-repairing equipment and a self-repairing storage medium for an application program. When the front-end component of the application program is abnormal, the native-end component of the application program can automatically perform abnormal positioning and abnormal correction on the front-end component, and repair the front-end component in the form of a patch file.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions and advantages of 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 invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow chart of a self-healing method for an application according to the present invention;
FIG. 2 is a schematic diagram of a hybrid development mode architecture provided by the present invention;
FIG. 3 is a flow chart of the present invention for obtaining exception information generated by the front-end component;
FIG. 4 is a flow chart of the self-healing mechanism start-up determination provided by the present invention;
fig. 5 is a flowchart of analyzing the target file based on the syntax analysis matcher and the abnormal location information to obtain a target abnormal code segment according to the present invention;
FIG. 6 is a first matching flow diagram provided by the present invention;
FIG. 7 is a flowchart illustrating repairing the target abnormal code segment according to the abnormal type information to obtain a patch file according to the present invention;
FIG. 8 is a flow diagram of the front-end component repair based on the patch file provided by the present invention;
FIG. 9 is a flow chart of a boot failure process provided by the present invention;
FIG. 10 is a schematic diagram of a prior art hot-update product interface provided by the present invention;
FIG. 11 is a schematic diagram of a product interface according to an embodiment of the present invention;
FIG. 12 is a block diagram of an apparatus for self-healing an application according to the present invention;
fig. 13 is a hardware structural diagram of an apparatus for implementing the method provided by the embodiment of the invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention 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 invention 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.
In order to make the objects, technical solutions and advantages disclosed in the embodiments of the present invention more clearly apparent, the embodiments of the present invention are described in further detail below with reference to the accompanying drawings and the embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the embodiments of the invention and are not intended to limit the embodiments of the invention.
In the following, the terms "first", "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present embodiment, "a plurality" means two or more unless otherwise specified. In order to facilitate the explanation of the embodiments of the present invention, first, technical terms related to the embodiments of the present invention are explained:
mixed development: for the application program running in the intelligent terminal, there are three development modes, namely, native development, HTML5 development and hybrid development. The native development is performed on an intelligent operating system (Android, iOS) by using a development language, a development class library, and a development tool provided by an official party. Native development cannot cross platforms and can only be applied to corresponding operating systems. The HTML5 development is a development using page technology, which can be cross-platform, but has a great limitation in function and cannot interact with hardware resources of the intelligent terminal. The hybrid development is a development mode which integrates the native development and the HTML5 development and can achieve the effect of making up for the deficiencies, is generally composed of two parts, namely page front-end development and client development, and has the remarkable advantages of multiple functions and high iteration speed.
Hot updating: the method is a common updating mode in a hybrid development mode, and after an application program is installed to an intelligent terminal, if the application program is opened, a patch file can be obtained through interaction with a server, and immediate updating is carried out. The code is dynamically issued by hot update, so that a developer can repair defects and release functions without releasing a new version, and the developer can bypass an auditing mechanism of apple, avoid long-time auditing waiting and reduce cost caused by multiple refusals.
The intelligent terminal: the system is also called a mobile intelligent terminal, and is equipment with rich man-machine interaction modes, internet access capability, various intelligent operating systems and strong processing capability. The mobile intelligent terminal comprises an intelligent mobile phone, a tablet personal computer, a vehicle-mounted terminal, a handheld game host and the like. The smart operating system includes, but is not limited to, an Android operating system and an iOS operating system.
JIT: dynamic compilation (dynamic compilation) translates into "compiling at runtime" when a piece of code is about to be executed for the first time, which may also be referred to as "just-in-time compilation". JIT compilation may also be considered a special case of dynamic compilation in some scenarios.
ReactNative: an open source, cross-platform mobile application development framework.
Weex: is a framework for developing high performance native applications using a page development experience.
JSbridge: the communication interface which can enable the front end part in the hybrid development to conveniently use the native function is a bridge between the native component and the non-native component, the core of the communication interface is to construct a channel for message communication between the native component and the non-native component, and the channel for the communication is bidirectional.
Bundle: the application resource package is newly introduced by the Google official, the size of the package body can be effectively reduced, and the starting speed is improved.
The embodiment of the invention provides an application program self-repairing method, which can enable an application program to automatically repair the defects of the application program in the running process of an intelligent terminal, reduce the dependence on technical personnel and network resources, remarkably improve the repairing efficiency and shorten the repairing time.
An embodiment of the present invention provides a self-repairing method for an application, where the application includes a front-end component and a native-end component, and the method is applied to the native-end component, and as shown in fig. 1, the method includes:
s101, if the operation of the front end component is abnormal, acquiring abnormal information generated by the front end component, wherein the abnormal information comprises abnormal type information and abnormal position information.
As shown in fig. 2, the hybrid development mode is composed of a front-end page development part and a client development part, the front-end page development part obtains a front-end component, the client development part obtains a native-end component, and the front-end component and the native-end component interactively implement the running of the application program on the intelligent terminal. The front-end component can be dynamically compiled and then executed on the intelligent terminal, and the front-end component can be a cross-platform component generally, and is written by using a cross-platform language based on a cross-platform framework, for example, the front-end component can be constructed based on a ReactNative framework or a Weex framework. The native end component runs on the client side, which may be a component running on the Android side or a component running on the iOS side.
Specifically, the abnormality type information is used to indicate the type of abnormality. In fact, as can be seen from the analysis of the scenario where the crash occurs during the running of the application, the cause of the crash of the application can be classified into a limited number, for example, the crash caused by the boundary problem and the crash caused by the non-normative code. These crash reasons can be captured by the front-end component when the application crashes, thereby generating exception type information.
In one embodiment, the exception location information includes an error file name and an error location, and the error location may be characterized by a row and column number in the error file.
In another embodiment, the exception information may further include additional error information, the additional error information may be used to record other information related to the exception, the additional error information may be an option, and the content of the additional error information may be configured based on the first preset template.
In one embodiment, exception information may be generated by the front-end component based on the exception, the exception information being sent to a native-end component based on a bidirectional communication channel. In particular, the bi-directional communication channel may be JSBridge.
In another embodiment, the obtaining exception information generated by the front-end component, as shown in fig. 3, includes:
s1011, setting a monitoring thread.
S1013, capturing exception information based on the monitoring thread, wherein the exception information is generated and thrown out by the front-end component based on the exception.
S103, if a self-repairing mechanism is started to repair the abnormity, reading a target file pointed by the abnormal position information.
In one embodiment, the self-healing mechanism may be selectively triggered, when the self-healing mechanism is configured to be turned on, the application self-healing method according to the embodiment of the present invention may be executed to heal the exception based on the self-healing mechanism, and if the self-healing mechanism is configured to be turned off, the exception is not healed based on the self-healing mechanism. In an alternative embodiment, the exception information may be uploaded to a server by the native-side component when the self-healing mechanism is configured to shut down, to facilitate the server in healing the application based on a hot-update method.
In another embodiment, the exception type may also be selectively set, only a limited number of exception types may be set to support self-healing, and only the exception types set to support self-healing may be healed based on the application self-healing method of the embodiment of the present invention.
In one embodiment, the selective triggering of the self-healing mechanism may be configured in a second preset template, the exception type may be configured in a third preset template, and the second preset template, the third preset template, and the first preset template may be merged. The first preset template, the second preset template and the third preset template can be recorded in a configuration table form, the configuration table can be issued by a server and stored locally in the intelligent terminal, the configuration table can be organized based on a Map form, and the Map can be understood as a dictionary data structure.
Specifically, before step S103, as shown in fig. 4, the method further includes:
s1, judging whether a self-repairing mechanism is started or not in a second preset template;
s3, if yes, judging whether the abnormal type pointed by the abnormal type information is configured to support self-repairing in a third preset template;
and S5, if yes, judging to start a self-repairing mechanism to repair the abnormity.
And if the abnormal condition is judged not to be repaired by starting a self-repairing mechanism, the original end component uploads the abnormal information to a server so that the server can repair the application program based on a hot updating method.
In one embodiment, the reading the target file pointed to by the abnormal position information includes:
and S10, finding out the target file with the exception in the resource directory according to the exception position information.
And S30, performing file stream reading operation on the target file, and loading the target file in a memory.
In one embodiment, the front-end component-related resources may be organized via Bundle, and the target file and subsequent patch files may be organized based on Bundle form.
And S105, obtaining a corresponding syntax analysis matcher according to the abnormal type information.
In the embodiment of the invention, adaptive grammar analysis matchers can be configured for different abnormal types, and if the abnormal type is abnormal boundary overflow, the grammar analysis matchers for analyzing the boundary problem are obtained; and if the abnormal type is abnormal without code specification, obtaining a syntax analysis matcher for analyzing the code specification.
And S107, analyzing the target file based on the syntax analysis matcher and the abnormal position information to obtain a target abnormal code segment.
Specifically, the analyzing the target file based on the syntax analysis matcher and the abnormal location information to obtain a target abnormal code segment, as shown in fig. 5, includes:
s1071, determining an analyzed starting position according to the abnormal position information.
Specifically, the starting position may be a position pointed to by a row and column number in the abnormal position information.
S1073, calling the grammar analysis matcher, carrying out first matching forwards by taking the initial position as a starting point, and carrying out second matching backwards.
Specifically, the first matching and the second matching may be executed sequentially or simultaneously, and the execution order is not limited in the embodiment of the present invention.
Specifically, the matching methods of the first matching and the second matching are the same, except for the matching direction, the first matching is used for parsing the code located before the start position, and the second matching is used for parsing the code located after the start position.
Specifically, the first matching is as shown in fig. 6, and includes:
s10731, obtaining the matching step length according to the grammar analysis matcher.
For different syntax analysis matchers, the matching step size can be different, which also shows that the analysis granularity is different for different exception types.
S10733, initializing the current starting position to be the starting position.
S10735, determining a matching interval according to the current starting position and the matching step length, wherein the current starting position is the right boundary of the matching interval.
In one embodiment, if the current start position is close to the start position of the target file, the distance between the current start position and the start position of the target file may be smaller than the matching interval, in which case the distance between the current start position and the start position of the target file is directly determined as the matching interval.
S10737, carrying out matching analysis on the current code segment of the target file, which is positioned in the matching interval, based on the grammar analysis matcher, and determining whether the current code segment is an abnormal code segment.
In particular, the code of the current code segment may be matched with the analysis rules in the syntax analysis matcher.
S10739, judging whether the current code segment covers the initial position of the target file, if not, updating the current initial position according to the current code segment, and repeatedly executing the step S10735.
Specifically, the determining whether the current code segment covers the start position of the target file may be: and judging whether the left boundary of the current code segment is the initial position of the target file, if so, representing that the first matching is finished.
Updating the current starting position according to the current code segment to be: determining a left boundary of the current code segment as the updated current starting position.
S1075, determining the union of the code judged to be the abnormal code segment in the first matching and the code judged to be the abnormal code segment in the second matching as a target abnormal code segment.
And S109, repairing the target abnormal code segment according to the abnormal type information to obtain a patch file.
In one embodiment, in order to improve the security of the application program, the patch file may be obfuscated to obtain a more secure patch file, and subsequent repair, server upload, and the like may be performed according to the obfuscated patch file. Whether the patch file is confused can be configured in a fourth preset template, and the fourth preset template can also be combined with the first preset template, the second preset template and/or the third preset template.
Specifically, different repair strategies can be selected according to different abnormal type information to repair the target abnormal code segment, the repair strategies can be deletion, non-null detection and abnormal internal capture, and the non-null detection can be processed according to a detection result, so that abnormality caused by null pointers or null data can be avoided; the exception internal capture can capture exceptions for processing, thereby avoiding crash caused by the exception generated when the front-end component runs.
Specifically, the repairing the target abnormal code segment according to the abnormal type information to obtain the patch file, as shown in fig. 7, includes:
s1091, repairing the target abnormal code segment according to the abnormal type information to obtain a patch code segment;
s1093, performing writing operation in a file stream format, and writing the patch code segment into a target storage position;
s1095, generating a patch file according to the patch code section of the target storage position.
S1011, repairing the front-end component based on the patch file.
Specifically, the repairing the front-end component based on the patch file, as shown in fig. 8, includes:
s10111, reloading a file corresponding to the front-end component, and loading the patch file.
Specifically, the patch file may be placed in a directory of a file corresponding to the front-end component, the native-end component loads all files in the directory together, and the front-end component operating mechanism determines that the patch file may replace a code corresponding to the patch file in a file related to the front-end component, so as to successfully type a patch in the front-end component.
S10113, starting the front-end component according to the loading result.
If the front-end component is started successfully, the patch takes effect, and the patch file can be uploaded to a server, so that the server issues the patch file to other intelligent terminals to perform hot updating on the front-end components of the other intelligent terminals.
The embodiment of the present invention provides a self-repairing method, which does not depend on manual code analysis, code repair and code verification, and therefore does not exclude the case of repair failure, and in order to improve the robustness of self-repairing, in an embodiment, after repairing the front-end component based on the patch file, the method further includes:
and if the front-end component cannot be normally started, performing starting failure processing.
Specifically, the performing of the start failure processing, as shown in fig. 9, includes:
s201, acquiring starting failure information.
S203, stack information in the starting failure information is analyzed, and whether the loaded file has format content errors or not is judged according to the analysis result.
S205, if the file exists, determining the file with the wrong format content.
And S207, if the file is the patch file, deleting the patch file.
Specifically, the file for determining that the format content error occurs may be: extracting the name of the file with wrong format content; correspondingly, whether the name is the same as the name of the patch file is judged, and if so, the file is judged to be the patch file.
In one embodiment, after the patch file is deleted, each file corresponding to the front-end component may be reloaded to facilitate re-running the front-end component.
Since the front-end component cannot be started normally, it needs to rely on the server for performing the hot update, and therefore, in one embodiment, the method further includes the step of reporting a start failure message to the server if the front-end component cannot be started normally, so that the server can repair the front-end component through the hot update.
Referring to FIG. 10, a diagram of a hot-updated product interface in the prior art is shown. Referring to fig. 11, a product interface diagram according to an embodiment of the invention is shown. As can be seen from fig. 10, in the prior art, the hot update can be performed only after the patch file from the server is downloaded under the networking condition, and the embodiment of the present invention in fig. 11 can locally and offline repair the front-end component by itself in the intelligent terminal.
The embodiment of the invention discloses an application self-repairing method, when a front-end component of an application is abnormal, the native-end component of the application can automatically perform abnormal positioning and abnormal correction on the front-end component, and repair of the front-end component is performed in the form of a patch file. In fact, the time consumption of the thermal renewal technology in the prior art is long, but the self-repairing method of the invention can directly limit the repairing speed to the second level, and the time saving effect is very obvious.
An embodiment of the present invention further provides an apparatus for self-healing an application, where the application includes a front-end component and a native-end component, and as shown in fig. 12, the apparatus includes:
an exception information capturing module 301, configured to obtain exception information generated by the front-end component, where the exception information includes exception type information and exception location information.
And the target file reading module 303 is configured to read the target file pointed by the abnormal position information if a self-repair mechanism is started to repair the abnormality.
A syntax analysis matcher obtaining module 305, configured to obtain a corresponding syntax analysis matcher according to the abnormal type information.
And a target abnormal code segment positioning module 307, configured to analyze the target file based on the syntax analysis matcher and the abnormal position information to obtain a target abnormal code segment.
And a patch file generating module 309, configured to repair the target abnormal code segment according to the abnormal type information, to obtain a patch file.
A repair module 3011, configured to repair the front-end component based on the patch file.
Specifically, the target abnormal code segment locating module 307 includes:
an initial position determining unit for determining an initial position of analysis according to the abnormal position information;
the matching unit is used for calling the syntax analysis matcher, carrying out first matching forwards by taking the initial position as a starting point, and carrying out second matching backwards;
and the target abnormal code segment determining unit is used for determining the union of the code judged as the abnormal code segment in the first matching and the code judged as the abnormal code segment in the second matching as the target abnormal code segment.
The matching unit includes a first matching unit and a second matching unit, the first matching unit and the second matching unit have similar logic structures, and taking the first matching unit as an example, the first matching unit includes:
a matching step length determining unit, configured to obtain a matching step length according to the syntax analysis matcher;
a current start position initialization unit, configured to initialize a current start position as the start position;
a matching interval determining unit, configured to determine a matching interval according to the current starting position and the matching step length, where the current starting position is a right boundary of the matching interval;
the matching analysis unit is used for carrying out matching analysis on the current code segment of the target file positioned in the matching interval based on the grammar analysis matcher and determining whether the current code segment is an abnormal code segment;
and the flow control unit is used for judging whether the current code segment covers the initial position of the target file, if not, updating the current initial position according to the current code segment, and calling the matching interval determining unit again.
The self-repairing device for the application program disclosed by the embodiment of the invention and the method embodiment are based on the same inventive concept, and are not described again.
An embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium may store a plurality of instructions. The instructions can be suitable for being loaded by a processor and executing the application self-repairing method, and the method at least comprises the following steps:
a method of self-healing of an application, the application including a front-end component and a native-end component, the method applied to the native-end component, the method comprising:
if the operation of the front-end component is abnormal, acquiring abnormal information generated by the front-end component, wherein the abnormal information comprises abnormal type information and abnormal position information;
if a self-repairing mechanism is started to repair the abnormity, reading a target file pointed by the abnormal position information;
obtaining a corresponding syntax analysis matcher according to the abnormal type information;
analyzing the target file based on the syntax analysis matcher and the abnormal position information to obtain a target abnormal code segment;
repairing the target abnormal code segment according to the abnormal type information to obtain a patch file;
and repairing the front-end component based on the patch file.
Further, fig. 13 shows a hardware structure diagram of an apparatus for implementing the method provided by the embodiment of the present invention, and the apparatus may participate in forming or containing the device or system provided by the embodiment of the present invention. As shown in fig. 13, the device 10 may include one or more (shown as 102a, 102b, … …, 102 n) processors 102 (the processors 102 may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. Besides, the method can also comprise the following steps: a display, an input/output interface (I/O interface), a Universal Serial Bus (USB) port (which may be included as one of the ports of the I/O interface), a network interface, a power source, and/or a camera. It will be understood by those skilled in the art that the structure shown in fig. 13 is only an illustration and is not intended to limit the structure of the electronic device. For example, device 10 may also include more or fewer components than shown in FIG. 13, or have a different configuration than shown in FIG. 13.
It should be noted that the one or more processors 102 and/or other data processing circuitry described above may be referred to generally herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part in software, hardware, firmware, or any combination thereof. Further, the data processing circuitry may be a single, stand-alone processing module, or incorporated in whole or in part into any of the other elements in the device 10 (or mobile device). As referred to in the embodiments of the application, the data processing circuit acts as a processor control (e.g. selection of a variable resistance termination path connected to the interface).
The memory 104 may be used for storing software programs and modules of application software, such as program instructions/data storage devices corresponding to the method described in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, so as to implement one of the above-mentioned self-healing methods for application programs. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 104 may further include memory located remotely from processor 102, which may be connected to device 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of such networks may include wireless networks provided by the communication provider of the device 10. In one example, the transmission device 106 includes a network adapter (NIC) that can be connected to other network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 can be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
The display may be, for example, a touch screen type Liquid Crystal Display (LCD) that may enable a user to interact with a user interface of the device 10 (or mobile device).
It should be noted that: the precedence order of the above embodiments of the present invention is only for description, and does not represent the merits 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 device and server embodiments, since they are substantially similar to the method embodiments, the description is simple, and the relevant points can be referred to the partial description of the method embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (10)

1. A method of self-healing an application, the application including a front-end component and a native-end component, the method applied to the native-end component, the method comprising:
if the operation of the front-end component is abnormal, acquiring abnormal information generated by the front-end component, wherein the abnormal information comprises abnormal type information and abnormal position information;
if a self-repairing mechanism is started to repair the abnormity, reading a target file pointed by the abnormal position information;
obtaining a corresponding syntax analysis matcher according to the abnormal type information;
analyzing the target file based on the syntax analysis matcher and the abnormal position information to obtain a target abnormal code segment;
repairing the target abnormal code segment according to the abnormal type information to obtain a patch file;
and repairing the front-end component based on the patch file.
2. The method of claim 1, before the reading the target file pointed to by the exception location information if the self-repair mechanism is started to repair the exception, further comprising:
judging whether a self-repairing mechanism is started or not in a second preset template;
if so, judging whether the abnormal type pointed by the abnormal type information is configured to support self-repairing in a third preset template;
and if so, judging to start a self-repairing mechanism to repair the abnormity.
3. The method according to claim 1, wherein the reading the target file pointed to by the abnormal position information comprises:
finding out an abnormal target file in the resource directory according to the abnormal position information;
and carrying out file stream reading operation on the target file, and loading the target file in a memory.
4. The method according to claim 1 or 3, wherein the parsing the target file based on the parsing matcher and the abnormal location information to obtain a target abnormal code segment includes:
determining an initial position of analysis according to the abnormal position information;
calling the syntax analysis matcher, and carrying out first matching forwards and second matching backwards by taking the initial position as a starting point;
and determining the union of the code judged as the abnormal code segment in the first matching and the code judged as the abnormal code segment in the second matching as the target abnormal code segment.
5. The method of claim 4, wherein the first matching comprises:
obtaining a matching step length according to the grammar analysis matcher;
initializing a current starting position as the starting position;
determining a matching interval according to the current starting position and the matching step length, wherein the current starting position is the right boundary of the matching interval;
matching and analyzing the current code segment of the target file in the matching interval based on the syntax analysis matcher, and determining whether the current code segment is an abnormal code segment;
judging whether the current code segment covers the initial position of the target file, if not, updating the current initial position according to the current code segment, and repeatedly executing the following steps: and determining a matching interval according to the current starting position and the matching step length, wherein the current starting position is the right boundary of the matching interval.
6. The method of claim 1, wherein:
after the repairing the front-end component based on the patch file, the method further comprises:
and if the front-end component cannot be normally started, performing starting failure processing.
7. The method of claim 6, wherein the initiating the failure process comprises:
acquiring start failure information;
analyzing stack information in the startup failure information, and judging whether the loaded file has format content errors according to the analysis result;
if so, determining the file with wrong format content;
and if the file is the patch file, deleting the patch file, and reloading the file corresponding to the front-end component so as to rerun the front-end component.
8. An apparatus for self-healing an application, the application comprising a front-end component and a native-end component, the apparatus comprising:
the abnormal information capturing module is used for acquiring abnormal information generated by the front-end component, wherein the abnormal information comprises abnormal type information and abnormal position information;
the target file reading module is used for reading the target file pointed by the abnormal position information if a self-repairing mechanism is started to repair the abnormality;
a syntax analysis matcher obtaining module, configured to obtain a corresponding syntax analysis matcher according to the abnormal type information;
the target abnormal code segment positioning module is used for analyzing the target file based on the syntax analysis matcher and the abnormal position information to obtain a target abnormal code segment;
the patch file generation module is used for repairing the target abnormal code segment according to the abnormal type information to obtain a patch file;
and the repairing module is used for repairing the front-end component based on the patch file.
9. A computer-readable storage medium having at least one instruction or at least one program stored thereon, the at least one instruction or at least one program being loaded and executed by a processor to implement the method of self-healing of an application of claim 1.
10. An apparatus for self-healing applications, the apparatus comprising a processor and a memory, the memory having at least one instruction or at least one program stored therein, the at least one instruction or at least one program being loaded by the processor and executing the method of self-healing applications of claim 1.
CN202010544714.4A 2020-06-15 2020-06-15 Self-repairing method, device and equipment for application program and storage medium Pending CN113806118A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010544714.4A CN113806118A (en) 2020-06-15 2020-06-15 Self-repairing method, device and equipment for application program and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010544714.4A CN113806118A (en) 2020-06-15 2020-06-15 Self-repairing method, device and equipment for application program and storage medium

Publications (1)

Publication Number Publication Date
CN113806118A true CN113806118A (en) 2021-12-17

Family

ID=78944407

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010544714.4A Pending CN113806118A (en) 2020-06-15 2020-06-15 Self-repairing method, device and equipment for application program and storage medium

Country Status (1)

Country Link
CN (1) CN113806118A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116450400A (en) * 2023-06-19 2023-07-18 北京翼辉信息技术有限公司 Application program abnormality analysis method and device, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116450400A (en) * 2023-06-19 2023-07-18 北京翼辉信息技术有限公司 Application program abnormality analysis method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109815141B (en) Test method and device
US20100162217A1 (en) Debugging System Using Static Analysis
CN115357515B (en) Debugging method and device of multi-core system, computer equipment and storage medium
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN111371610A (en) Network card firmware batch refreshing method, system, terminal and storage medium
CN108446224B (en) Performance analysis method of application program on mobile terminal and storage medium
US20140033179A1 (en) Application testing
CN110941520B (en) Hardware function test system and method based on two-out-of-two safety control unit
CN107463485B (en) Method stack-based log acquisition method and device and terminal
CN112052037A (en) Application software development method, device, equipment and medium
CN113806118A (en) Self-repairing method, device and equipment for application program and storage medium
CN114860291A (en) Method for guiding and flexibly storing and upgrading application program
CN111399926A (en) Method and device for downloading starting program
CN114116034B (en) Distributed brushing method and device
CN114385493A (en) Performance test method and device, electronic equipment and storage medium
CN112241141B (en) Hardware configuration method, system, device and medium of PLC control system
CN113986263A (en) Code automation test method, device, electronic equipment and storage medium
CN113778485A (en) System operation method and device of electronic chip, electronic chip and storage medium
CN113110991A (en) Page element positioning method and device, storage medium and electronic device
CN112667314A (en) Game engine editor starting method and device, electronic equipment and storage medium
CN111694727A (en) Network card firmware upgrading and downgrading test method, system, terminal and storage medium
CN110968519A (en) Game testing method, device, server and storage medium
CN113885963B (en) Secondary development file execution method, device and storage medium
CN114328273B (en) Debugging method and device for application program control and computing equipment
CN116303067B (en) Testing method, device, equipment and medium based on cloud testing platform

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