Summary of the invention
In view of the above problems, present disclose provides a kind of for handling the playback terminal exception based on Electron platform
Method and device.Using this method and device, can detect in time and restore playback terminal exception, thus reduce loss of assets and
Manpower maintenance cost.
According to one aspect of the disclosure, it provides a kind of abnormal for handling the playback terminal based on Electron platform
Method, comprising: detection playback terminal anomalous event, the playback terminal anomalous event include that host process is abnormal, rendering process
The abnormal, page is without response abnormality and/or HTML5 page exception;It is Electron in detected playback terminal anomalous event
When the host process exception of application, module is restarted via the application in finger daemon to restart the Electron and apply to restore master
The operation of process;When detected playback terminal anomalous event is to render process exception or the page without response abnormality, via master
The error handling module of process restarts corresponding rendering process;Or it is in detected playback terminal anomalous event
When HTML5 page exception, the corresponding HTML5 page is loaded via the error handling module of rendering process.
Optionally, in an example of above-mentioned aspect, detection playback terminal anomalous event may include: to keep via described
Shield process inspects periodically whether host process in the system process list of the playback terminal detects whether to lead in operation
Process exception.
Optionally, in an example of above-mentioned aspect, detection playback terminal anomalous event may include: via described
The collapse abnormality detection module of Electron platform come detect whether occur rendering process exception;Or via the finger daemon
Inspect periodically the rendering process in the system process list of the playback terminal whether operation come detect whether to render into
Cheng Yichang.
Optionally, in an example of above-mentioned aspect, detection playback terminal anomalous event may include: via the master
Process is detected using heartbeat message testing mechanism be currently running in rendering process the page whether occurs without response abnormality.
Optionally, it in an example of above-mentioned aspect, is examined via the host process using heartbeat message testing mechanism
Survey be currently running in rendering process whether occur the page without response abnormality may include: via host process in being currently running
Rendering process sends heartbeat message;And the response message in response to not receiving heartbeat message from rendering process, determine wash with watercolours
The page occurs for dye process without response abnormality.
Optionally, in an example of above-mentioned aspect, detection playback terminal anomalous event may include: via render into
Journey captures page fault events using the error handle function registered in the HTLM5 page, detects whether that the generation HTLM5 page is different
Often.
Optionally, in an example of above-mentioned aspect, the error handle function includes in following error handle functions
At least one: window.onerror and window.onunhandledrejection;And the page fault events packet
Include at least one of following page fault events: the webglcontextlost event of WebGL, video and audio
Stalled event.
According to another aspect of the present disclosure, it provides a kind of for handling the playback terminal exception based on Electron platform
Device, comprising: accident detection unit detects playback terminal anomalous event, the playback terminal anomalous event include it is main into
Cheng Yichang, rendering process exception, the page are without response abnormality and/or HTML5 page exception;Host process recovery unit is being detected
To playback terminal anomalous event be Electron application host process exception when, via in finger daemon application restart module
To restart the Electron using the operation to restore the host process;Process resumption unit is rendered, in detected broadcasting
Terminal abnormal event is when rendering process exception or the page without response abnormality, to weigh via the error handling module of the host process
Open corresponding rendering process;And page recovery unit, it is HTML5 page exception in detected playback terminal anomalous event
When, the corresponding HTML5 page is loaded via the error handling module of the rendering process.
Optionally, in an example of above-mentioned aspect, the accident detection unit may include: host process exception
Detection module inspects periodically whether the host process in the system process list of the playback terminal is transporting via the finger daemon
Row is abnormal to detect whether generation host process.
Optionally, in an example of above-mentioned aspect, the accident detection unit may include: that rendering process is different
Normal detection module detects whether to occur to render process exception via the collapse abnormality detection module of the Electron platform,
Or inspect periodically whether the rendering process in the system process list of the playback terminal is running via the finger daemon
To detect whether to occur rendering process exception.
Optionally, in an example of above-mentioned aspect, the accident detection unit may include: that page response is different
Whether normal detection module, the rendering process detected via the host process using heartbeat message testing mechanism in being currently running are sent out
The raw page is without response abnormality.
Optionally, in an example of above-mentioned aspect, the accident detection unit may include: page exception inspection
Module is surveyed, captures page fault events using the error handle function registered in the HTLM5 page via rendering process, detection is
No generation HTLM5 page exception.
According to the another aspect of the disclosure, a kind of calculating equipment is also provided, comprising: one or more processors, Yi Jiyu
The memory of one or more of processor couplings, the memory store instruction, when described instruction is by one or more
When a processor executes, so that at least one described processor executes as described above for handling based on Electron platform
The method of playback terminal exception.
According to the another further aspect of the disclosure, a kind of machine readable storage medium is also provided, executable instruction is stored with, institute
Stating instruction executes the machine as described above for handling the playback terminal based on Electron platform
Abnormal method.
According to the disclosure for handling the method and device of the playback terminal exception based on Electron platform, Neng Gouji
When detect and to restore the various playback terminals that occur in playback terminal abnormal, to reduce loss of assets and manpower maintenance cost.
Specific embodiment
Theme described herein is discussed referring now to example embodiment.It should be understood that discussing these embodiments only
It is in order to enable those skilled in the art can better understand that being not to claim to realize theme described herein
Protection scope, applicability or the exemplary limitation illustrated in book.It can be in the protection scope for not departing from present disclosure
In the case of, the function and arrangement of the element discussed are changed.Each example can according to need, omit, substitute or
Add various processes or component.For example, described method can be executed according to described order in a different order, with
And each step can be added, omits or combine.In addition, feature described in relatively some examples is in other examples
It can be combined.
As used in this article, term " includes " and its modification indicate open term, are meant that " including but not limited to ".
Term "based" indicates " being based at least partially on ".Term " one embodiment " and " embodiment " expression " at least one implementation
Example ".Term " another embodiment " expression " at least one other embodiment ".Term " first ", " second " etc. may refer to not
Same or identical object.Here may include other definition, either specific or implicit.Unless bright in context
It really indicates, otherwise the definition of a term is consistent throughout the specification.
As used in this article, term " Electron " refer to by Github exploitation use HTML, CSS and
JavaScript constructs the open source library of cross-platform multipad.Specifically, Electron uses Node.js (as rear
End) and Chromium (as front end) completion desktop GUI application program Cross-border congestion management.Currently, Electron has been created
Extensive application program including VScode and Atom.
As used in this article, term " host process is abnormal " refers to that host process collapse is abnormal.Term " rendering process exception "
Refer to that the collapse of rendering process is abnormal.Term " PNR is abnormal " refers to the page shown in rendering process without different caused by response
Often.For example, the page leads to stuck (PNR is abnormal) due to having run error-logic, so that the page can not after PNR exception
Any interactive operation is carried out with user.Term " HTML5 page exception " refers to the different of the HTML5 page shown in rendering process
Often.
Under Electron platform, the operation of entire application program is run using the mode of multi-process.It is handed over for the page
Mutual visualization interface is the operation in rendering process (Render Process).For managing all Render Process
Process be referred to as host process (Main Process).Host process is the entrance process of application program.
In existing Electron platform technology, collapse (Crash) exception handling of Electron platform is used
To play out terminal abnormal detection and restore.However, this exception handling can only detect and restore Render
The collapse of Process is abnormal, and the collapse that can not handle Main Process is abnormal abnormal with the PNR of Render Process,
So that abnormal restoring processing is imperfect, cause to cannot achieve abnormality detection and recovery under many abnormal conditions.
In the disclosure, a kind of technical solution that can be realized complete abnormal restoring processing, in this scenario, energy are provided
It enough detects Main Process abnormal, Render Process exception, PNR exception and HTML5 page exception, and phase is provided
The recovery scheme answered carries out abnormal restoring processing.
Fig. 1 shows according to an embodiment of the present disclosure for handling the playback terminal exception based on Electron platform
The flow chart of method.
As shown in Figure 1, whether playback terminal of the detection based on Electron platform occurs playback terminal exception in block 110
Event.The playback terminal anomalous event includes that host process collapse is abnormal, the collapse of rendering process is abnormal, the page is without response abnormality
And/or HTML5 page exception.How to detect whether the playback terminal based on Electron platform occurs playback terminal exception thing
Part will be described below with reference to Fig. 2-Fig. 4.
After detecting that playback terminal anomalous event occurs for the playback terminal based on Electron platform, based on detected
Playback terminal anomalous event type carry out corresponding abnormal restoring processing.
Specifically, in the Main that detected playback terminal anomalous event is Electron application (Electron APP)
When Process exception, in block 121, via the application weight in finger daemon (Agent APP is referred to as " demon agent ")
(APP Restart) module is opened to restart Electron using the operation to restore Main Process.Here, Agent APP
It is and Electron APP application program independent of each other.In general, Agent APP and Electron APP be installed in for example with
In on the playback terminal for playing advertisement.Main Process and Render Process be run in Electron APP into
Journey.
When detected playback terminal anomalous event is Render Process exception, in block 123, via Main
Error handle (Error Handler) module of Process restarts corresponding Render Process.
When detected playback terminal anomalous event is PNR exception, in block 125, via the Error of Main Process
Handler module restarts corresponding Render Process.
When detected playback terminal anomalous event is HTML5 page exception, in block 127, via Render
The Error Handler module of Process loads the corresponding HTML5 page.For example, by Error Handler module come
Refresh page, record front end error log are to complete the recovery process of the entire HTLM5 page.
Fig. 2 shows the flow charts of an instantiation procedure of playback terminal abnormality detection according to an embodiment of the present disclosure.
As shown in Fig. 2, firstly, it is abnormal whether detection playback terminal occurs Main Process in block 111.For example, one
In a example, Main Process in the system process list of playback terminal can be inspected periodically via Agent APP whether
It is abnormal to detect whether Main Process occurs in operation.
When detecting generation Main Process exception, proceed to block 121, executes Main Process abnormal restoring mistake
Journey.When generation Main Process exception is not detected, process proceeds to block 113.
In block 113, detect whether playback terminal occurs Render Process exception.It, can be with for example, in one example
It detects whether that rendering process exception occurs via the collapse abnormality detection module of Electron platform.Alternatively, in another example
In, it can inspect periodically whether the rendering process in the system process list of playback terminal is running, via Agent APP to examine
It surveys and whether occurs to render process exception.
When detecting generation Render Process exception, proceed to block 123, it is extremely extensive to execute Render Process
Multiple process.When generation Render Process exception is not detected, process proceeds to block 115.
In block 115, detect whether playback terminal occurs PNR exception.For example, in one example, it can be via host process
Detect whether the rendering process in being currently running occurs the page without response abnormality using heartbeat message testing mechanism.
Fig. 3 shows according to an embodiment of the present disclosure for detecting the schematic diagram of the process of PNR exception.
As shown in figure 3, Render Process of the Main Process in being currently running sends heartbeat and disappears in block 310
Breath.Then, in block 320, Main Process monitors whether to receive the response for heartbeat message from Render Process
Message (that is, heartbeat response).It will be clear that in one example, Main Process can be in predetermined monitoring period of time
It inside monitors whether to receive heartbeat response from Render Process.The predetermined monitoring period of time is, for example, to disappear from having sent heartbeat
One section of predetermined time after breath.
If being not received by heartbeat response, for example, if being not received by heartbeat response in predetermined monitoring period of time,
In block 330, determines and PNR exception occurs.If receiving heartbeat response, in block 340, determine that there is no PNR exceptions, that is,
Page response is normal.
When detecting generation PNR exception, proceed to block 125, executes PNR abnormal restoring process.Occur being not detected
When PNR exception, process proceeds to block 117.
In block 117, detect whether that HTML5 page exception occurs.For example, in one example, it can be via Render
Process captures page fault events using the error handle function registered in the HTLM5 page, thus detects whether to occur
HTLM5 page exception.In the disclosure, the error handle function may include at least one in following error handle functions
It is a: window.onerror and window.onunhandledrejection.The page fault events may include following pages
At least one of face error event: webglcontextlost event, the Stalled event of video and audio of WebGL.
When detecting generation HTLM5 page exception, proceed to block 127, executes HTML5 page exception recovery process.In
When generation HTML5 page exception is not detected, process proceeds to block 111, continues the monitoring of playback terminal anomalous event.
Fig. 4 shows the relational graph between each process in playback terminal according to an embodiment of the present disclosure.Such as Fig. 4 institute
Show, in the disclosure, related process includes Agent APP (finger daemon), Main Process and Render
Process.Main Process and Render Process are the processes run in Electron APP.
APP Restart module and monitoring the process (Process Monitor) module are provided on Agent APP.
Process Monitor module can inspect periodically Main Process in the system process list of playback terminal and/or
Whether Render Process is running, to detect whether that generation Main Process exception and/or Render Process are different
Often.When Main Process exception occurs, APP Restart module restarts Electron application to restore Main Process
Operation.
It is provided with Error Handler module on Main Process and heartbeat sends (Heart Beat Sender) mould
Block.When Render Process exception or PNR exception occurs, Error Handler module restarts corresponding Render
Process restores the operation of Render Process.Heart Beat Sender module is regularly to Render Process
Heartbeat receive (Heart Beat Receiver) module and send heartbeat message, for detecting whether that PNR occurs is abnormal.
Be provided on Render Process Error Handler module, Heart Beat Receiver module and
HTML5 fault monitoring module.The error handle function registered in the HTLM5 page can be used to catch in HTML5 fault monitoring module
Page fault events are obtained, thus detect whether that HTLM5 page exception occurs.The error handle function may include
Window.onerror and/or window.onunhandledrejection.The page fault events may include WebGL
At least one of webglcontextlost event, video and the Stalled event of audio.When HTLM5 exception occurs,
The corresponding HTML5 page of Error Handler module loading completes the recovery process of the entire HTLM5 page.
The playback terminal according to an embodiment of the present disclosure based on Electron platform is described above with reference to Fig. 1 to Fig. 4
Playback terminal abnormality eliminating method.
It will be clear that Main Process is different during playback terminal accident detection shown in figure 2
Often, Render Process exception, PNR exception and HTML5 page exception are sequence detections.In the other embodiments of the disclosure
In, Main Process is abnormal, Render Process is abnormal, PNR exception and HTML5 page exception detection is also possible to solely
Vertical detection.For example, in Main Process exception, Render Process exception, PNR exception and HTML5 page exception
At least two be parallel detection.
Fig. 5 shows the block diagram of playback terminal exception handling device 500 according to an embodiment of the present disclosure.
As shown in figure 5, playback terminal exception handling device 500 includes abnormality detecting unit 510, host process recovery unit
520, process resumption unit 530 and page recovery unit 540 are rendered.
Accident detection unit 510 is configured as detection playback terminal anomalous event, the playback terminal anomalous event
, rendering process exception abnormal including host process, the page are without response abnormality and/or HTML5 page exception.
Host process recovery unit 520 is configured as in detected playback terminal anomalous event being Electron application
When host process exception, Electron is restarted via the APP Restart module in Agent APP and is applied to restore Main
The operation of Process.
Rendering process resumption unit 530 is configured as in detected playback terminal anomalous event being rendering process exception
Or the page without response abnormality when, corresponding Render is restarted via the Error Handler module of Main Process
Process, to restore rendering process exception or the page without response abnormality.
Page recovery unit 540 is configured as when detected playback terminal anomalous event is HTML5 page exception,
The corresponding HTML5 page is loaded via the Error Handler module of Render Process, it is different to restore the HTML5 page
Often.
Fig. 6 shows an exemplary block diagram of accident detection unit 510 according to an embodiment of the present disclosure.Such as
Shown in Fig. 6, accident detection unit 510 include host process abnormality detection module 511, rendering process exception detection module 513,
Page response abnormality detection module 515 and page exception detection module 517.
Host process abnormality detection module 511 is configured as inspecting periodically the system process of playback terminal via Agent APP
Whether Main Process in list is abnormal to detect whether host process occurs in operation.
Rendering process exception detection module 513 is configured as examining via the collapse abnormality detection module of Electron platform
It surveys and whether occurs to render process exception, or inspected periodically in the system process list of playback terminal via Agent APP
Render Process whether operation come detect whether occur rendering process exception.
Page response abnormality detection module 515 is configured as coming via Main Process using heartbeat message testing mechanism
Detect whether the Render Process in being currently running occurs PNR exception.
Page exception detection module 517 is configured as using the mistake registered in the HTLM5 page via Render Process
It handles function accidentally to capture page fault events, detects whether that HTLM5 page exception occurs.
Above with reference to Fig. 1 to Fig. 6, to according to the abnormal for handling the playback terminal based on Electron platform of the disclosure
Method and the embodiment of playback terminal exception handling device be described.Playback terminal exception handling device above can be with
Using hardware realization, can also be realized using the combination of software or hardware and software.
Fig. 7 is according to embodiment of the disclosure for handling the calculating of the playback terminal exception based on Electron platform
The structural block diagram of equipment.
As shown in fig. 7, calculating equipment 700 may include at least one processor 710, memory 720, memory 730, communication
Interface 740 and internal bus 750, and at least one processor 710, memory 720, memory 730 and communication interface 740 pass through
It is linked together by bus 750.At least one processor 710 is executed at computer readable storage medium (that is, memory 720)
At least one computer-readable instruction (that is, above-mentioned element realized in a software form) of middle storage or coding.
In one embodiment, it is stored with computer executable instructions in memory 720, makes when implemented at least
One processor 710: detection playback terminal anomalous event, the playback terminal anomalous event include host process is abnormal, render into
Cheng Yichang, the page are without response abnormality and/or HTML5 page exception;It is in detected playback terminal anomalous event
When the host process exception of Electron application, module is restarted via the application in finger daemon to restart the Electron and apply
To restore the operation of host process;It is rendering process exception or the page without response abnormality in detected playback terminal anomalous event
When, corresponding rendering process is restarted via the error handling module of host process;Or it is abnormal in detected playback terminal
When event is HTML5 page exception, the corresponding HTML5 page is loaded via the error handling module of rendering process.
It should be understood that the computer executable instructions stored in memory 720 make at least one when implemented
Processor 710 carries out the above various operations and functions described in conjunction with Fig. 1-6 in each embodiment of the disclosure.
In the disclosure, calculating equipment 700 can include but is not limited to: personal computer, server computer, work
It stands, desktop computer, laptop computer, notebook computer, mobile computing device, smart phone, tablet computer, bee
Cellular telephone, personal digital assistant (PDA), hand-held device, messaging devices, wearable calculating equipment, consumer-elcetronics devices etc.
Deng.
According to one embodiment, a kind of program product of such as non-transitory machine readable media is provided.Non-transitory
Machine readable media can have instruction (that is, above-mentioned element realized in a software form), which when executed by a machine, makes
It obtains machine and executes the above various operations and functions described in conjunction with Fig. 1-6 in each embodiment of the disclosure.
Specifically, system or device equipped with readable storage medium storing program for executing can be provided, stored on the readable storage medium storing program for executing
Realize above-described embodiment in any embodiment function software program code, and make the system or device computer or
Processor reads and executes the instruction being stored in the readable storage medium storing program for executing.
In this case, it is real that any one of above-described embodiment can be achieved in the program code itself read from readable medium
The function of example is applied, therefore the readable storage medium storing program for executing of machine readable code and storage machine readable code constitutes of the invention one
Point.
The embodiment of readable storage medium storing program for executing include floppy disk, hard disk, magneto-optic disk, CD (such as CD-ROM, CD-R, CD-RW,
DVD-ROM, DVD-RAM, DVD-RW, DVD-RW), tape, non-volatile memory card and ROM.It selectively, can be by communication network
Network download program code from server computer or on cloud.
It will be appreciated by those skilled in the art that each embodiment disclosed above can be in the situation without departing from invention essence
Under make various changes and modifications.Therefore, protection scope of the present invention should be defined by the appended claims.
It should be noted that step and unit not all in above-mentioned each process and each system construction drawing is all necessary
, certain step or units can be ignored according to the actual needs.Each step execution sequence be not it is fixed, can be according to need
It is determined.Apparatus structure described in the various embodiments described above can be physical structure, be also possible to logical construction, that is, have
A little units may be realized by same physical entity, be realized alternatively, some units may divide by multiple physical entities, alternatively, can be with
It is realized jointly by certain components in multiple autonomous devices.
In the above various embodiments, hardware cell or module mechanically or can be realized electrically.For example, one
Hardware cell, module or processor may include permanent dedicated circuit or logic (such as special processor, FPGA or
ASIC) corresponding operating is completed.Hardware cell or processor can also include programmable logic or circuit (such as general processor or
Other programmable processors), interim setting can be carried out by software to complete corresponding operating.Concrete implementation mode is (mechanical
Mode or dedicated permanent circuit or the circuit being temporarily arranged) it can be determined based on cost and temporal consideration.
The specific embodiment illustrated above in conjunction with attached drawing describes exemplary embodiment, it is not intended that may be implemented
Or fall into all embodiments of the protection scope of claims." exemplary " meaning of the term used in entire this specification
Taste " be used as example, example or illustration ", be not meant to than other embodiments " preferably " or " there is advantage ".For offer pair
The purpose of the understanding of described technology, specific embodiment include detail.However, it is possible in these no details
In the case of implement these technologies.In some instances, public in order to avoid the concept to described embodiment causes indigestion
The construction and device known is shown in block diagram form.
The foregoing description of present disclosure is provided so that any those of ordinary skill in this field can be realized or make
Use present disclosure.To those skilled in the art, the various modifications carried out to present disclosure are apparent
, also, can also answer generic principles defined herein in the case where not departing from the protection scope of present disclosure
For other modifications.Therefore, present disclosure is not limited to examples described herein and design, but disclosed herein with meeting
Principle and novel features widest scope it is consistent.