CN118094043A - Page collapse detection method and device - Google Patents

Page collapse detection method and device Download PDF

Info

Publication number
CN118094043A
CN118094043A CN202410093813.3A CN202410093813A CN118094043A CN 118094043 A CN118094043 A CN 118094043A CN 202410093813 A CN202410093813 A CN 202410093813A CN 118094043 A CN118094043 A CN 118094043A
Authority
CN
China
Prior art keywords
thread
server
main
instruction
working
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410093813.3A
Other languages
Chinese (zh)
Inventor
王睿宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Zhongyuan Network Co ltd
Original Assignee
Shanghai Zhongyuan Network 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 Shanghai Zhongyuan Network Co ltd filed Critical Shanghai Zhongyuan Network Co ltd
Priority to CN202410093813.3A priority Critical patent/CN118094043A/en
Publication of CN118094043A publication Critical patent/CN118094043A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs
    • 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/3636Software debugging by tracing the execution of the program

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Databases & Information Systems (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the application provides a page crash detection method and device, wherein a message channel and a working thread are created through a main thread, a server thread is registered, then the working thread and the server thread can communicate through configuring the message channel, a heartbeat message is sent to the server thread by the working thread according to a preset period, and once the heartbeat message is not received beyond a first preset duration, the page rendered by the main thread is determined to crash. Since the working thread is ended when the page rendered by the main thread breaks down, the main thread does not break down the page, the working thread always sends heartbeat information, and the working thread stops when the main thread breaks down the page and operates independently of the main thread, so that the operation of the main thread is not affected, the situation that the main thread does not respond timely due to various reasons such as page popup and the like, and the false alarm is caused can be reduced, and the page breakdown detection efficiency is improved.

Description

Page collapse detection method and device
Technical Field
The application relates to the technical field of product application, in particular to a page collapse detection method and device.
Background
Page crashes are the inability of a page to continue running because of a variety of reasons that cause the page to lose response. In the prior art, in the scheme for monitoring page collapse, a timer is started by a page main thread to send heartbeats, and the page collapse is monitored by the scheme for monitoring the heartbeats. However, when the heartbeat is sent to various blocking timers such as a page popup window, the heartbeat is not sent in time, and the situation is misreported as breakdown, so that interference is caused.
Content of the application
The embodiment of the application aims to provide a page collapse detection method and device, so as to reduce false alarm conditions and improve detection efficiency when page collapse detection is carried out. The specific technical scheme is as follows:
in a first aspect of the present application, there is provided a method for detecting page collapse, the method including:
responding to an opening instruction of a client side aiming at a main thread, creating a message channel and a working thread through the main thread and registering a server thread; the working thread runs independently of the main thread, and ends when a page rendered by the main thread crashes;
Configuring the message channel by the working thread and the server thread in response to a construction instruction sent by the main thread, so that the working thread communicates with the server thread;
Sending a heartbeat message to the server thread according to a preset period by the working thread in response to a first starting instruction sent by the main thread;
If the heartbeat message is not received by the server thread after the first preset time period is exceeded, determining that the page rendered by the main thread is crashed.
In one possible embodiment, if the heartbeat message is not received by the server thread for more than a first preset duration, the main thread rendered page crashes, including:
Detecting whether a heartbeat message is received or not through the server thread every other preset second preset duration;
If the heartbeat message is not received by the server thread after the first preset time period is exceeded, determining that the page rendered by the main thread is crashed.
In one possible embodiment, the method further comprises:
Responding to a standby instruction of the client side for the main thread, and sending a pause instruction to the working thread and the server thread through the main thread;
Suspending sending a heartbeat message by the working thread in response to the suspension instruction;
and responding to the pause instruction through the server thread, and pausing the step of detecting whether heartbeat messages are received or not through the server thread every other preset second preset duration.
In one possible embodiment, after the step of suspending, by the server thread in response to the suspension instruction, every second preset duration, whether a heartbeat message is received is detected by the server thread, the method further comprises:
Responding to a wake-up instruction of the client for the main thread, and sending a second starting instruction to the working thread by the main thread;
and the working thread responds to the second starting instruction and continuously sends heartbeat information to the server thread according to a preset period.
In one possible embodiment, the method further comprises:
responding to a closing instruction of the client side for the main thread, closing the working thread by the main thread, unloading the main thread, and sending a termination instruction to the server thread;
And the server thread responds to the termination instruction, and terminates the step of detecting whether heartbeat messages are received or not through the server thread every second preset time length.
In one possible embodiment, after receiving the heartbeat message, the server thread updates a heartbeat record, and stores the heartbeat record in a browser local database, where the heartbeat record is used to determine whether the heartbeat message is received by the server thread over a first preset duration.
In a second aspect of the present application, there is also provided a page collapse detection device, the device including:
The creation module is used for responding to an opening instruction of the client side for the main thread, creating a message channel and a working thread through the main thread and registering a server thread; the working thread runs independently of the main thread, and ends when a page rendered by the main thread crashes;
the configuration module is used for responding to the construction instruction sent by the main thread through the working thread and the server thread, and configuring the message channel so that the working thread is communicated with the server thread;
The sending module is used for responding to the first starting instruction sent by the main thread through the working thread and sending heartbeat information to the server thread according to a preset period;
And the crash detection module is used for determining that the page rendered by the main thread crashes if the heartbeat message is not received by the server thread after the first preset time period is exceeded.
In a possible embodiment, the crash detection module, if no heartbeat message is received by the server thread for more than a first preset duration, causes a crash of a page rendered by the main thread, including:
Detecting whether a heartbeat message is received or not through the server thread every other preset second preset duration;
If the heartbeat message is not received by the server thread after the first preset time period is exceeded, determining that the page rendered by the main thread is crashed.
In one possible embodiment, the apparatus further comprises:
The standby module is used for responding to a standby instruction of the client side for the main thread and sending a pause instruction to the working thread and the server thread through the main thread;
Suspending sending a heartbeat message by the working thread in response to the suspension instruction;
and responding to the pause instruction through the server thread, and pausing the step of detecting whether heartbeat messages are received or not through the server thread every other preset second preset duration.
In one possible embodiment, after the step of the standby module detecting, by the server thread, whether a heartbeat message is received by the server thread every second preset duration in response to the pause instruction, the apparatus further comprises:
the wake-up module is used for responding to a wake-up instruction of the client side for the main thread, and the main thread sends a second starting instruction to the working thread;
and the working thread responds to the second starting instruction and continuously sends heartbeat information to the server thread according to a preset period.
In one possible embodiment, the apparatus further comprises:
The closing module is used for responding to a closing instruction of the client side for the main thread, closing the working thread by the main thread, unloading the main thread and sending a termination instruction to the server thread;
And the server thread responds to the termination instruction, and terminates the step of detecting whether heartbeat messages are received or not through the server thread every second preset time length.
In one possible embodiment, after receiving the heartbeat message, the server thread updates a heartbeat record, and stores the heartbeat record in a browser local database, where the heartbeat record is used to determine whether the heartbeat message is received by the server thread over a first preset duration.
In a third aspect of the present application, there is provided an electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of the above first aspects when executing a program stored on a memory.
In a fourth aspect of the application, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method steps of any of the first aspects described above.
According to the page crash detection method and device provided by the embodiment of the application, the message channel and the working thread are created through the main thread, the server thread is registered, then the working thread and the server thread can communicate through the configuration message channel, the heartbeat message is sent to the server thread by the working thread according to the preset period, and once the heartbeat message is not received beyond the first preset duration, the page rendered by the main thread is determined to crash. In the embodiment of the application, as the working thread is ended when the page rendered by the main thread breaks down, the main thread does not break down the page, the working thread always sends the heartbeat message, and the working thread stops when the main thread breaks down the page and operates independently of the main thread, so that the operation of the main thread is not influenced, the situation of false report caused by the fact that the main thread does not respond in time due to various reasons such as page popup can be reduced, and the efficiency of page breakdown detection is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application 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 schematic flow chart of a page crash detection method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a page detect crash system according to an embodiment of the present application;
FIG. 3 is a schematic diagram of an interaction process of a main thread, a working thread, and a server thread provided in the embodiment of the present application;
FIG. 4 is a schematic diagram of a page collapse detection device according to an embodiment of the present application;
fig. 5 is a schematic diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application.
In order to solve the problem of false alarm of page crash detection caused by various reasons such as system popup window, the embodiment of the application provides a page crash detection method, as shown in fig. 1, which comprises the following steps:
S101, responding to an opening instruction of a client side for a main thread, creating a message channel and a working thread through the main thread, and registering a server thread.
S102, responding to the construction instruction sent by the main thread through the working thread and the server thread, and configuring a message channel so that the working thread and the server thread can communicate.
S103, sending heartbeat messages to the server thread according to a preset period by the working thread in response to the first starting instruction sent by the main thread.
And S104, if the heartbeat message is not received through the server thread after the first preset time period is exceeded, determining that the page rendered by the main thread crashes.
In this embodiment, since the working thread ends when the main thread renders the page crashes, the main thread does not generate the page crashes, the working thread always sends the heartbeat message, and the working thread stops when the main thread generates the page crashes, and the working thread operates independently of the main thread, so as not to affect the operation of the main thread, the situation that the main thread does not respond in time due to various reasons such as page popup, and thus false alarm is caused can be reduced, and the efficiency of page crash detection is improved.
The above-described S101 to S104 will be described in detail below.
In S101, after the client opens the target page, an open instruction is sent to the main thread corresponding to the target page. In response to the open instruction, the main thread registers a server thread for obtaining data required at the main thread.
The worker thread runs independently of the main thread and ends when the page rendered by the main thread crashes. The worker thread is a JavaScript running in the background, running in a separate context from the main thread. The life cycle of the working thread is controlled by the main thread, i.e. the main thread can start or end a working thread, and when the working thread ends, the working thread started by the main thread also ends. That is, the main thread creates a working thread, and the life cycle of the working thread can be controlled by the main thread, and when the page rendered by the main thread crashes, the working thread ends when the main thread ends. The timing of creating the working thread by the main thread is determined by a person skilled in the art according to actual requirements, and the present application is not limited in any way.
The server thread is an independent thread capable of running in the background of the browser and can continuously run after the main thread is finished. The server thread may listen for heartbeats by querying the heartbeat record.
In one possible embodiment, the worker thread may be a web worker and the server may be a service worker.
The main thread creates a message channel for the purpose of communicating between the worker thread and the server thread.
At S102, CHANNEL MESSAGING API (channel information interface) in the main thread may cause the main thread to create a message channel, then send data via MessagePort (information port) attribute of the message channel, create MESSAGECHANNEL (information channel), send build instructions to the worker thread, then transfer MessagePort1 ownership to the worker thread, send build instructions to the server thread, and transfer MessagePort2 ownership to the server thread.
And responding to the construction instruction by the working thread, acquiring MessagePort1 of the message channel, storing parameters and data related to the working thread, and designating MessagePort message processing functions, thereby realizing that the message from the server thread in the message channel can be received.
In response to the build instruction, the server thread retrieves MessagePort of the message channel, stores parameters and data associated with the server thread, and specifies MessagePort message handling functions. In addition, the current session information is stored, and because the life cycle of the server thread is completely independent of the main thread, it is necessary to use a js (JavaScript) object sessionMap (session map) to store the current session information in session id (Identity document): a message channel port and a page client id.
And the configured message channel can realize the communication between the working thread and the server thread.
In S103, when the heartbeat needs to be started, the main thread sends a first start instruction to the working thread, where the first start instruction is used to instruct the working thread to start the heartbeat.
The preset period is set by those skilled in the art according to the actual application scenario. For example, it may be 5S or 10S.
The worker thread sends heartbeat messages via MessagePort a, i.e., to the server thread.
In S104, the first preset duration is set by those skilled in the art according to the actual application scenario, and may be, for example, 15S or 20S.
After receiving the heartbeat message, the server thread updates the time and data (e.g., project name, running environment, etc.) corresponding to the current session in the memory. If the heartbeat message is not received through the server thread after the first preset duration is detected, determining that the page rendered by the main thread is crashed, generating a crash log by the server thread after determining to send the crash, reporting the crash log to a server background, and informing the server background that the page rendered by the main thread is crashed, so that the server background is in response.
In one possible embodiment, after receiving the heartbeat message, the server thread updates a heartbeat record, and stores the heartbeat record in a browser local database, where the heartbeat record is used to determine whether the heartbeat message is received by the server thread over a first preset duration.
According to the embodiment of the application, the heartbeat record is stored in the browser local database, the server thread can acquire the heartbeat record from the browser local database, and then judge whether the heartbeat record exceeds the first preset duration and whether the heartbeat message is received by the server thread or not based on the heartbeat record, so that whether the page rendered by the main thread is crashed or not is determined, the storage pressure of the server thread can be reduced, and the efficiency of the server thread is improved.
In order to improve the efficiency of detecting crash detection by the server thread, the server thread may specifically start a timer for heartbeat detection. Specifically, the step S104 may include:
s1041, detecting whether a heartbeat message is received or not through the server thread every second preset time length.
S1042, if the heartbeat message is not received by the server thread after the first preset time period is exceeded, determining that the page rendered by the main thread is crashed.
In the above steps, the time interval of the second preset duration may be the same as or different from the time interval of the first preset duration, specifically, the time interval may be set by a person skilled in the art according to the actual application scenario. For example, assuming that the second preset duration is 10S and the first preset duration is 15S, every 10S checks the heartbeat message, and if the heartbeat message is not received in more than 15S, it is determined that the page rendered by the main thread crashes. And if the second preset duration is 10S and the first preset duration is 10S, checking the heartbeat message every 10S, and if the heartbeat message is not received in more than 10S, determining that the page rendered by the main thread crashes.
In this embodiment, a timer for heartbeat detection is started by the server thread, whether heartbeat messages are received is detected every second preset time length, and if the heartbeat messages are not received by the server thread after the first preset time length is exceeded, it is determined that a page rendered by the main thread crashes. Whether the heartbeat message is received or not is detected every second preset time length, and detection is carried out at intervals, so that the new heartbeat message can be ensured to exist during each detection, and the possibility of invalid detection can be reduced.
In one possible embodiment, when the client switches pages or minimizes the browser or waits, the main thread is already in a halt, but the working thread will continuously generate heartbeat messages to the server thread, and if the main thread continues to work, the heartbeat time recorded in the server thread is greatly different from the actual working time of the main thread, and the heartbeat detection is not accurate enough.
Based on this, the above method further comprises:
s105, responding to a standby instruction of the client side for the main thread, and sending a pause instruction to the working thread and the server thread through the main thread.
In this step, the standby instruction is an instruction sent to the main thread by the client when switching pages or minimizing the browser or standby, and is used to inform the main thread that the main thread needs to be suspended.
The pause instruction is used for indicating the work thread and the server thread to pause work.
S106, sending the heartbeat message is suspended by the working thread in response to the suspension instruction.
S107, responding to a pause instruction through the server thread, and pausing the step of detecting whether heartbeat messages are received or not through the server thread every other preset second preset duration.
In this step, the server thread pauses receiving the heartbeat message and deletes the heartbeat record in the current session, so that the heartbeat time better corresponds to the working time of the main thread when the heartbeat is resumed later.
In this embodiment, when the client switches pages or minimizes the browser or waits, the main thread is controlled to suspend sending the heartbeat message, so that the main thread is suspended and the heartbeat of the working thread is suspended, so that the heartbeat of the working thread is kept consistent with the heartbeat of the main thread, and the accuracy of heartbeat detection is improved.
After suspending the step of detecting whether the heartbeat message is received by the server thread every second preset duration if the target page needs to be switched back to or the maximized browser or the awakening computer is needed, the method further comprises the following steps of:
S108, responding to a wake-up instruction of the client side for the main thread, and sending a second start instruction to the working thread by the main thread.
In this step, the wake-up instruction is an instruction sent to the main thread by the client when switching back to the target page or maximizing the browser or waking up the computer, and is used to inform the main thread that the main thread needs to be woken up.
The second starting instruction is used for indicating the working thread to restart the heartbeat after suspending the heartbeat.
And S109, the working thread responds to the second starting instruction and continues to send heartbeat messages to the server thread according to a preset period.
In one possible embodiment, when the user closes the page or closes the browser, the page detection corresponding to other main threads is not affected. The method further comprises the following steps:
S110, responding to a closing instruction of the client side for the main thread, closing the working thread by the main thread, unloading the main thread, and sending a termination instruction to the server thread.
In this step, the closing instruction is an instruction sent to the main thread by the client when closing the page or closing the browser, and is used to inform the main thread that the main thread needs to be ended.
And S111, the server thread responds to the termination instruction, and the step of detecting whether heartbeat messages are received or not through the server thread every second preset time length is terminated.
In this step, the server thread may delete the heartbeat record in the current session while terminating receiving the heartbeat message, so that the heartbeat record of the server thread is in an initialized state when a new target page is subsequently reopened.
The embodiment of the application also provides a page collapse detection system, as shown in fig. 2, comprising:
a main thread, which is used for responding to the starting instruction of the client side for the main thread, creating a message channel, a working thread and registering a server thread; the working thread runs independently of the main thread, and ends when a page rendered by the main thread crashes;
a worker thread, configured to configure the message channel in response to a build instruction sent by the main thread, such that the worker thread communicates with the server thread; responding to a first starting instruction sent by the main thread, and sending a heartbeat message to the server thread according to a preset period;
a server thread for configuring the message channel in response to a build instruction sent by the main thread, such that the worker thread communicates with the server thread; if the heartbeat message is not received by the server thread after the first preset time period is exceeded, determining that the page rendered by the main thread is crashed.
Specifically, the interaction process of the main thread, the working thread and the server thread is shown in fig. 3.
In this embodiment, since the working thread ends when the main thread renders the page crashes, the main thread does not generate the page crashes, the working thread always sends the heartbeat message, and the working thread stops when the main thread generates the page crashes, and the working thread operates independently of the main thread, so as not to affect the operation of the main thread, the situation that the main thread does not respond in time due to various reasons such as page popup, and thus false alarm is caused can be reduced, and the efficiency of page crash detection is improved.
The application also provides a page collapse detection device, as shown in fig. 4, which comprises:
A creating module 401, configured to create a message channel, a working thread and register a server thread through a main thread in response to an opening instruction of a client for the main thread; the working thread runs independently of the main thread, and ends when a page rendered by the main thread crashes;
A configuration module 402, configured to configure the message channel by the working thread and the server thread in response to a build instruction sent by the main thread, so that the working thread communicates with the server thread;
A sending module 403, configured to send, by using the working thread, a heartbeat message to the server thread according to a preset period in response to a first start instruction sent by the main thread;
and the crash detection module 404 is configured to determine that the page rendered by the main thread crashes if no heartbeat message is received by the server thread beyond a first preset duration.
In a possible embodiment, the crash detection module 404, if no heartbeat message is received by the server thread for more than a first preset duration, causes a crash of a page rendered by the main thread, including:
Detecting whether a heartbeat message is received or not through the server thread every other preset second preset duration;
If the heartbeat message is not received by the server thread after the first preset time period is exceeded, determining that the page rendered by the main thread is crashed.
In one possible embodiment, the apparatus further comprises:
A standby module 405, configured to send a pause instruction to the working thread and the server thread through the main thread in response to a standby instruction of the client for the main thread;
Suspending sending a heartbeat message by the working thread in response to the suspension instruction;
and responding to the pause instruction through the server thread, and pausing the step of detecting whether heartbeat messages are received or not through the server thread every other preset second preset duration.
In a possible embodiment, after the step of detecting, by the standby module 405, by the server thread, whether a heartbeat message is received or not, by the server thread, in response to the pause instruction, the apparatus further comprises:
a wake module 406, configured to respond to a wake instruction of the client for the main thread, where the main thread sends a second start instruction to the working thread;
and the working thread responds to the second starting instruction and continuously sends heartbeat information to the server thread according to a preset period.
In one possible embodiment, the apparatus further comprises:
A closing module 407, configured to respond to a closing instruction of the client for the main thread, where the main thread closes the working thread, uninstalls the main thread, and sends a termination instruction to the server thread;
And the server thread responds to the termination instruction, and terminates the step of detecting whether heartbeat messages are received or not through the server thread every second preset time length.
In one possible embodiment, after receiving the heartbeat message, the server thread updates a heartbeat record, and stores the heartbeat record in a browser local database, where the heartbeat record is used to determine whether the heartbeat message is received by the server thread over a first preset duration.
The embodiment of the application also provides an electronic device, as shown in fig. 5, comprising a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502, the memory 503 complete the communication with each other through the communication bus 504,
A memory 503 for storing a computer program;
the processor 501 is configured to execute the program stored in the memory 503, and implement the following steps:
responding to an opening instruction of a client side aiming at a main thread, creating a message channel and a working thread through the main thread and registering a server thread; the working thread runs independently of the main thread, and ends when a page rendered by the main thread crashes;
Configuring the message channel by the working thread and the server thread in response to a construction instruction sent by the main thread, so that the working thread communicates with the server thread;
Sending a heartbeat message to the server thread according to a preset period by the working thread in response to a first starting instruction sent by the main thread;
If the heartbeat message is not received by the server thread after the first preset time period is exceeded, determining that the page rendered by the main thread is crashed.
The above-mentioned communication bus may be a peripheral component interconnect standard (PERIPHERAL COMPONENT INTERCONNECT, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the terminal and other devices.
The memory may include random access memory (Random Access Memory, RAM) or may include 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 aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, abbreviated as CPU), a network processor (Network Processor, abbreviated as NP), etc.; but may also be a digital signal Processor (DIGITAL SIGNAL Processor, DSP), application Specific Integrated Circuit (ASIC), field-Programmable gate array (FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components.
In yet another embodiment of the present application, a computer readable storage medium is provided, where a computer program is stored, where the computer program, when executed by a processor, implements the page collapse detection method according to any one of the foregoing embodiments.
In yet another embodiment of the present application, a computer program product containing instructions that, when run on a computer, cause the computer to perform the page fault detection method of any of the above embodiments is also provided.
In the above embodiments, it may be implemented in whole or in part 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, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk Solid STATE DISK (SSD)), etc.
It is noted that relational terms such as first and second, and the like are 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. Moreover, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (10)

1. A method for detecting page collapse, the method comprising:
responding to an opening instruction of a client side aiming at a main thread, creating a message channel and a working thread through the main thread and registering a server thread; the working thread runs independently of the main thread, and ends when a page rendered by the main thread crashes;
Configuring the message channel by the working thread and the server thread in response to a construction instruction sent by the main thread, so that the working thread communicates with the server thread;
Sending a heartbeat message to the server thread according to a preset period by the working thread in response to a first starting instruction sent by the main thread;
If the heartbeat message is not received by the server thread after the first preset time period is exceeded, determining that the page rendered by the main thread is crashed.
2. The method of claim 1, wherein if no heartbeat message is received by the server thread for more than a first predetermined period of time, the page rendered by the main thread crashes, comprising:
detecting whether a heartbeat message is received or not through the server thread every second preset time length;
If the heartbeat message is not received by the server thread after the first preset time period is exceeded, determining that the page rendered by the main thread is crashed.
3. The method according to claim 1 or 2, characterized in that the method further comprises:
Responding to a standby instruction of the client side for the main thread, and sending a pause instruction to the working thread and the server thread through the main thread;
Suspending sending a heartbeat message by the working thread in response to the suspension instruction;
and responding to the pause instruction through the server thread, and pausing the step of detecting whether heartbeat messages are received or not through the server thread every other preset second preset duration.
4. A method according to claim 3, wherein after the step of detecting by the server thread whether a heartbeat message is received by the server thread in response to the pause instruction pausing every second preset time period, the method further comprises:
Responding to a wake-up instruction of the client for the main thread, and sending a second starting instruction to the working thread by the main thread;
and the working thread responds to the second starting instruction and continuously sends heartbeat information to the server thread according to a preset period.
5. The method according to claim 2, wherein the method further comprises:
responding to a closing instruction of the client side for the main thread, closing the working thread by the main thread, unloading the main thread, and sending a termination instruction to the server thread;
And the server thread responds to the termination instruction, and terminates the step of detecting whether heartbeat messages are received or not through the server thread every second preset time length.
6. The method of claim 1, wherein after the server thread receives the heartbeat message, updating a heartbeat record, and storing the heartbeat record in a browser local database, wherein the heartbeat record is used for determining whether the heartbeat message is received by the server thread over a first preset duration.
7. A page collapse detection device, the device comprising:
The creation module is used for responding to an opening instruction of the client side for the main thread, creating a message channel and a working thread through the main thread and registering a server thread; the working thread runs independently of the main thread, and ends when a page rendered by the main thread crashes;
the configuration module is used for responding to the construction instruction sent by the main thread through the working thread and the server thread, and configuring the message channel so that the working thread is communicated with the server thread;
The sending module is used for responding to the first starting instruction sent by the main thread through the working thread and sending heartbeat information to the server thread according to a preset period;
And the crash detection module is used for determining that the page rendered by the main thread crashes if the heartbeat message is not received by the server thread after the first preset time period is exceeded.
8. The apparatus of claim 7, wherein the crash detection module, if no heartbeat message is received by the server thread beyond a first preset duration, causes a crash of a page rendered by the main thread, comprising:
Detecting whether a heartbeat message is received or not through the server thread every other preset second preset duration;
if the heartbeat message is not received through the server thread after the first preset time period is exceeded, determining that the page rendered by the main thread is crashed;
The apparatus further comprises:
The standby module is used for responding to a standby instruction of the client side for the main thread and sending a pause instruction to the working thread and the server thread through the main thread;
Suspending sending a heartbeat message by the working thread in response to the suspension instruction;
Suspending, by the server thread, the step of detecting whether a heartbeat message is received by the server thread every a preset second preset duration in response to the suspension instruction;
After the step that the standby module responds to the pause instruction to pause the detection of whether the heartbeat message is received or not through the server thread at every second preset time period through the server thread, the device further comprises:
the wake-up module is used for responding to a wake-up instruction of the client side for the main thread, and the main thread sends a second starting instruction to the working thread;
The working thread responds to the second starting instruction and continuously sends heartbeat information to the server thread according to a preset period;
The apparatus further comprises:
The closing module is used for responding to a closing instruction of the client side for the main thread, closing the working thread by the main thread, unloading the main thread and sending a termination instruction to the server thread;
The server thread responds to the termination instruction, and terminates the step of detecting whether heartbeat messages are received or not through the server thread every second preset duration;
After receiving the heartbeat message, the server thread updates a heartbeat record, and stores the heartbeat record into a browser local database, wherein the heartbeat record is used for judging whether the heartbeat message is received by the server thread or not when the first preset duration is exceeded.
9. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for carrying out the method steps of any one of claims 1-6 when executing a program stored on a memory.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored therein a computer program which, when executed by a processor, implements the method steps of any of claims 1-6.
CN202410093813.3A 2024-01-23 2024-01-23 Page collapse detection method and device Pending CN118094043A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410093813.3A CN118094043A (en) 2024-01-23 2024-01-23 Page collapse detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410093813.3A CN118094043A (en) 2024-01-23 2024-01-23 Page collapse detection method and device

Publications (1)

Publication Number Publication Date
CN118094043A true CN118094043A (en) 2024-05-28

Family

ID=91144939

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410093813.3A Pending CN118094043A (en) 2024-01-23 2024-01-23 Page collapse detection method and device

Country Status (1)

Country Link
CN (1) CN118094043A (en)

Similar Documents

Publication Publication Date Title
EP3952423A1 (en) Method and device for determining terminal behavior analysis
JP4156663B2 (en) Method and apparatus for monitoring and controlling a program in a network
JP2021521528A (en) Task processing method, equipment and system
CN106412091A (en) Method, device and system for controlling data transmission
CN107729213B (en) Background task monitoring method and device
CN104615497A (en) Thread hanging processing method and device
CN109981737B (en) Network request processing method, device, terminal and storage medium
CN113835985B (en) Method, device and equipment for monitoring and analyzing jamming reason
CN114978883B (en) Network wakeup management method and device, electronic equipment and storage medium
US20140368332A1 (en) Terminal and application synchronization method therefor
CN104065526A (en) Server fault alarming method and device thereof
CN111130867B (en) Intelligent household equipment alarm method and device based on Internet of things
CN100492992C (en) Alarm processing method and its device
CN109032767B (en) Asynchronous multi-process business processing system, method, device and storage medium
CN106326060A (en) Baseplate management control system and method for same
CN111949421B (en) SDK calling method, device, electronic equipment and computer readable storage medium
CN112148508B (en) Information processing method and related device
CN113542256A (en) Method, device, equipment and storage medium for updating login credentials in client
CN113283350A (en) Operation event prompting method and device, storage medium and electronic device
CN118094043A (en) Page collapse detection method and device
CN116860552A (en) Application program operation monitoring method and device, electronic equipment and storage medium
WO2020024402A1 (en) Traffic feature management method and apparatus, and central node server
CN112214437B (en) Storage device, communication method and device and computer readable storage medium
CN115190052A (en) Long connection management method, system and control unit
CN115580522A (en) Method and device for monitoring running state of container cloud platform

Legal Events

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