CN111966577A - Program stability detection method and device - Google Patents

Program stability detection method and device Download PDF

Info

Publication number
CN111966577A
CN111966577A CN202010642987.2A CN202010642987A CN111966577A CN 111966577 A CN111966577 A CN 111966577A CN 202010642987 A CN202010642987 A CN 202010642987A CN 111966577 A CN111966577 A CN 111966577A
Authority
CN
China
Prior art keywords
preset
thread
program
program code
calling
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.)
Granted
Application number
CN202010642987.2A
Other languages
Chinese (zh)
Other versions
CN111966577B (en
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.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology 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 Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202010642987.2A priority Critical patent/CN111966577B/en
Publication of CN111966577A publication Critical patent/CN111966577A/en
Application granted granted Critical
Publication of CN111966577B publication Critical patent/CN111966577B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3644Software debugging by instrumenting at runtime
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the invention provides a method and a device for detecting program stability, wherein the method comprises the following steps: when a preset program object is operated to call a program code of a preset method, a preset message forwarding method is called to add a thread detection method; detecting the type of a thread running a program code of the preset program object calling a preset method through the thread detection method; judging whether a preset problem exists in a program code of the preset program object calling a preset method or not according to the type of the thread; and if the preset program code of the preset method called by the preset program object has a preset problem, executing feedback operation aiming at the preset problem, thereby reminding a developer to process. The embodiment of the invention utilizes a runtime mechanism implantation thread detection method to realize the extremely low invasiveness of the original application program and efficiently complete the detection task at the same time.

Description

Program stability detection method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for detecting program stability.
Background
With the popularization of the mobile internet, mobile applications play an increasingly greater role in life, and mobile application providers continuously expand services, provide richer functions and pay more attention to the performance of application programs App to ensure user experience.
There are many indicators for measuring App performance, such as App startup time consumption, rendering frame rate, memory consumption, power consumption, App collapse rate, and so on. The detailed data of various items detected by the running App is the first step of improving the performance of mobile applications, and many performance detection tools exist nowadays, but the detection work has the characteristics of heavy weight, serious intrusion on the App, low flexibility and the like. The cost consumed by the developer in performance detection and optimization is too heavy, and meanwhile, the performance does not rise or fall due to serious invasion of a third-party framework, and meanwhile, most performance testing tools need to pay, so that the product optimization cost of an enterprise technology team is increased.
Disclosure of Invention
The embodiment of the invention aims to provide a program stability detection method for detecting an application program with low invasiveness. The specific technical scheme is as follows:
in a first aspect of the present invention, there is provided a program stability detection method, including:
when a preset program object is operated to call a program code of a preset method, a preset message forwarding method is called to add a thread detection method;
detecting the type of a thread running a program code of the preset program object calling a preset method through the thread detection method;
judging whether a preset problem exists in a program code of the preset program object calling a preset method or not according to the type of the thread;
and if the preset program code of the preset program object calling the preset method has a preset problem, executing feedback operation aiming at the preset problem.
Optionally, the performing a feedback operation for the preset problem includes:
and interrupting the thread of the program code of the preset program object calling the preset method, and/or generating and displaying the reminding information.
Optionally, the performing a feedback operation for the preset problem includes:
acquiring a current thread;
saving the stack corresponding to the current thread, and acquiring an abnormal timestamp and a program module to which a program code of a preset method called by the preset program object belongs;
generating log data and uploading the log data to a server; the log data comprises a stack corresponding to the current thread, the abnormal timestamp and a program module to which a program code calling a preset method belongs.
Optionally, the step of determining, according to the type of the thread, whether a preset problem exists in the program code for calling the preset method by the preset program object includes:
judging whether the type of a thread running a program code of the interface element calling the rendering method is a sub-thread;
and if the type of the thread for operating the program code of the interface element calling the rendering method is a sub-thread, determining that the program code of the interface element calling the rendering method has a preset problem.
In a first aspect of the present invention, there is provided a program stability detection apparatus, including:
the method adding module is used for calling a preset message forwarding method to add a thread detection method when a preset program object is operated to call a program code of a preset method;
the thread detection module is used for detecting the type of a thread running a program code of the preset program object calling a preset method through the thread detection method;
the problem judgment module is used for judging whether a preset problem exists in a program code of the preset program object calling a preset method according to the type of the thread;
and the feedback module is used for executing feedback operation aiming at the preset problem if the preset problem exists in the program code of the preset program object calling the preset method.
Optionally, the feedback module comprises:
and the reminding submodule is used for interrupting the thread of the program code of the preset program object calling the preset method and/or generating and displaying reminding information.
Optionally, the feedback module comprises:
the thread obtaining submodule is used for obtaining a current thread;
the saving submodule is used for saving the stack corresponding to the current thread and acquiring an abnormal time stamp and a program module to which a program code of a preset method called by the preset program object belongs;
the log data uploading sub-module is used for generating log data and uploading the log data to the server; the log data comprises a stack corresponding to the current thread, the abnormal timestamp and a program module to which a program code calling a preset method belongs.
Optionally, the program code of the preset program object calling the preset method is a program code of the interface element calling a rendering method, and the problem determination module includes:
the sub-thread judgment submodule is used for judging whether the type of a thread running a program code of the interface element calling the rendering method is a sub-thread;
and the problem determination submodule is used for determining that the program code of the rendering method called by the interface element has a preset problem if the type of the thread of the program code of the rendering method called by the interface element is a sub-thread.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when run on a computer, cause the computer to execute any one of the above-described program stability detection methods.
In yet another aspect of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the above described program stability detection methods.
In the embodiment of the invention, a runtime mechanism is utilized, and when a program code calling a preset method is operated, a preset message forwarding method is called to add a thread detection method; detecting the type of a thread running a program code calling a preset method through a thread detection method, and judging whether the program code calling the preset method has a preset problem or not according to the type of the thread; and if the preset program code of the preset program object calling the preset method has a preset problem, executing feedback operation aiming at the preset problem. The embodiment of the invention utilizes a runtime mechanism implantation thread detection method to realize the extremely low invasiveness of the original application program and efficiently complete the detection task at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
FIG. 1 is a flowchart illustrating a first embodiment of a method for detecting program stability according to the present invention;
FIG. 2 is a flow chart of an object invocation method;
FIG. 3 is a flowchart illustrating steps of a second embodiment of a method for detecting program stability according to the present invention;
FIG. 4 is a block diagram of an embodiment of a program stability detection apparatus according to the present invention;
fig. 5 is a schematic structural diagram of an electronic device in an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
For the iOS application, the interface rendering of the application is performed in the main thread, which is also an important factor for the iOS application to use relatively smoothly, and if a developer performs any operation on the interface element in the sub-thread, the interface rendering may cause the program to be stuck, performance to be degraded, and even blast (program flash back, Crash).
The iOS application is an application written in Objective-C programming language, which is a runtime oriented language that can decide to implement logic at runtime rather than at compile time. Developers can redirect messages to appropriate objects, even exchange method implementations, etc., as desired. For example: the syntax of object foo (which is a sentence of code) does not immediately execute the code of foo this method. It is a message sent to the object at runtime called foo. This message may be processed by the object, may be forwarded to another object, or disregarded to ignore the message in case it was not received. Multiple different messages may also be implemented corresponding to the same method. These are all determined while the program is running, and are known in the industry as runtime.
One of the core ideas of the embodiment of the invention is that a runtime mechanism is utilized to realize the runtime method replacement of a program code, the method needing coverage detection is subjected to message forwarding operation, a detection code is implanted, and whether risky operation exists in the method is detected.
Referring to fig. 1, a flowchart illustrating a first step of a first embodiment of a method for detecting program stability of the present invention is shown, which may specifically include the following steps:
step 101, when a preset program object is operated to call a program code of a preset method, a preset message forwarding method is called to add a thread detection method.
In an iOS system, a program object may refer to an instance object of a certain class or subclass thereof.
Referring to fig. 2, a flowchart of a program object calling method is shown. The program object is implemented in the program code to call the preset method by sending a message (selector) to the program object referring to the rendering method.
The message mechanism in the iOS system relies on the objc _ msgSend (receiver, selector) function to send messages. The obj jc _ msgSend searches the class of the object according to the isa pointer of the instance object, and then searches the message in the method Dispatch Table (Dispatch Table) of the class; if the method assignment table of the class cannot be found, the method assignment table of the parent class is searched until the NSobject class is found.
If the message is found in the method dispatch table, jumping to the corresponding function IMP (address of a certain method) to execute the code; if the message is not found in the method dispatch table, runtime will send either a resolveInstanceMethod or a resolveClassMethod that attempts to remove the message; if the resolve method returns NO, runtime sends a forwardingTargetForSector that allows the developer to forward this message to another object; if no new target object is returned, runtime will send a methodSignatureForSelector and forwarddInvocation message.
The developer may choose to forward the message to the custom program code at any of the steps of sending a resolveInstancemethod, sending a forwardTargetForSector, and sending a methodSignatureForSector.
In the embodiment of the invention, a developer can test whether abnormal operation exists in a program code of a preset method called by a program object in an application program in a test tool. When a program object in the detected application program calls a program code of a preset method, the test tool can add a thread detection method through a preset message forwarding method. The preset message forwarding method may be any one of a resolveInstancemethod, a forwarding TargetForSector, and a methodSignatureForSector. A test tool is a framework used by developers to test applications.
The thread detection method can be a program code customized by a developer, and the type of the thread of the program code of the preset method called by the currently running program object can be judged by using [ NSThread currentThread ].
And 102, detecting the type of a thread running a program code of which the preset program object calls a preset method through the thread detection method.
And 103, judging whether a preset problem exists in a program code of the preset program object calling a preset method or not according to the type of the thread.
The type of thread may be a main thread or a sub-thread. When written, the program code for calling the preset method is configured to run in a thread of a preset type. The preset problem may be that the program code is not run according to a preset type of thread configured in advance in the running process, and if the type of the thread running the program code calling the preset method is not the preset type, the program code may be considered to have the preset problem.
And 104, if the program code of the preset program object calling the preset method has a preset problem, executing feedback operation aiming at the preset problem.
In the embodiment of the invention, a runtime mechanism is utilized, and when a program code calling a preset method is operated, a preset message forwarding method is called to add a thread detection method; detecting the type of a thread running a program code calling a preset method through a thread detection method, and judging whether the program code calling the preset method has a preset problem or not according to the type of the thread; and if the preset problem exists, executing feedback operation aiming at the preset problem so as to remind a developer to process. The embodiment of the invention utilizes a runtime mechanism implantation thread detection method to realize the extremely low invasiveness of the original application program and efficiently complete the detection task at the same time.
Referring to fig. 3, a flowchart illustrating steps of a second embodiment of the program stability detection method according to the present invention is shown, which may specifically include the following steps:
step 301, when a program code of a preset method is called by running a preset program object, a preset message forwarding method is called to add a thread detection method.
The method of the embodiment of the invention can be operated in a test tool, the test tool is a framework used by a developer for testing the application program, and the developer can control the program code of the application program to be tested to be loaded in the test tool and set the detection mode of the test tool when testing. The developer may perform the detection of the program code in different detection modes.
Step 302, detecting the type of the thread running the program code of the preset program object calling the preset method through the thread detection method.
In an embodiment, the preset message forwarding method is a resolution instance method resolveInstanceMethod. The method comprises the steps of sending a message indicating a rendering method to a self-defined thread detection method by utilizing a resolve method at a dynamic method resolution stage, so that the self-defined thread detection method is added to an application program.
And step 303, judging whether the type of the thread running the program code of the interface element calling the rendering method is a sub-thread.
In the embodiment of the present invention, the program code of the preset program object calling the preset method may be a program code of an interface element calling a rendering method, an interface element UI in the iOS system refers to an instance object of the UIView class and its subclass, and the interface element is inherited from the UIView class.
Specifically, the thread detection method may be a program code defined by a developer, and the thread detection method may use [ NSThread currentThread ] to determine whether a thread of the program code, in which the currently running interface element calls the rendering method, is a child thread.
Step 304, if the type of the thread running the program code of the rendering method called by the interface element is a sub-thread, determining that a preset problem exists in the program code of the rendering method called by the interface element.
If the thread for running the program code of the interface element calling the rendering method is detected to be the main thread, abnormal operation is avoided, and the program code of the interface element calling the rendering method is continuously run in the test work.
Step 305, if a preset problem exists in the program code of the preset program object calling the preset method, executing a feedback operation aiming at the preset problem.
In an embodiment of the present invention, the step 305 may include the following sub-steps:
substep S11, interrupting the thread running the program code of the preset program object calling the preset method, and/or generating and displaying a reminding message;
the test tool may perform a strong alert operation or a weak alert operation to inform the developer that an out of specification operation exists. The strong reminding operation can be that an abnormal program is thrown out and an application program is quitted; the weak alert operation may be to generate and present alert information. In practice, whether to execute the strong reminding operation or the weak reminding operation can be selected according to different development scenes.
In one example, a current detection mode may be determined; the sub-step S11 may be performed when the current detection mode is the first detection mode.
The detection mode is an operation mode set for facilitating testing of developers in different development stages, and generally, the development of an application includes three stages: the working modes can be respectively a development mode, a test mode and an online mode.
Specifically, the first detection mode may be a development mode. In the development mode, the test tool may perform a strong alert operation or a weak alert operation to inform the developer that an out-of-specification operation exists.
In an embodiment of the present invention, the step 304 may include the following sub-steps:
substep S12, obtaining a current thread;
substep S13, saving the stack corresponding to the current thread, and obtaining an exception timestamp and a program module to which a program code of a preset method called by the preset program object belongs;
in program development, a developer typically divides an application program into a plurality of program modules, each of which implements a different function. The program modules that contain the program code for the program objects are typically program modules that are responsible for UI presentation, e.g., program modules that implement user information presentation pages.
A substep S14 of generating log data and uploading the log data to a server; the log data comprises a stack corresponding to the current thread, the abnormal timestamp and a program module to which a program code calling a preset method belongs.
In one example, the substeps S12-S14 may be performed when the current detection mode is the second detection mode.
The second detection mode may be a test mode. The strong reminding operation in the development mode can enable the running program to directly quit the program when encountering the irregular operation, and aims to immediately remind a developer, but the quitting of the program in the test process can cause blockage to the test flow of a tester, seriously influence the working progress, and simultaneously have the possibility of misleading the tester to judge the current problem. In the test mode, when the test tool currently detects that the suspected abnormal operation exists, only log uploading operation is performed.
The test tool can utilize a system API to store the stack of the application program of the current thread, meanwhile, collect the abnormal timestamp and the program module to which the interface element belongs, integrate the information of the part to create a log object, convert the log object into a lightweight data format Json format and upload the log object to a specified server for storage.
Json data structure compares in other data structure and possesses simple structure small, easily compresses and decompress, and convenient advantages such as analysis simultaneously can play an important role in promoting the efficiency that log generation and upload.
By means of log uploading, abnormal and irregular method calls in each debugging device in the development and test processes can be collected by the server. The detection range is not limited to a single device any more, and the abnormal stacks of all debugging devices in operation can be obtained to form a real-time monitoring network, so that problems can be found in time, and risks can be eliminated. The technical team can collect a part of logs in a fixed time period, analyze the logs to obtain program modules with abnormal operations and perform unified investigation and solution.
In the embodiment of the invention, a runtime mechanism is utilized, and when a preset program object is operated to call a program code of a preset method, a preset message forwarding method is called to add a thread detection method; detecting the type of a thread running a program code of a preset program object calling a preset method through a thread detection method; if the type of the thread for running the program code of the interface element calling the rendering method is a sub-thread, determining that the program code of the interface element calling the rendering method has a preset problem; and if the preset problem exists, executing feedback operation aiming at the preset problem so as to remind a developer to process. The embodiment of the invention utilizes a runtime mechanism implantation thread detection method to realize the extremely low invasiveness of the original application program and efficiently complete the detection task at the same time.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 4, a block diagram of a structure of an embodiment of the program stability detection apparatus of the present invention is shown, which may specifically include the following modules:
a method adding module 401, configured to call a preset message forwarding method to add a thread detection method when a preset program object runs and a program code of a preset method is called;
a thread detection module 402, configured to detect, by using the thread detection method, a type of a thread running a program code of a preset method called by the preset program object;
a problem determining module 403, configured to determine whether a preset problem exists in a program code of the preset program object calling a preset method according to the type of the thread;
the feedback module 404 is configured to, if a preset problem exists in a program code of the preset program object calling the preset method, execute a feedback operation for the preset problem.
In an embodiment of the present invention, the feedback module includes:
and the reminding submodule is used for interrupting the thread of the program code of the preset program object calling the preset method and/or generating and displaying reminding information.
In an embodiment of the present invention, the feedback module includes:
the thread obtaining submodule is used for obtaining a current thread;
the saving submodule is used for saving the stack corresponding to the current thread and acquiring an abnormal time stamp and a program module to which a program code of a preset method called by the preset program object belongs;
the log data uploading sub-module is used for generating log data and uploading the log data to the server; the log data comprises a stack corresponding to the current thread, the abnormal timestamp and a program module to which a program code calling a preset method belongs.
In this embodiment of the present invention, the program code of the preset program object calling the preset method is a program code of the interface element calling the rendering method, and the problem determining module 402 may include:
the sub-thread judgment submodule is used for judging whether the type of a thread running a program code of the interface element calling the rendering method is a sub-thread;
and the problem determination submodule is used for determining that the program code of the rendering method called by the interface element has a preset problem if the type of the thread of the program code of the rendering method called by the interface element is a sub-thread.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
An embodiment of the present invention further provides an electronic device, as shown in fig. 5, which includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, where the processor 501, the communication interface 502 and the memory 503 complete mutual communication through the communication bus 504,
a memory 503 for storing a computer program;
the processor 501, when executing the program stored in the memory 503, implements the following steps:
when a preset program object is operated to call a program code of a preset method, a preset message forwarding method is called to add a thread detection method;
detecting the type of a thread running a program code of the preset program object calling a preset method through the thread detection method;
judging whether a preset problem exists in a program code of the preset program object calling a preset method or not according to the type of the thread;
and if the preset program code of the preset program object calling the preset method has a preset problem, executing feedback operation aiming at the preset problem.
The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the terminal and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In yet another embodiment of the present invention, a computer-readable storage medium is further provided, which stores instructions that, when executed on a computer, cause the computer to execute the program stability detection method described in any of the above embodiments.
In a further embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the method for detecting program stability of any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A method for detecting program stability, comprising:
when a preset program object is operated to call a program code of a preset method, a preset message forwarding method is called to add a thread detection method;
detecting the type of a thread running a program code of the preset program object calling a preset method through the thread detection method;
judging whether a preset problem exists in a program code of the preset program object calling a preset method or not according to the type of the thread;
and if the preset program code of the preset program object calling the preset method has a preset problem, executing feedback operation aiming at the preset problem.
2. The method of claim 1, wherein the performing the feedback operation for the preset problem comprises:
and interrupting the thread of the program code of the preset program object calling the preset method, and/or generating and displaying the reminding information.
3. The method of claim 1, wherein the performing the feedback operation for the preset problem comprises:
acquiring a current thread;
saving the stack corresponding to the current thread, and acquiring an abnormal timestamp and a program module to which a program code of a preset method called by the preset program object belongs;
generating log data and uploading the log data to a server; the log data comprises a stack corresponding to the current thread, the abnormal timestamp and a program module to which a program code calling a preset method belongs.
4. The method according to claim 2 or 3, wherein the program code of the preset program object calling the preset method is a program code of an interface element calling a rendering method, and the determining whether the program code of the preset program object calling the preset method has a preset problem according to the type of the thread includes:
judging whether the type of a thread running a program code of the interface element calling the rendering method is a sub-thread;
and if the type of the thread for operating the program code of the interface element calling the rendering method is a sub-thread, determining that the program code of the interface element calling the rendering method has a preset problem.
5. A program stability detecting apparatus, comprising:
the method adding module is used for calling a preset message forwarding method to add a thread detection method when a preset program object is operated to call a program code of a preset method;
the thread detection module is used for detecting the type of a thread running a program code of the preset program object calling a preset method through the thread detection method;
the problem judgment module is used for judging whether a preset problem exists in a program code of the preset program object calling a preset method according to the type of the thread;
and the feedback module is used for executing feedback operation aiming at the preset problem if the preset problem exists in the program code of the preset program object calling the preset method.
6. The apparatus of claim 5, wherein the feedback module comprises:
and the reminding submodule is used for interrupting the thread of the program code of the preset program object calling the preset method and/or generating and displaying reminding information.
7. The apparatus of claim 5, wherein the feedback module comprises:
the thread obtaining submodule is used for obtaining a current thread;
the saving submodule is used for saving the stack corresponding to the current thread and acquiring an abnormal time stamp and a program module to which a program code of a preset method called by the preset program object belongs;
the log data uploading sub-module is used for generating log data and uploading the log data to the server; the log data comprises a stack corresponding to the current thread, the abnormal timestamp and a program module to which a program code calling a preset method belongs.
8. The apparatus according to claim 6 or 7, wherein the program code for calling the preset method by the preset program object is a program code for calling a rendering method by an interface element, and the problem determination module comprises:
the sub-thread judgment submodule is used for judging whether the type of a thread running a program code of the interface element calling the rendering method is a sub-thread;
and the problem determination submodule is used for determining that the program code of the rendering method called by the interface element has a preset problem if the type of the thread of the program code of the rendering method called by the interface element is a sub-thread.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 4 when executing a program stored in the memory.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-4.
CN202010642987.2A 2020-07-06 2020-07-06 Program stability detection method and device Active CN111966577B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010642987.2A CN111966577B (en) 2020-07-06 2020-07-06 Program stability detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010642987.2A CN111966577B (en) 2020-07-06 2020-07-06 Program stability detection method and device

Publications (2)

Publication Number Publication Date
CN111966577A true CN111966577A (en) 2020-11-20
CN111966577B CN111966577B (en) 2023-09-08

Family

ID=73361177

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010642987.2A Active CN111966577B (en) 2020-07-06 2020-07-06 Program stability detection method and device

Country Status (1)

Country Link
CN (1) CN111966577B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060005171A1 (en) * 2004-07-03 2006-01-05 Ellison Timothy P Method for replacing code in a running object oriented program
US20100077258A1 (en) * 2008-09-22 2010-03-25 International Business Machines Corporation Generate diagnostic data for overdue thread in a data processing system
US20120204065A1 (en) * 2011-02-03 2012-08-09 International Business Machines Corporation Method for guaranteeing program correctness using fine-grained hardware speculative execution
CN108595236A (en) * 2018-03-27 2018-09-28 五八有限公司 A kind of method and device for preventing sub-line journey from carrying out operating user interface
CN108763057A (en) * 2018-04-20 2018-11-06 北京五八信息技术有限公司 A kind of thread detection method, device, equipment and computer readable storage medium
CN109491907A (en) * 2018-11-05 2019-03-19 网易(杭州)网络有限公司 A kind of Caton detection method, device, electronic equipment and storage medium
CN109783161A (en) * 2018-12-11 2019-05-21 北京三快在线科技有限公司 The operation information of application program determines method, apparatus in iOS system
US20190205123A1 (en) * 2016-10-28 2019-07-04 Tencent Technology (Shenzhen) Company Limited Apparatus and method for thread data processing
US10496449B1 (en) * 2018-06-11 2019-12-03 International Business Machines Corporation Verification of atomic memory operations
CN110879781A (en) * 2019-11-06 2020-03-13 北京奇艺世纪科技有限公司 Program debugging method and device, electronic equipment and computer readable storage medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060005171A1 (en) * 2004-07-03 2006-01-05 Ellison Timothy P Method for replacing code in a running object oriented program
US20100077258A1 (en) * 2008-09-22 2010-03-25 International Business Machines Corporation Generate diagnostic data for overdue thread in a data processing system
US20120204065A1 (en) * 2011-02-03 2012-08-09 International Business Machines Corporation Method for guaranteeing program correctness using fine-grained hardware speculative execution
US20190205123A1 (en) * 2016-10-28 2019-07-04 Tencent Technology (Shenzhen) Company Limited Apparatus and method for thread data processing
CN108595236A (en) * 2018-03-27 2018-09-28 五八有限公司 A kind of method and device for preventing sub-line journey from carrying out operating user interface
CN108763057A (en) * 2018-04-20 2018-11-06 北京五八信息技术有限公司 A kind of thread detection method, device, equipment and computer readable storage medium
US10496449B1 (en) * 2018-06-11 2019-12-03 International Business Machines Corporation Verification of atomic memory operations
CN109491907A (en) * 2018-11-05 2019-03-19 网易(杭州)网络有限公司 A kind of Caton detection method, device, electronic equipment and storage medium
CN109783161A (en) * 2018-12-11 2019-05-21 北京三快在线科技有限公司 The operation information of application program determines method, apparatus in iOS system
CN110879781A (en) * 2019-11-06 2020-03-13 北京奇艺世纪科技有限公司 Program debugging method and device, electronic equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN111966577B (en) 2023-09-08

Similar Documents

Publication Publication Date Title
US8336029B1 (en) Debugger connection
CN111026645B (en) User interface automatic test method and device, storage medium and electronic equipment
US20130081001A1 (en) Immediate delay tracker tool
CN103034575B (en) Collapse analytical approach and device
CN111190755B (en) Application program function exception handling method and device
CN111240876A (en) Fault positioning method and device for microservice, storage medium and terminal
CN110830311A (en) Network quality detection method, device, equipment and storage medium
CN112232881A (en) Data detection method and device, electronic equipment and storage medium
CN114490268A (en) Full link monitoring method, device, equipment, storage medium and program product
CN113495820A (en) Method and device for collecting and processing abnormal information and abnormal monitoring system
CN111309743A (en) Report pushing method and device
CN109189677B (en) Test method and device for updating state of variable value
CN108111328B (en) Exception handling method and device
CN111966577B (en) Program stability detection method and device
CN110309028B (en) Monitoring information acquisition method, service monitoring method, device and system
CN112241362A (en) Test method, test device, server and storage medium
CN113868005A (en) Method and device for monitoring webpage abnormity
CN112114987B (en) Abnormality detection method and device for operation environment, intelligent terminal and storage medium
CN110908701B (en) Firmware version switching method and device, storage medium and electronic equipment
CN113766527B (en) Base station hardware detection method and device
CN112631929A (en) Test case generation method and device, storage medium and electronic equipment
CN110990246A (en) Tracking processing method and device for large-scale cluster deployment delivery log
CN111124712A (en) Event notification method, device, server and storage medium
CN113778800A (en) Error reporting information processing method, device, system, equipment and storage medium
CN115470075B (en) Application program fault detection method and device, electronic equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant