CN110377341B - Method, device, medium and electronic equipment for monitoring no-response exception - Google Patents
Method, device, medium and electronic equipment for monitoring no-response exception Download PDFInfo
- Publication number
- CN110377341B CN110377341B CN201910494794.4A CN201910494794A CN110377341B CN 110377341 B CN110377341 B CN 110377341B CN 201910494794 A CN201910494794 A CN 201910494794A CN 110377341 B CN110377341 B CN 110377341B
- Authority
- CN
- China
- Prior art keywords
- thread
- signal
- monitoring
- setting
- group
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3003—Monitoring arrangements specially adapted to the computing system or computing system component being monitored
- G06F11/302—Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3089—Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/4401—Bootstrapping
- G06F9/442—Shutdown
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computing Systems (AREA)
- Quality & Reliability (AREA)
- Mathematical Physics (AREA)
- Computer Security & Cryptography (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application provides a method, a device, a medium and electronic equipment for monitoring non-response abnormity. The method comprises the following steps: creating a monitoring thread and setting the value of a thread signal control parameter so as to control the monitoring thread to be the first thread in the thread group to receive signals; the thread group also comprises a monitoring thread; setting a monitoring thread as a first thread for receiving signals in a thread group according to the value of the thread signal control parameter; wherein the process termination signal is sent by the system service process to the first process; and the monitoring thread receives the process termination signal, sends no-response exception information to the system service process and forwards the process termination signal to the abnormal collection thread. According to the method and the device, the ANR information is acquired by monitoring the SIGQUIT signal, so that the frequency of frequently sending the detection signal to the main thread is greatly reduced, the system burden is reduced, and the system performance is improved. The monitoring is synchronous with the ANR detection of the system, so that the missing report caused by time difference is avoided, and the data accuracy is ensured.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a medium, and an electronic device for monitoring a non-response exception.
Background
Applications on android devices may Not respond sensitively for a while, and the system may display a dialog box called an Application Not Responding (ANR) dialog box to the user. When this occurs, the user may choose to "wait" for the program to continue running, or may choose to "force shut down".
ANR cannot occur in a smooth and reasonable application, and an ANR index is also one of important indexes of performance and reliability of the application.
Mobile phone application software (APP for short) mainly refers to software installed on a smart phone, and overcomes the defects of an original system and meets personalized requirements.
Because the detection behavior of ANR is performed by the system, the APP process cannot directly sense the occurrence of ANR, and therefore, an abnormal ANR monitoring function needs to be performed in the APP process. However, in the current monitoring working mode, a detection signal needs to be frequently sent to the main thread, so that the system load is increased, and the system performance is affected. Meanwhile, monitoring and ANR detection of the system cannot be synchronized, and time difference or report missing possibly exists to influence data accuracy. If the current mechanism is implemented in the Java layer, ANR may be caused by Java locks, and the reporting process may also be affected, which also affects the data accuracy.
Disclosure of Invention
An object of the present application is to provide a method, an apparatus, a medium, and an electronic device for monitoring a non-response exception, which can solve at least one of the above-mentioned technical problems. The specific scheme is as follows:
according to a specific implementation manner of the present application, in a first aspect, the present application provides a method for monitoring a non-response exception, which is applied to a first process in a first application system, where the first application system further includes a system service process; the thread group created by the first process at initialization at least comprises: the main thread and the collection exception thread comprise:
creating a monitoring thread and setting the value of a thread signal control parameter so as to control the monitoring thread to be the first thread in the thread group to receive signals; the thread group also comprises a monitoring thread;
setting a monitoring thread as a first thread for receiving signals in a thread group according to the value of the thread signal control parameter; wherein the process termination signal is sent by the system service process to the first process;
and the monitoring thread receives the process termination signal, sends no-response exception information to the system service process and forwards the process termination signal to the abnormal collection thread.
Optionally, the creating a listening thread and setting a value of a thread signal control parameter so as to control the listening thread to be a first thread in the thread group to receive a signal includes:
and when the first process is initialized, creating a monitoring thread and setting the value of a thread signal control parameter so as to control the monitoring thread to be the first thread in the thread group to receive signals.
Optionally, the setting, according to the value of the thread signal control parameter, the listening thread as a thread that receives a signal first in the thread group includes:
and when the first process is initialized, setting the monitoring thread as the first thread for receiving signals in the thread group according to the value of the thread signal control parameter.
Optionally, the setting a value of the thread signal control parameter to control the listening thread to be the first thread receiving the signal includes:
sequentially acquiring a thread signal control parameter of each thread in a thread group; wherein, the thread signal control parameters at least comprise: a first reception setting signal parameter associated with the first reception setting signal, a custom signal parameter associated with the custom signal, and a process termination signal parameter associated with the process termination signal;
Setting all values of the thread signal control parameters of the monitoring thread to be in an open state;
setting the value of a first receiving setting signal parameter of the abnormal thread as a shielding state, and setting the values of other thread signal control parameters of the abnormal thread as an open state;
and respectively setting the values of the first receiving setting signal parameter, the user-defined signal parameter and the process termination signal parameter of other threads in the thread group as a shielding state, wherein the values of the signal control parameters of other threads corresponding to the threads are all in an open state.
Optionally, the setting, according to the value of the thread signal control parameter, the listening thread as a thread that receives a signal first in the thread group includes:
sending a first receiving setting signal to the thread group by using other threads except the monitoring thread in the thread group;
and the monitoring thread receives the first receiving setting signal and is set as the thread of the first receiving signal in the thread group based on the value of the first receiving setting signal parameter being in an open state.
Optionally, the method further includes:
and the monitoring thread receives the self-defining signal and forwards the self-defining signal to the abnormal collecting thread.
Optionally, after forwarding the process termination signal to the thread with collection exception, the method further includes:
And the abnormal information collection thread starts to collect abnormal information after receiving the process termination signal and stores the abnormal information in a non-response abnormal information set shared with the system service process.
Optionally, the storing the exception information in a no-response exception information set shared with the system service process further includes:
and storing the ending information of the abnormal information in a non-response abnormal information set shared with the system service process.
According to a second aspect of the present application, there is provided an apparatus for monitoring a non-response exception, which is applied to a first process in a first application system, where the first application system further includes a system service process; the thread group created by the first process at initialization at least comprises: the main thread and the collection exception thread comprise:
the creating unit is used for creating a monitoring thread and setting the value of a thread signal control parameter so as to control the monitoring thread to be the first thread which receives signals in the thread group; the thread group also comprises a monitoring thread;
the setting unit is used for setting the monitoring thread as the first thread for receiving the signal in the thread group according to the value of the thread signal control parameter; wherein the process termination signal is sent by the system service process to the first process;
And the reporting unit is used for receiving the process termination signal by the monitoring thread, sending no-response abnormal information to the system service process and forwarding the process termination signal to the abnormal collecting thread.
According to a third aspect, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of listening for a non-responsive exception as set forth in any one of the first aspects.
According to a fourth aspect thereof, the present application provides an electronic device, comprising: one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the method of listening for non-responsive exceptions of any of the first aspect.
Compared with the prior art, the scheme of the embodiment of the application has at least the following beneficial effects:
the application provides a method, a device, a medium and electronic equipment for monitoring non-response abnormity. The method comprises the following steps: creating a monitoring thread and setting the value of a thread signal control parameter so as to control the monitoring thread to be the first thread in the thread group to receive signals; the thread group also comprises a monitoring thread; setting a monitoring thread as a first thread for receiving signals in a thread group according to the value of the thread signal control parameter; wherein the process termination signal is sent by the system service process to the first process; and the monitoring thread receives the process termination signal, sends no-response exception information to the system service process and forwards the process termination signal to the abnormal collection thread.
According to the method and the device, the ANR information is obtained by monitoring the SIGQUIT signal, so that the frequency of frequently sending the detection signal to the main thread is greatly reduced, the system burden is reduced, and the system performance is improved. The monitoring is synchronous with the ANR detection of the system, so that the missing report caused by time difference is avoided, and the data accuracy is ensured. Meanwhile, the system is not dependent on any system architecture, so that the stability and reliability of the system are ensured.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application. It is obvious that the drawings in the following description are only some embodiments of the application, and that for a person skilled in the art, other drawings can be derived from them without inventive effort. In the drawings:
FIG. 1 illustrates a flow diagram of a method of listening for a no response exception according to an embodiment of the present application;
FIG. 2 illustrates an information flow diagram of a method of listening for a no response exception according to an embodiment of the present application;
FIG. 3 is a diagram illustrating setting thread signal control parameters according to an embodiment of the present application;
FIG. 4 illustrates a block diagram of elements of an apparatus for listening for a no response exception, according to an embodiment of the present application;
fig. 5 shows a schematic diagram of an electronic device connection structure according to an embodiment of the application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be described in further detail with reference to the accompanying drawings, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terminology used in the embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the examples of this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise, and "a plurality" typically includes at least two.
It should be understood that the term "and/or" as used herein is merely one type of association that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
It should be understood that although the terms first, second, third, etc. may be used to describe technical names in embodiments of the present disclosure, the technical names should not be limited to the terms. These terms are only used to distinguish between technical names. For example, a first check signature may also be referred to as a second check signature, and similarly, a second check signature may also be referred to as a first check signature, without departing from the scope of embodiments of the present disclosure.
The words "if", as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
It is also noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that an 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 article or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of additional like elements in the article or device in which the element is contained.
Alternative embodiments of the present application are described in detail below with reference to the accompanying drawings.
A first embodiment provided by the present application is an embodiment of a method for listening for a non-response exception.
The following describes an embodiment of the present application in detail with reference to fig. 1 to fig. 3, where fig. 1 is a flowchart of a method for monitoring a non-response exception according to an embodiment of the present application; FIG. 2 illustrates an information flow diagram of a method of listening for a no response exception according to an embodiment of the present application; fig. 3 is a diagram illustrating setting of a thread signal control parameter according to an embodiment of the present application.
The method is applied to a first process in a first application system, and the first application system further comprises a system service process; the thread group created by the first process at initialization at least comprises: a main thread and a gather exception thread. For example, the first application system is an android system, the first process is an applet process (such as an APP process) running in the android system, and when a system service process (such as a SystemServer process) of the android system detects that a response pause occurs in the APP process during running, the SystemServer process displays an ANR dialog box to the user; the user can select 'wait' to enable the APP process to continue to run, and can also select 'forced close' to stop the running of the APP process; in response to the above working mechanism, the APP process includes at least a main thread (e.g., MainThread) and a collection exception thread (e.g., SignalCatcher thread); when the SignalCatch thread receives an SIGQUIT signal sent to the APP process by the SystemServer process, starting to collect abnormal information in the APP process and recording the abnormal information in a trace.txt file shared with the SystemServer process; when the SystemServer process detects that the trace.txt file is written completely, an ANR dialog box is displayed to a user; when the user selects 'forced closing', the SystemServer process sends a SIGKILL signal for forcing the process to stop to the APP process, and the MainThread thread automatically stops the APP process after receiving the SIGKILL signal.
The SIGQUIT signal is a program termination signal for notifying the foreground group of processes to terminate a process.
Because the detection behavior of ANR is performed by the system, the APP process cannot directly sense the occurrence of ANR, and therefore, an abnormal ANR monitoring function needs to be performed in the APP process. However, in the current monitoring working mode, a detection signal needs to be frequently sent to the main thread, so that the system load is increased, and the system performance is affected. Meanwhile, monitoring and ANR detection of the system cannot be synchronized, and time difference or report missing possibly exists to influence data accuracy. If the current mechanism is implemented at the Java layer, ANR may be caused by a Java lock, and the reporting process may also be affected, which also affects the data accuracy. Referring to fig. 1 and fig. 2, to solve the above problem, an embodiment of the present application provides a method for listening for a non-response exception, including the following steps:
step S101, creating a listening thread and setting a value of a thread signal control parameter so as to control the listening thread to be the first thread in the thread group to receive a signal.
In this case, the thread group includes at least: the method comprises a main thread, a collection exception thread and a monitoring thread.
Since the system service process sends a process termination signal to the first process each time ANR of the first process occurs. For example, continuing the example above, the SystemServer process sends a SIGQUIT signal to the APP process each time ANR of the APP process occurs. Therefore, the embodiment of the application utilizes the technical characteristics of the first application system to create the monitoring thread for intercepting the process termination signal sent by the system service process to the collection exception thread, so as to achieve the purpose of synchronously reporting the ANR.
Optionally, the creating a listening thread and setting a value of a thread signal control parameter so as to control the listening thread to be a first thread in the thread group that receives a signal includes the following steps:
and S101-11, when the first process is initialized, creating a monitoring thread and setting the value of a thread signal control parameter so as to control the monitoring thread to be the first thread for receiving signals.
And a monitoring thread is created when the first process is initialized, so that the monitoring thread starts monitoring work at the initial stage of the running of the first process, the first process can run stably, system resources are prevented from being consumed, and good user experience is guaranteed.
The order of processing signals in the thread group is the main thread, the collection exception thread, and then other threads, such as a listening thread. Since the main thread does not process the process termination signal, the thread collecting exception thread is the default first process termination signal thread. For example, continuing the above example, the SignalCatcher thread is the only thread in the APP process that can process the SIGQUIT signal, so the signals sent by the SystemServer process to the APP process are all processed by the SignalCatcher thread; and causes the first thread to receive a signal to switch from the main thread to the SignalCatcher thread.
In order to enable the listening thread to intercept the process termination signal, referring to fig. 3, optionally, the setting of the value of the thread signal control parameter to control the listening thread to be the first thread to receive the signal includes the following steps:
and S101-21, sequentially acquiring the thread signal control parameter of each thread in the thread group.
Wherein, the thread signal control parameters at least comprise: a first receive set signal parameter associated with the first receive set signal, a custom signal parameter associated with the custom signal, and a process termination signal parameter associated with the process termination signal. For example, continuing the above example, the thread signal control parameter is a signal mask bit for each thread, the first receive setup signal is a SIGHIPPE signal, the custom signal is a SIGURR 1 signal, and the process termination signal is a SIGQUIT signal.
And S101-22, setting the values of all thread signal control parameters of the monitoring thread to be in an open state.
And S101-23, setting the value of the first receiving setting signal parameter of the collection abnormal thread as a shielding state, and setting the values of the signal control parameters of other threads of the collection abnormal thread as an open state.
And S101-24, respectively setting the values of the first receiving setting signal parameter, the user-defined signal parameter and the process termination signal parameter of other threads in the thread group to be in a shielding state, wherein the values of the signal control parameters of other threads corresponding to the threads are all in an open state.
Step S102, setting the thread of the first received signal as a monitoring thread according to the value of the thread signal control parameter.
Wherein the process termination signal is sent by the system service process to the first process.
The purpose of this step is to set the listening thread as the first thread to receive a signal, i.e. as the default thread to receive a signal.
When the first process is initialized and after a monitoring thread is created, optionally, the setting of the monitoring thread as a first thread in a thread group that receives a signal according to a value of a thread signal control parameter includes:
and S102-11, setting the monitoring thread as the first thread receiving signals in the thread group according to the value of the thread signal control parameter when the first process is initialized.
The method for setting the monitoring thread as the first thread in the thread group to receive the signal according to the value of the thread signal control parameter comprises the following steps:
and S102-21, utilizing other threads except the monitoring thread in the thread group to send a first receiving setting signal to the thread group.
For example, continuing the example above, a siigpipe signal is sent to a thread group using a MainThread thread.
And step S102-22, based on the value of the first receiving setting signal parameter being in an open state, the monitoring thread receives the first receiving setting signal and is set as the thread of the first receiving signal in the thread group.
The first thread to receive a signal is the default processing thread. When the first process receives the signal, the first process checks whether the default processing thread is in a shielding state with the value of the thread signal control parameter associated with the signal. If not, the default processing thread processes the signal; if the state is the shielding state, other threads in the thread group are searched in sequence, a thread which does not shield the current signal is found, the default signal processing thread of the process is switched to the found thread which does not shield the current signal, and then the thread processes the signal.
Step S103, the monitoring thread receives the process termination signal, sends no-response abnormal information to the system service process, and forwards the process termination signal to the collection abnormal thread.
After the process termination signal is forwarded to the thread with collection exception, the method further comprises the following steps:
and step S104, the collection abnormal thread starts to collect abnormal information after receiving the process termination signal, and stores the abnormal information in a non-response abnormal information set shared with the system service process.
And step S105, storing the ending information of the abnormal information in a no-response abnormal information set shared with the system service process.
For example, please refer to fig. 2, continuing the above example, the SystemServer process sends an input event to the APP process, and detects the input event; when the SystemServer process does not detect the input event for more than 5 seconds, the SystemServer process sends an SIGQUIT signal to the APP process; the monitoring thread receives the SIGQUIT signal, reports ANR to the APP process, sends ANR information to the SystemServer process by the APP process, and sends the SIGGQUIT signal to the SignalCatcher thread; after receiving the SIGGQUIT signal, the SignalCatcher thread starts to collect the abnormal information of the APP process and stores the abnormal information in a trace.txt file shared with the SystemServer process; when the SystemServer process monitors and detects the end information of the trace.txt file, namely a file end symbol, the SystemServer process pops up an ANR dialog box; when the user selects 'forced closing', the SystemServer process sends a SIGKILL signal for forcing the process to stop to the APP process, and the MainThread thread automatically stops the APP process after receiving the SIGKILL signal.
Optionally, the method further comprises the following steps:
and step S106, the monitoring thread receives the self-defining signal and forwards the self-defining signal to the abnormal collecting thread.
For example, the custom signal is the SIGUSR1 signal.
According to the embodiment of the application, the ANR information is acquired by monitoring the SIGQUIT signal, so that the frequency of frequently sending the detection signal to the main thread is greatly reduced, the system burden is reduced, and the system performance is improved. The monitoring is synchronous with the ANR detection of the system, so that the missing report caused by time difference is avoided, and the data accuracy is ensured. Meanwhile, the system is not dependent on any system architecture, so that the stability and reliability of the system are ensured.
Corresponding to the first embodiment provided in the present application, the present application also provides a second embodiment, that is, an apparatus for monitoring a non-response exception. Since the second embodiment is basically similar to the first embodiment, the description is simple, and the relevant portions should be referred to the corresponding description of the first embodiment. The device embodiments described below are merely illustrative.
Fig. 4 illustrates an embodiment of an apparatus for listening for a non-response exception according to the present application. Fig. 4 is a block diagram of elements of an apparatus for listening for a non-response exception according to an embodiment of the present application. The method is applied to a first process in a first application system, and the first application system further comprises a system service process; the thread group created by the first process at initialization at least comprises: a main thread and a gather exception thread.
Referring to fig. 4, the present application provides an apparatus for monitoring a non-response exception, including: the device comprises a creating unit 201, a setting unit 202 and a reporting unit 203.
A creating unit 201, configured to create a listening thread and set a value of a thread signal control parameter so as to control the listening thread as a first thread in the thread group to receive a signal; the thread group also comprises a monitoring thread;
a setting unit 202, configured to set a monitoring thread as a thread that receives a signal first in a thread group according to a value of a thread signal control parameter; wherein the process termination signal is sent by the system service process to the first process;
a reporting unit 203, configured to receive the process termination signal by the listening thread, send no-response exception information to the system service process, and forward the process termination signal to the thread that collects the exception.
Optionally, the creating unit 201 includes:
and the creating subunit is used for creating a monitoring thread and setting the value of the thread signal control parameter so as to control the monitoring thread to be the first thread in the thread group to receive signals when the first process is initialized.
Optionally, the setting unit 202 includes:
And the setting subunit is used for setting the monitoring thread as the first thread receiving the signal in the thread group according to the value of the thread signal control parameter when the first process is initialized.
Optionally, the creating unit 201 includes:
the parameter acquiring subunit is used for sequentially acquiring the thread signal control parameters of each thread in the thread group; wherein, the thread signal control parameters at least comprise: a first reception setting signal parameter associated with the first reception setting signal, a custom signal parameter associated with the custom signal, and a process termination signal parameter associated with the process termination signal;
a thread monitoring parameter setting subunit, configured to set all thread signal control parameters of a thread to be monitored to be in an open state;
the thread parameter collecting subunit is used for setting the value of a first receiving setting signal parameter of the thread with abnormal collection to be in a shielding state, and setting the values of other thread signal control parameters of the thread with abnormal collection to be in an open state;
and the other thread parameter setting subunit is used for respectively setting the values of the first receiving setting signal parameter, the user-defined signal parameter and the process termination signal parameter of other threads in the thread group to be in a shielding state, and the values of the other thread signal control parameters of the corresponding threads are all in an open state.
Optionally, the setting unit 202 includes:
a first receiving setting signal sending subunit, configured to send a first receiving setting signal to the thread group by using another thread in the thread group except the monitoring thread;
and the first receiving signal thread subunit is arranged for setting the value of the first receiving setting signal parameter as an open state, and the monitoring thread receives the first receiving setting signal and is set as the thread of the first receiving signal in the thread group.
Optionally, the apparatus further comprises:
and the unit for receiving the custom signal is used for monitoring the thread to receive the custom signal and forwarding the custom signal to the thread with abnormal collection.
Optionally, the apparatus further comprises:
and the abnormal information collecting unit is used for collecting abnormal information after the abnormal thread receives the process termination signal and storing the abnormal information in a non-response abnormal information set shared with the system service process.
Optionally, the apparatus further comprises:
and the end information saving unit is used for saving the end information of the abnormal information in a no-response abnormal information set shared with the system service process.
According to the embodiment of the application, the ANR information is acquired by monitoring the SIGQUIT signal, so that the frequency of frequently sending the detection signal to the main thread is greatly reduced, the system burden is reduced, and the system performance is improved. The monitoring is synchronous with the ANR detection of the system, so that the missing report caused by time difference is avoided, and the data accuracy is ensured. Meanwhile, the system is not dependent on any system architecture, so that the stability and reliability of the system are ensured.
An embodiment of the present application provides a third embodiment, that is, an electronic device, where the electronic device is used in a method for monitoring a non-response exception, and the electronic device includes: at least one processor; and a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the one processor to cause the at least one processor to perform the method of snooping non-responsive exceptions of the first embodiment.
The fourth embodiment provides a computer storage medium for monitoring an unresponsive exception, where the computer storage medium stores computer-executable instructions that can execute the method for monitoring an unresponsive exception described in any of the above method embodiments.
Referring to fig. 5, a schematic structural diagram of an electronic device suitable for implementing an embodiment of the disclosure is shown. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 5 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 5, the electronic device may include a processing means (e.g., a central processing unit, a graphic processor, etc.) 301 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)302 or a program loaded from a storage means 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data necessary for the operation of the electronic apparatus are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
Generally, the following devices may be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 307 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 308 including, for example, magnetic tape, hard disk, etc.; and a communication device 309. The communication means 309 may allow the electronic device to communicate wirelessly or by wire with other devices to exchange data. While fig. 5 illustrates an electronic device having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, the processes described above with reference to the flow diagrams may be implemented as computer software programs, according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 309, or installed from the storage means 308, or installed from the ROM 302. The computer program, when executed by the processing device 301, performs the above-described functions defined in the methods of embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring at least two internet protocol addresses; sending a node evaluation request comprising the at least two internet protocol addresses to node evaluation equipment, wherein the node evaluation equipment selects the internet protocol addresses from the at least two internet protocol addresses and returns the internet protocol addresses; receiving an internet protocol address returned by the node evaluation equipment; wherein the obtained internet protocol address indicates an edge node in the content distribution network.
Alternatively, the computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: receiving a node evaluation request comprising at least two internet protocol addresses; selecting an internet protocol address from the at least two internet protocol addresses; returning the selected internet protocol address; wherein the received internet protocol address indicates an edge node in the content distribution network.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a limitation of the unit itself, for example, the first retrieving unit may also be described as a "unit for retrieving at least two internet protocol addresses".
Claims (11)
1. A method for monitoring non-response exception is applied to a first process in a first application system, and the first application system also comprises a system service process; the thread group created by the first process at initialization at least comprises: the main thread and the collection exception thread are characterized by comprising the following steps:
creating a monitoring thread and setting the value of a thread signal control parameter so as to control the monitoring thread to be the first thread in the thread group to receive signals; the thread group also comprises a monitoring thread;
setting a monitoring thread as a first thread for receiving signals in a thread group according to the value of the thread signal control parameter;
and intercepting a process termination signal sent to the abnormal collection thread by the system service process by the monitoring thread, sending no-response abnormal information to the system service process, and forwarding the process termination signal to the abnormal collection thread.
2. The method of claim 1, wherein creating a listening thread and setting a value of a thread signal control parameter for controlling the listening thread to be a first thread in a thread group to receive a signal comprises:
and when the first process is initialized, creating a monitoring thread and setting the value of a thread signal control parameter so as to control the monitoring thread to be the first thread in the thread group to receive signals.
3. The method of claim 2, wherein setting the listening thread to be the first thread in the thread group to receive the signal according to the value of the thread signal control parameter comprises:
and when the first process is initialized, setting the monitoring thread as the first thread in the thread group for receiving the signal according to the value of the thread signal control parameter.
4. A method according to any one of claims 1 to 3, wherein setting the value of the thread signal control parameter to control the listening thread to be the first thread to receive a signal comprises:
sequentially acquiring a thread signal control parameter of each thread in a thread group; wherein, the thread signal control parameters at least comprise: a first reception setting signal parameter associated with the first reception setting signal, a custom signal parameter associated with the custom signal, and a process termination signal parameter associated with the process termination signal;
Setting all thread signal control parameter values of the monitoring thread to be in an open state;
setting the value of a first receiving setting signal parameter of the abnormal thread as a shielding state, and setting the values of other thread signal control parameters of the abnormal thread as an open state;
and respectively setting the values of the first receiving setting signal parameter, the user-defined signal parameter and the process termination signal parameter of other threads in the thread group as a shielding state, wherein the values of the signal control parameters of other threads corresponding to the threads are all in an open state.
5. The method of claim 4, wherein setting the listening thread to be the first thread in the thread group to receive the signal according to the value of the thread signal control parameter comprises:
sending a first receiving setting signal to the thread group by using other threads except the monitoring thread in the thread group;
and the monitoring thread receives the first receiving setting signal and is set as the thread of the first receiving signal in the thread group based on the value of the first receiving setting signal parameter being in an open state.
6. The method of claim 4, further comprising:
and the monitoring thread receives the self-defining signal and forwards the self-defining signal to the abnormal collecting thread.
7. The method of claim 1, further comprising, after said forwarding the process termination signal to a thread that collects exceptions:
and the abnormal information collection thread starts to collect abnormal information after receiving the process termination signal and stores the abnormal information in a non-response abnormal information set shared with the system service process.
8. The method of claim 7, wherein the saving the exception information in a no-response exception information set shared with the system service process further comprises:
and storing the ending information of the abnormal information in a non-response abnormal information set shared with the system service process.
9. A device for monitoring no-response exception is applied to a first process in a first application system, and the first application system also comprises a system service process; the thread group created by the first process at initialization at least comprises: the main thread and the collection exception thread are characterized by comprising the following steps:
the creating unit is used for creating a monitoring thread and setting the value of a thread signal control parameter so as to control the monitoring thread to be the first thread which receives signals in the thread group; the thread group also comprises a monitoring thread;
The setting unit is used for setting the monitoring thread as a first thread for receiving signals in the thread group according to the value of the thread signal control parameter;
and the reporting unit is used for controlling the monitoring thread to intercept the process termination signal sent by the system service process to the collection abnormal thread, sending no-response abnormal information to the system service process and forwarding the process termination signal to the collection abnormal thread.
10. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the method according to any one of claims 1 to 8.
11. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to carry out the method of any one of claims 1 to 8.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910494794.4A CN110377341B (en) | 2019-06-10 | 2019-06-10 | Method, device, medium and electronic equipment for monitoring no-response exception |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910494794.4A CN110377341B (en) | 2019-06-10 | 2019-06-10 | Method, device, medium and electronic equipment for monitoring no-response exception |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN110377341A CN110377341A (en) | 2019-10-25 |
| CN110377341B true CN110377341B (en) | 2022-05-03 |
Family
ID=68249876
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201910494794.4A Active CN110377341B (en) | 2019-06-10 | 2019-06-10 | Method, device, medium and electronic equipment for monitoring no-response exception |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN110377341B (en) |
Families Citing this family (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110908860B (en) * | 2019-10-28 | 2023-06-09 | 北京字节跳动网络技术有限公司 | Java thread acquisition method and device, medium and electronic equipment |
| CN111625425A (en) * | 2020-05-28 | 2020-09-04 | 北京达佳互联信息技术有限公司 | Data monitoring method, device and system |
| CN113672454B (en) * | 2021-07-30 | 2022-08-12 | 荣耀终端有限公司 | Freeze screen monitoring method, electronic device and computer-readable storage medium |
| CN114067851B (en) * | 2021-09-30 | 2023-07-21 | 高德软件有限公司 | Signal source processing method and device and nonvolatile storage medium |
| CN114138514A (en) * | 2021-11-29 | 2022-03-04 | 广东明创软件科技有限公司 | Information acquisition method, apparatus, electronic device, computer-readable medium and product |
| CN116132370A (en) * | 2023-02-14 | 2023-05-16 | 深信服科技股份有限公司 | Abnormal flow identification method and device, electronic equipment and storage medium |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1904852A (en) * | 2006-08-01 | 2007-01-31 | 西安西电捷通无线网络通信有限公司 | Method for monitoring and abnormal processing of computer application program |
| JP2008197885A (en) * | 2007-02-13 | 2008-08-28 | Nec Corp | Application abnormal end processing system method therefor and program |
| CN104268055A (en) * | 2014-09-01 | 2015-01-07 | 腾讯科技(深圳)有限公司 | Program exception monitoring method and device |
| CN105446806A (en) * | 2014-09-28 | 2016-03-30 | 广州市动景计算机科技有限公司 | Processing method and apparatus for application not responding |
| CN109324946A (en) * | 2018-09-10 | 2019-02-12 | 天津字节跳动科技有限公司 | Operational monitoring method, apparatus, electronic equipment and computer readable storage medium |
| CN109582536A (en) * | 2018-11-05 | 2019-04-05 | 广州华多网络科技有限公司 | Report method, device and computer equipment of the application program without response |
Family Cites Families (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7823021B2 (en) * | 2005-05-26 | 2010-10-26 | United Parcel Service Of America, Inc. | Software process monitor |
| US7702959B2 (en) * | 2005-08-02 | 2010-04-20 | Nhn Corporation | Error management system and method of using the same |
| JP2010146436A (en) * | 2008-12-22 | 2010-07-01 | Canon It Solutions Inc | Monitoring system, control method and program |
| JP5516292B2 (en) * | 2010-09-30 | 2014-06-11 | 富士通株式会社 | End log acquisition program, end log acquisition device, and end log acquisition method |
| CN105573854A (en) * | 2014-10-17 | 2016-05-11 | 中兴通讯股份有限公司 | Terminal application processing method and device |
| CN106776206A (en) * | 2016-12-03 | 2017-05-31 | 乐视控股(北京)有限公司 | The method of monitor process state, device and electronic equipment |
-
2019
- 2019-06-10 CN CN201910494794.4A patent/CN110377341B/en active Active
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1904852A (en) * | 2006-08-01 | 2007-01-31 | 西安西电捷通无线网络通信有限公司 | Method for monitoring and abnormal processing of computer application program |
| JP2008197885A (en) * | 2007-02-13 | 2008-08-28 | Nec Corp | Application abnormal end processing system method therefor and program |
| CN104268055A (en) * | 2014-09-01 | 2015-01-07 | 腾讯科技(深圳)有限公司 | Program exception monitoring method and device |
| CN105446806A (en) * | 2014-09-28 | 2016-03-30 | 广州市动景计算机科技有限公司 | Processing method and apparatus for application not responding |
| CN109324946A (en) * | 2018-09-10 | 2019-02-12 | 天津字节跳动科技有限公司 | Operational monitoring method, apparatus, electronic equipment and computer readable storage medium |
| CN109582536A (en) * | 2018-11-05 | 2019-04-05 | 广州华多网络科技有限公司 | Report method, device and computer equipment of the application program without response |
Non-Patent Citations (1)
| Title |
|---|
| 基于Android应用的性能管理方案研究与实现;成斌;《信息科技辑》;20190115(第12期);第I138-526页 * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN110377341A (en) | 2019-10-25 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN110377341B (en) | Method, device, medium and electronic equipment for monitoring no-response exception | |
| CN110865898B (en) | Method, device, medium and equipment for converging crash call stack | |
| CN109857506B (en) | Method and device for realizing guide information, electronic equipment and storage medium | |
| JP7467644B2 (en) | Message processing method, device and electronic device | |
| CN113505302A (en) | Method, device and system for supporting dynamic acquisition of buried point data and electronic equipment | |
| CN108446211B (en) | Browser exception collection method, device, mobile terminal and storage medium | |
| CN111813641B (en) | Method, device, medium and equipment for collecting crash information | |
| CN110881224B (en) | Network long connection method, device, equipment and storage medium | |
| CN111367698B (en) | Application program flash back detection and processing method and device and electronic equipment | |
| CN113806212A (en) | Application program exception positioning method and device and electronic equipment | |
| CN105847325A (en) | Method and device for debugging application client side | |
| CN109522198A (en) | Processing method, device, electronic equipment and the readable storage medium storing program for executing of application program | |
| CN107644075B (en) | Method and device for collecting page information | |
| CN113032172B (en) | Abnormality detection method and device and electronic equipment | |
| CN110765085A (en) | Log information writing method, system, storage medium and mobile terminal | |
| CN114064376B (en) | Page monitoring method and device, electronic equipment and medium | |
| CN110989877B (en) | Message management method, related equipment and computer readable storage medium | |
| CN114398233B (en) | Load abnormality detection method and device, server and storage medium | |
| CN109492163B (en) | List display recording method and device, terminal equipment and storage medium | |
| CN109634702B (en) | Information prompting method and device, electronic equipment and readable medium | |
| CN110941549B (en) | Memory leak detection method, device, medium and electronic equipment | |
| CN112182581B (en) | Application testing method, device, application testing equipment and storage medium | |
| CN110086880B (en) | Method and apparatus for creating instances of network requests | |
| CN113760503A (en) | Task migration method, apparatus, electronic device, and computer-readable medium | |
| US11782579B2 (en) | Desktop display control by intelligently nesting one object in another object |
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 |