CN103942113A - System restarting reason detection method, device and terminal equipment - Google Patents

System restarting reason detection method, device and terminal equipment Download PDF

Info

Publication number
CN103942113A
CN103942113A CN201310594935.2A CN201310594935A CN103942113A CN 103942113 A CN103942113 A CN 103942113A CN 201310594935 A CN201310594935 A CN 201310594935A CN 103942113 A CN103942113 A CN 103942113A
Authority
CN
China
Prior art keywords
thread
lock
mutual exclusion
message
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201310594935.2A
Other languages
Chinese (zh)
Other versions
CN103942113B (en
Inventor
李明浩
袁军
梁金祥
闫昊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xiaomi Technology Co Ltd
Xiaomi Inc
Original Assignee
Xiaomi Inc
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 Xiaomi Inc filed Critical Xiaomi Inc
Priority to CN201310594935.2A priority Critical patent/CN103942113B/en
Publication of CN103942113A publication Critical patent/CN103942113A/en
Application granted granted Critical
Publication of CN103942113B publication Critical patent/CN103942113B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiment of the invention discloses a system restarting reason detection method, device and terminal equipment. The system restarting reason detection method includes the steps that after an intelligent terminal is restarted, firstly, a system journal file needs to be obtained, then whether the system journal file contains process information for ending a system process compulsively or not is found out, when the process information for ending the system process compulsively is contained, related thread stack data are obtained, and the reason for system deadlock is obtained according to the thread stack data; when the reason for system deadlock is interlocking between threads, the interlocked threads are determined; when the reason for system deadlock is that the lock time of the threads exceeds a preset time, the threads with the lock time exceeding the preset time are determined. Consequently, after the intelligent terminal is restarted, whether restarting is caused by system deadlock or not can be detected rapidly, if restarting is caused by system deadlock, deadlock threads can be determined rapidly, research personnel do not need to analyze system messages one by one, and therefore the speed is high, and the efficiency is high.

Description

System is restarted detection method, device and the terminal device of reason
Technical field
The disclosure relates to field of computer technology, particularly relates to system and restarts the detection method of reason, device and terminal device.
Background technology
Along with the widespread use of intelligent terminal, intelligent terminal manufacturer, in order to release the product with own characteristic, can customize one's own system (for example, Android system) for the intelligent terminal degree of depth of oneself conventionally.Due to the understand systematicly deficiency of system research and development personnel to intelligent terminal, coding is lack of standardization, makes system resource allocation strategy improper, causes process (or thread) because of competitive resource produce of deadlock phenomenon, and then causes system frequently to be restarted.But after intelligent terminal is restarted, system research and development personnel need one by one analytic system message to determine whether to restart because deadlock causes intelligent terminal, this kind mode speed is slow, efficiency is low.
Summary of the invention
The detection method, device and the terminal device that in disclosure embodiment, provide system to restart reason, to realize after intelligent terminal is restarted, can detect fast and efficiently whether because system deadlock causes restarting, if while causing system to be restarted due to system deadlock, can determine fast the thread that causes system deadlock.
In order to solve the problems of the technologies described above, disclosure embodiment discloses following technical scheme:
First aspect, the disclosure provides a kind of system to restart the detection method of reason, comprising: obtain syslog file; Search the process message that whether comprises pressure ends with system process in described syslog file; In the time comprising the process message of forcing ends with system process in syslog file, obtain thread stacks data, and cause the reason of system deadlock according to described thread stacks data acquisition; Because when cross-thread interlocking, determine the thread of interlocking when causing system deadlock former; , determine and hold the thread that the lock time exceedes Preset Time because thread is held the lock time while exceeding Preset Time when causing system deadlock former.
In conjunction with first aspect, in the possible implementation of first aspect the first, also comprise: search in the process message of described pressure ends with system process whether comprise thread title, in the time comprising thread title in the process message of described pressure ends with system process, carry out the step of obtaining thread stacks data; In the time not comprising thread title, determine that thread holds the lock time and exceed Preset Time and cause system deadlock.
In conjunction with first aspect or the possible implementation of first aspect the first, in the possible implementation of first aspect the second, obtain thread stacks data, and cause the step of the reason of system deadlock according to described thread stacks data acquisition, in the following way:
Obtain the first thread stacked data corresponding to the first thread in described process message;
Whether search in described the first thread stacked data and comprise and wait for mutual exclusion lock message, described wait mutual exclusion lock message comprises the second thread of holding the first mutual exclusion lock that thread is waited for;
When the first thread stacked data does not comprise while waiting for mutual exclusion lock message, determine that the first thread holds the lock time and exceed Preset Time and cause system deadlock;
In the time that the first thread stacked data exists wait mutual exclusion lock message, obtain the second thread stacks data corresponding to the second thread of holding the first mutual exclusion lock that thread is waited for;
Search in described the second thread stacks data and whether comprise and wait for mutual exclusion lock message;
When the second thread stacks data do not comprise while waiting for mutual exclusion lock message, determine that the second thread holds lock overlong time and cause system deadlock;
When the second thread stacks packet is when waiting for mutual exclusion lock message, judge whether the second thread and the first thread form to hold lock dependence;
When the second thread and the first thread form while holding lock dependence, determine because cross-thread interlocking causes system deadlock;
When the second thread and the first thread do not form while holding lock dependence, using the thread of holding the second mutual exclusion lock that thread is waited for as the second new thread, return to carry out and obtain second new thread correspondence the second thread stacks data.
In conjunction with the possible implementation of the second of first aspect, in the third possible implementation of first aspect, judge whether the second thread and the first thread form the step of holding lock dependence, in the following way:
Judge whether the mutual exclusion lock that the first thread is held is the mutual exclusion lock that the second thread is waited for; The mutual exclusion lock of holding when the first thread be the second thread wait for mutual exclusion lock time, determine that the first thread and the second cross-thread form to hold lock dependence; The mutual exclusion lock of holding when the first thread be not the second thread wait for mutual exclusion lock time, determine that the first thread and the second cross-thread do not form to hold lock dependence.
In conjunction with the possible implementation of the second of first aspect, in the 4th kind of possible implementation of first aspect, judge whether the second thread and the first thread form the step of holding lock dependence, in the following way:
According to the wait mutual exclusion lock message in the thread stacks data that obtain, build and hold lock dependence diagram data; Described in judgement, hold in lock dependence diagram data whether have loop, if described in hold lock dependence diagram data and have loop, determine because each thread on loop forms and hold lock dependence.
In conjunction with the third possible implementation of first aspect or the 4th kind of possible implementation of first aspect, in the 5th kind of possible implementation of first aspect, determine that it is the thread of interlocking that formation is held the thread of lock dependence.
Second aspect, the disclosure also provides a kind of system to restart the pick-up unit of reason, comprising:
The first acquiring unit, for obtaining syslog file;
First searches unit, whether comprises the process message of forcing ends with system process for described syslog file;
Second acquisition unit, when comprise the process message of forcing ends with system process when described syslog file, obtains thread stacks data, and causes the reason of system deadlock according to the thread stacks data acquisition obtaining;
The first determining unit, for when causing system deadlock former because when cross-thread interlocking, determine the thread of interlocking;
The second determining unit, for when causing system deadlock former because thread is held the lock time while exceeding Preset Time, determine and hold the thread that the lock time exceedes Preset Time.
In conjunction with second aspect, in the possible implementation of second aspect the first, also comprise:
Second searches unit, whether comprises thread title for the process message of searching described pressure ends with system process, in the time comprising thread title in the process message of described pressure ends with system process, triggers second acquisition unit and obtains thread stacks data; In the time not comprising thread title, determine that thread holds the lock time and exceed Preset Time and cause system deadlock.
In conjunction with second aspect or the possible implementation of second aspect the first, in the possible implementation of second aspect the second, described second acquisition unit comprises:
First obtains subelement, for obtaining the first thread stacked data that described process message the first thread is corresponding;
First searches subelement, whether comprises wait mutual exclusion lock message for searching described the first thread stacked data, and described wait mutual exclusion lock message comprises the second thread of holding the first mutual exclusion lock that thread is waited for;
First determines subelement, when do not comprise wait mutual exclusion lock message when the first thread stacked data, determines that the first thread holds the lock time and exceed Preset Time and cause system deadlock;
Second obtains subelement, while waiting for mutual exclusion lock message, obtains the second thread stacks data corresponding to the second thread of holding the first mutual exclusion lock that thread is waited for for existing when the first thread stacked data;
Second searches subelement, whether comprises wait mutual exclusion lock message for searching described the second thread stacks data;
Second determines subelement, while waiting for mutual exclusion lock message, determines that the second thread is held and locks overlong time and cause system deadlock for not comprising when the second thread stacks data;
The first judgment sub-unit, for when the second thread stacks packet is when waiting for mutual exclusion lock message, judges whether the second thread and the first thread form to hold lock dependence;
The 3rd determines subelement, while holding lock dependence, definitely causes system deadlock because cross-thread interlocks for forming when the second thread and the first thread;
Thread updating block, hold while locking dependence for not forming when the second thread and the first thread, using the thread of holding the second mutual exclusion lock that thread is waited for as the second new thread, and trigger second and obtain subelement and obtain the second thread stacks data that the second new thread is corresponding.
In conjunction with the possible implementation of second aspect the second, in the third possible implementation of second aspect, described the first judgment sub-unit comprises:
The second judgment sub-unit, for judging whether the mutual exclusion lock that the first thread is held is the mutual exclusion lock that the second thread is waited for;
The 4th determines subelement, for the mutual exclusion lock of holding when the first thread be the second thread wait for mutual exclusion lock time, determine that the first thread and the second cross-thread formation holds lock dependence; Or, the mutual exclusion lock of holding when the first thread be not the second thread wait for mutual exclusion lock time, determine that the first thread and the second cross-thread do not form to hold lock dependence.
In conjunction with the possible implementation of second aspect the second, in the 4th kind of possible implementation of second aspect, described the first judgment sub-unit comprises:
Construction unit, for according to the wait mutual exclusion lock message of the thread stacks data that obtain, builds and holds lock dependence diagram data;
Whether the 3rd judgment sub-unit, there is loop for holding lock dependence diagram data described in judging;
The 5th determines subelement, for when described in when holding lock dependence diagram data and having loop, determine that each thread formation on loop is held lock dependence.
In conjunction with the third possible implementation of second aspect or the 4th kind of possible implementation of second aspect, in the 5th kind of possible implementation of second aspect, the first determining unit is configured to determine that it is the thread of interlocking that formation is held the thread of lock dependence.
The third aspect, the disclosure provides a kind of terminal device, comprise storer, and one or more than one instruction, one of them or more than one instruction are stored in storer, and are configured to carry out described more than one or one instruction comprise for carrying out the instruction of following operation by more than one or one processor:
Obtain syslog file;
Search the process message that whether comprises pressure ends with system process in described syslog file;
In the time comprising the process message of forcing ends with system process in syslog file, obtain thread stacks data, and cause the reason of system deadlock according to described thread stacks data acquisition;
When the reason that causes system deadlock is when interlock due to cross-thread, determine the thread interlocking;
, determine and hold the thread that the lock time exceedes Preset Time because thread is held the lock time while exceeding Preset Time when causing system deadlock former.
Beneficial effect of the present disclosure can comprise: after intelligent terminal is restarted, first obtain syslog file, judge the process message that whether comprises pressure ends with system process in described syslog file, if comprised, determine and restart because deadlock causes intelligent terminal, further judge because cross-thread interlocking causes deadlock, or because thread is held lock overlong time and is caused deadlock, if because cross-thread interlocking causes deadlock, determine the thread of interlocking; If thread is held lock, overlong time causes deadlock, determines this thread.Thereby, after intelligent terminal is restarted, without research staff's analytic system message one by one, can determine fast and efficiently the thread that occurs deadlock.
Brief description of the drawings
In order to be illustrated more clearly in the technical scheme in disclosure embodiment, to the accompanying drawing of required use in embodiment be briefly described below, apparently, for those of ordinary skills, do not paying under the prerequisite of creative work, can also obtain according to these accompanying drawings other accompanying drawing.
Fig. 1 is a kind of schematic diagram of cross-thread interlocked relationship;
Fig. 2 is the schematic flow sheet that a kind of system of disclosure embodiment is restarted the detection method of reason;
Fig. 3 is the schematic flow sheet of step S230 embodiment illustrated in fig. 2;
Fig. 4 is the schematic flow sheet that the another kind of system of disclosure embodiment is restarted the detection method of reason;
Fig. 5 is the schematic flow sheet that a kind of system of the disclosure is restarted the detection method example of reason;
Fig. 6 is the structural representation that a kind of system of disclosure embodiment is restarted reason pick-up unit;
Fig. 7 is the structural representation that the another kind of system of disclosure embodiment is restarted reason pick-up unit;
Fig. 8 is the structural representation of the second acquisition unit of disclosure embodiment;
Fig. 9 is the structural representation of a kind of terminal device of disclosure embodiment.
Embodiment
The disclosure provides a kind of system to restart reason detection method, device and terminal device, after intelligent terminal is restarted, first described system is restarted reason detection method needs to obtain syslog file, then, in seeking system journal file, whether comprise the process message of forcing ends with system process, in the time comprising the process message of forcing ends with system process, obtain relevant thread stacks data, and cause the reason of system deadlock according to described thread stacks data acquisition; When the reason that causes system deadlock is when interlock due to cross-thread, determine the thread interlocking; , determine and hold the thread that the lock time exceedes Preset Time because thread is held the lock time while exceeding Preset Time when causing system deadlock former.Whether thereby can fast detecting after intelligent terminal is restarted go out because system deadlock causes restarting, if because system deadlock causes restarting, can determine fast the thread of deadlock, without research staff's analytic system message one by one, therefore, speed is fast, efficiency is high.
It is more than core concept of the present disclosure, in order to make those skilled in the art understand better disclosure scheme, below in conjunction with the accompanying drawing in disclosure embodiment, technical scheme in disclosure embodiment is clearly and completely described, obviously, the embodiment of described description is only disclosure part embodiment, instead of whole embodiment.Based on the embodiment in the disclosure, those of ordinary skill in the art are not making the every other embodiment obtaining under creative work prerequisite, all belong to the scope of disclosure protection.
Before introducing in detail embodiment of the present disclosure, the related content of system deadlock under paper.
System deadlock (deadlock) refers to two or more processes in the process of implementation, and because contention resource causes the phenomenon of mutual wait, if there is no External Force Acting, they all cannot continue to carry out, and now claim system in deadlock state.
Due to the resource-constrained in intelligent terminal, therefore resource occupation has alternative,, when certain process (thread) takies after resource, makes other processes (thread) under the assistance without external force, can not get this resource and cannot continue operation.In multi-process (thread) application, conventionally utilize mutual exclusion lock to protect the shared resource in system.In the time that a process (thread) request takies shared resource, first obtain the mutual exclusion lock of this resource, after obtaining corresponding mutual exclusion lock, just can take this shared resource, finally discharge described mutual exclusion lock, so that other processes (thread) obtain and then take described shared resource.If resource allocation policy is improper, may occur that mutual exclusion lock, by indefinite the taking of certain process (thread), causes other processes (thread) cannot use shared resource, finally cause process (thread) deadlock.
Refer to Fig. 1, show a kind of schematic diagram of cross-thread interlocked relationship, in same process, have the thread of multiple parallel runnings.
Suppose in Android system, thread 1, thread 2 and thread 3 parallel runnings are in system_server process, wherein, thread 1 is held mutual exclusion lock A and is waited for mutual exclusion lock B, thread 2 is held mutual exclusion lock B and is waited for mutual exclusion lock C, and meanwhile, thread 3 is held mutual exclusion lock C and waited for mutual exclusion lock A.And, each thread will obtain after the mutual exclusion lock of wait, just discharge the mutual exclusion lock that other threads are waited for, being thread 1 just discharges mutual exclusion lock A after mutual exclusion lock B and thread 2 just discharges mutual exclusion lock B after acquisition mutual exclusion lock C obtaining, thread 3 just discharges mutual exclusion lock C after acquisition mutual exclusion lock A, now thread 1, thread 2, thread 3 all can not get the mutual exclusion lock of waiting for, and can wait and stay always, thereby cause thread deadlock.Now, the WatchDog program in Android system will force to finish (killing) system_server process, finally causes Android system to be restarted.
Refer to Fig. 2, show a kind of system of disclosure embodiment and restart the schematic flow sheet of the detection method of reason, the method is applied to terminal device, and as shown in Figure 2, described method can comprise the following steps:
First,, at step S210, obtain syslog file.Described syslog file is log file or the file set of register system Action Events.
Then, at step S220, search in described syslog file whether comprise the process message of forcing ends with system process, if comprise the process message of forcing ends with system process in syslog file, execution step S230; If do not comprise the process message of forcing ends with system process in syslog file, determine it is not to restart because system deadlock causes system, and then finish.
In the time that operating system is Android system, whether comprise the process message of " Watchdog killing system process:thread1 " by searching in the intrasystem syslog file of Android, wherein, " thread1 " represents thread title.If comprise described process message in syslog file, show that deadlock has occurred Android system.If do not comprise similar information, show that deadlock does not occur Android system.Art technology is understandable that, in other operating system, can be the process message of other forms of pressure ends with system process.
Then, at step S230, obtain thread stacks data, and cause the reason of system deadlock according to described thread stacks data acquisition.
This step is obtained and the thread stacks data of related linear program of process message of forcing ends with system process, and described related linear program comprises the thread that thread that the entrained thread title of the process message of described pressure ends with system process is corresponding and the thread stacks data corresponding with described thread title are directly or indirectly associated.The thread stacks data that further follow-up obtains are determined the reason that causes system deadlock.
At step S240, because when cross-thread interlocking, determine the thread of interlocking when causing system deadlock former.
At step S250,, determine and hold the thread that the lock time exceedes Preset Time because thread is held the lock time while exceeding Preset Time when causing system deadlock former.
The system that the present embodiment provides is restarted the detection method of reason, after system is restarted, first obtain syslog file, by judging in syslog file whether comprise the process message of forcing ends with system process, determine whether it is that system deadlock causes system to be restarted; If comprise the process message of forcing ends with system process in syslog file, show to restart because system deadlock causes system, then, obtain the thread stacks data of related linear program, thereby determine the reason that causes system deadlock, and then determine the thread that causes system deadlock.From above-mentioned testing process, whether system can detect automatically restarts because system deadlock causes system, and then in the time that system deadlock causes system to be restarted, can determine the thread that causes system deadlock, without research staff's analytic system message one by one, therefore, detection speed is fast, efficiency is high.
In an embodiment of the present disclosure, as shown in Figure 3, the step S230 in above-described embodiment can comprise the following steps:
First,, at step S310, obtain the first thread stacked data corresponding to the first thread in the process message of forcing ends with system process.In the process message of described the first thread by pressure ends with system process, comprised thread title, this step for example, is obtained the first thread stacked data that described the first thread is corresponding from application error message feedback file (, the traces.txt file in Android system).
Next,, at step S320, search in described the first thread stacked data and whether comprise and wait for mutual exclusion lock message; Described wait mutual exclusion lock message comprises the second thread of holding the first mutual exclusion lock that thread is waited for.
For example, in Android system, search in the first thread stacked data the similar message that whether comprises " waiting**held by tid=* ", wherein, " * * " represents the title of the mutual exclusion lock that the first thread waits for, the thread number of mutual exclusion lock " * * " is held in " * " representative, if there is similar message, shows to comprise and wait for mutual exclusion lock message in the first thread stacked data; If there is no similar message, shows not comprise and wait for mutual exclusion lock message in the first thread stacked data.
When the first thread stacked data does not comprise while waiting for mutual exclusion lock message, execution step S330, determines that the first thread holds the lock time and exceed Preset Time and cause system deadlock; , certain function time of the first thread execution exceedes Preset Time and causes system deadlock.
In the time that the first thread stacked data exists wait mutual exclusion lock message, execution step S340, obtains the second thread stacks data that the second thread is corresponding.
Suppose, the wait mutual exclusion lock message comprising in the first thread stacked data is " waiting A held by tid=2 ", this thread " thread2 " of waiting for that the thread lock A that mutual exclusion lock message sign First Line journey is waited for is 2 by thread number is held, and thread " thread2 " is the second thread in this step.Obtain the second thread stacks data that the second thread is corresponding.
Then,, at step S350, search in described the second thread stacks data and whether comprise and wait for mutual exclusion lock message.The search procedure of this step is identical with the search procedure of step S320, repeats no more herein.
When the second thread stacks data do not comprise while waiting for mutual exclusion lock message, at step S360, determine that the second thread holds lock overlong time and cause system deadlock; Because certain function time of the second thread execution exceedes Preset Time and causes system deadlock.
When the second thread stacks packet is when waiting for mutual exclusion lock message, at step S370, judge whether the second thread and the first thread form to hold lock dependence.
In an embodiment of the present disclosure, judge the second thread and the first thread whether form hold lock dependence process can comprise following sub-step:
First, judge whether the mutual exclusion lock that the first thread is held is the mutual exclusion lock that the second up-to-date thread is waited for.
The mutual exclusion lock of holding when the first thread be the second up-to-date thread wait for mutual exclusion lock time, determine that the first thread and the second whole cross-threads form to hold lock dependence.
The mutual exclusion lock of holding when the first thread be not the second up-to-date thread wait for mutual exclusion lock time, determine that the first thread and the second whole cross-threads do not form to hold lock dependence.
In another embodiment of the present disclosure, judge the second thread and the first thread whether form hold lock dependence process can comprise following sub-step:
First,, according to the wait mutual exclusion lock message in the thread stacks data that obtain, build and hold lock dependence diagram data.
In the time that structure is held lock dependence diagram data, taking thread as node, connect the thread that exists mutual exclusion lock to wait for relation with directed line segment, and the thread of the direction of directed line segment sensing request mutual exclusion lock, hold lock dependence diagram data thereby generate.
Then, hold in lock dependence diagram data whether have loop described in judgement, if described in hold lock dependence diagram data and have loop, determine because each thread on loop forms and hold lock dependence.
Follow the trail of to hold the direction of each node of locking in dependence diagram data as starting point along directed line segment successively, whether have loop to inquire about, if there is loop, determine that lock dependence is held in each cross-thread existence on loop.
If step S370 judges the second thread and the first thread formation is held lock dependence, at step S380, determine because cross-thread interlocking causes system deadlock.
If step S370 judges the second thread and the first thread and does not form and hold lock dependence, at step S390, using the thread of holding the second mutual exclusion lock that thread is waited for as the second new thread, return to execution step S340 and obtain corresponding the second thread stacks data of the second new thread, form until judge the thread of holding lock dependence, or, determine certain thread and hold the lock time and exceed Preset Time.
Refer to Fig. 4, show the another kind of system of disclosure embodiment and restart the schematic flow sheet of the detection method of reason, on the basis of embodiment corresponding to Fig. 2, increase the process that whether comprises thread title in the process message of forcing ends with system process of searching, as shown in Figure 4, described method can comprise the following steps:
First,, at step S210, obtain syslog file.
Then, at step S220, search in described syslog file whether comprise the process message of forcing ends with system process, if comprise the process message of forcing ends with system process in syslog file, execution step S260; If do not comprise the process message of forcing ends with system process in syslog file, determine it is not to restart because system deadlock causes system, and then finish.
Then,, at step S260, search in the process message of described pressure ends with system process whether comprise thread title; In the time comprising thread title, execution step S230; In the time not comprising thread title (being that thread name is called Null), show to hold the lock time and exceed Preset Time and cause system deadlock due to system thread (in Android system, described system thread is ServerThread); Be that system thread is carried out certain function time and exceeded Preset Time and cause system deadlock.
At step S230, obtain corresponding thread stacks data, and cause the reason of system deadlock according to described thread stacks data acquisition.
At step S240, because when cross-thread interlocking, determine the thread of interlocking when causing system deadlock former.
At step S250,, determine and hold the thread that the lock time exceedes Preset Time because thread is held the lock time while exceeding Preset Time when causing system deadlock former.
The system that the present embodiment provides is restarted the detection method of reason, in syslog file, comprise after the process message of forcing ends with system process finding, further search and in described process message, whether comprise thread title, if do not comprise thread title, determine that system thread carries out certain function time and exceed Preset Time and cause system deadlock; If wrap thread title, further obtain again the thread stacks data of the corresponding thread of described thread title, and then determine and cause the thread of system deadlock only have while forcing the process message of ends with system process to meet certain condition and just obtain thread stacks data, save system resource.
Restart the detection method of reason below with an instantiation illustrative system, as shown in Figure 5, described method is comprising the following steps:
After system is restarted, at step S510, obtain syslog file.
Then,, at step S520, search the process message that whether comprises pressure ends with system process in described syslog file;
In the time comprising the process message of forcing ends with system process in syslog file, execution step S530; In the time not comprising the process message of forcing ends with system process in syslog file, determine it is not that system deadlock causes system to be restarted, and then finish.
At step S530, search in the process message of forcing ends with system process whether comprise thread title; Suppose that described process message is for " Watchdog killing system process:thread1 ", the thread name comprising is called " Thread1 ", performs step S540;
At step S540, obtain the thread stacks data that thread " Thread1 " is corresponding.
If while not comprising thread title (being that thread name is called Null) in described process message, in step S550, determine that system thread carries out the time of certain function and exceed Preset Time and cause system deadlock, system thread is held the lock time and is exceeded Preset Time and cause deadlock.For example, in Android system, the time of certain function of ServerThread thread execution exceedes Preset Time and causes Android system deadlock.
Obtain after the thread stacks data of thread " Thread1 ", at step S560, search in the thread stacks data of " Thread1 " and whether comprise and wait for mutual exclusion lock message.
Wait for mutual exclusion lock message if do not comprise in the thread stacks data of " Thread1 ", at step S570, determine that thread " Thread1 " carries out certain function time and exceed Preset Time and cause system deadlock.
Suppose to wait for mutual exclusion lock message: " waiting A held by tid=2 ", the thread that the mutual exclusion lock A that this message table open-wire line journey " Thread1 " is waited for is 2 by thread number is held, and at step S580, obtains the thread stacks data of " Thread2 ".
After obtaining the thread stacks data of " Thread2 ", at step S590, search in the thread stacks data of " Thread2 " and whether comprise and wait for mutual exclusion lock message.
Wait for mutual exclusion lock message if do not comprise in the thread stacks data of " Thread2 ", at step S5100, determine that thread " Thread2 " carries out certain function time and exceed Preset Time and cause system deadlock.
Wait for mutual exclusion lock message if comprise in the thread stacks data of " Thread2 ", at step S5110, judge whether thread " Thread2 " and thread " Thread1 " form to hold lock dependence;
Suppose described wait mutual exclusion lock message: " waiting B held by tid=3 ", show that the thread " Thread3 " that mutual exclusion lock B that thread " Thread2 " is waited for is 3 by thread number is held, the mutual exclusion lock B that thread " Thread2 " is waited for is not held by thread " Thread1 ", therefore, thread " Thread2 " does not form and holds lock dependence with thread " Thread1 ".
Judge thread " Thread2 " and do not form and hold after lock dependence with thread " Thread1 ", at step S5130, " Thread2 " is updated to " Thread3 "; Wherein, thread " Thread3 " is held the mutual exclusion lock that thread " Thread2 " is waited for.
Then, return to execution step S580, obtain the thread stacks data of thread " Thread3 ".And then, at step S590, search in the thread stacks data of thread " Thread3 " and whether comprise and wait for mutual exclusion lock message.
Wait for mutual exclusion lock message if do not comprise in the thread stacks data of " Thread3 ", at step S5100, determine that thread " Thread3 " carries out certain function time and exceed Preset Time and cause system deadlock.
Wait for mutual exclusion lock message if comprise in the thread stacks data of " Thread3 ": " waiting C held bytid=1 ", show that the thread " Thread1 " that mutual exclusion lock C that thread " Thread3 " is waited for is 1 by thread number is held, therefore, at step S5110, judge thread " Thread3 " and form and hold lock dependence with thread " Thread1 ".
At step S5120, determine that cross-thread interlocking causes system deadlock, and determine the thread of interlocking.The thread that thread " Thread1 ", " Thread2 " and " Thread3 " are interlocking.Thread " Thread1 ", " Thread2 " and " Thread3 " hold lock dependence and are related to that schematic diagram is identical shown in Fig. 1.
The detection method embodiment of restarting reason with system of the present disclosure is corresponding, the pick-up unit embodiment that the disclosure also provides system to restart reason.
Refer to Fig. 6, show a kind of system of disclosure embodiment and restart the structural representation of the pick-up unit of reason, described device can comprise: the first acquiring unit 100, first is searched unit 200, second acquisition unit 300, the first determining unit 400 and the second determining unit 500, wherein:
The first acquiring unit 100, for obtaining syslog file.
First searches unit 200, whether comprises the process message of forcing ends with system process for described syslog file.In Android system, forcing the process message of ends with system process is the similar message of " Watchdog killing system process:thread1 ".
Second acquisition unit 300, when comprise the process message of forcing ends with system process when described syslog file, obtains corresponding thread stacks data, and causes the reason of system deadlock according to the thread stacks data acquisition obtaining.
The first determining unit 400, for when causing system deadlock former because when cross-thread interlocking, determine the thread of interlocking.
The second determining unit 500, for when causing system deadlock former because thread is held the lock time while exceeding Preset Time, determine and hold the thread that the lock time exceedes Preset Time.
The system that the present embodiment provides is restarted the pick-up unit of reason, after system is restarted, can judge whether to restart because system deadlock causes system according to syslog file, if it is system deadlock that system is restarted reason, further can determine the thread that causes system deadlock, without research staff's analytic system message one by one, therefore, detection speed is fast, efficiency is high.
Refer to Fig. 7, show the another kind of system of disclosure embodiment and restart the structural representation of the pick-up unit of reason, this device, on the basis of the device shown in Fig. 6, has increased by second and has searched unit 600.The device that the present embodiment provides comprises: the first acquiring unit 100, first is searched unit 200, second acquisition unit 300, the first determining unit 400, the second determining unit 500 and second and searched unit 600.
Wherein, title in the present embodiment, the unit that numbering is identical with the embodiment shown in Fig. 6, its function is also identical, repeats no more herein, highlights second below and searches unit 600.
Second searches unit 600 is connected to first and searches between unit 200 and second acquisition unit 300.Whether second searches unit comprises thread title for the process message of searching described pressure ends with system process, in the time comprising thread title in the process message of described pressure ends with system process, triggers second acquisition unit 300 and obtains thread stacks data; In the time not comprising thread title, determine that thread holds the lock time and exceed Preset Time and cause system deadlock.
The system that the present embodiment provides is restarted the pick-up unit of reason, in syslog file, comprise after the process message of forcing ends with system process finding, further search and in described process message, whether comprise thread title, if do not comprise thread title, determine that system thread carries out certain function time and exceed Preset Time and cause system deadlock; If wrap thread title, further obtain again the thread stacks data of the corresponding thread of described thread title, and then determine and cause the thread of system deadlock only have while forcing the process message of ends with system process to meet certain condition and just obtain thread stacks data, save system resource.
Shown in Figure 8, the structural representation that shows the second acquisition unit that disclosure embodiment provides, described second acquisition unit can comprise: first obtains subelement 310, first searches subelement 320, first and determine that subelement 330, second obtains subelement 340, second and searches subelement 350, second and determine that subelement 360, the first judgment sub-unit 370, the 3rd determine subelement 380 and thread updating block 390.
First obtains subelement 310, for obtaining the first thread stacked data that described process message the first thread is corresponding.Thread corresponding to thread title of described the first thread for forcing the process message of ends with system process to comprise.
First searches subelement 320, whether comprises wait mutual exclusion lock message for searching described the first thread stacked data; Described wait mutual exclusion lock message comprises the second thread of holding the first mutual exclusion lock that thread is waited for.
First determines subelement 330, when do not comprise wait mutual exclusion lock message when the first thread stacked data, determines that the first thread holds the lock time and exceed Preset Time and cause system deadlock.
Second obtains subelement 340, while waiting for mutual exclusion lock message, obtains the second thread stacks data corresponding to the second thread of holding the first mutual exclusion lock that thread is waited for for existing when the first thread stacked data.
Second searches subelement 350, whether comprises wait mutual exclusion lock message for searching described the second thread stacks data.
Second determines subelement 360, while waiting for mutual exclusion lock message, determines that the second thread is held and locks overlong time and cause system deadlock for not comprising when the second thread stacks data.
The first judgment sub-unit 370, for when the second thread stacks packet is when waiting for mutual exclusion lock message, judges whether the second thread and the first thread form to hold lock dependence.
In a possible embodiment of the present disclosure, described the first judgment sub-unit can comprise: the second judgment sub-unit and the 4th is determined subelement, wherein:
The second judgment sub-unit, for judging whether the mutual exclusion lock that the first thread is held is the mutual exclusion lock that the second thread is waited for.
The 4th determines subelement, for the mutual exclusion lock of holding when the first thread be the second thread wait for mutual exclusion lock time, determine that the first thread and the second cross-thread formation holds lock dependence; Or, the mutual exclusion lock of holding when the first thread be not the second thread wait for mutual exclusion lock time, determine that the first thread and the second cross-thread do not form to hold lock dependence.
In another possible embodiment of the present disclosure, described the first judgment sub-unit can comprise: construction unit, the 3rd judgment sub-unit and the 5th are determined subelement, wherein:
Construction unit, for according to the wait mutual exclusion lock message of the thread stacks data that obtain, builds and holds lock dependence diagram data.
Whether the 3rd judgment sub-unit, there is loop for holding lock dependence diagram data described in judging.
The 5th determines subelement, for when described in when holding lock dependence diagram data and having loop, determine that each thread formation on loop is held lock dependence.
The 3rd determines that subelement 380 is connected with the first judgment sub-unit 370, holds while locking dependence for forming when the second thread and the first thread, definitely causes system deadlock because cross-thread interlocks.And then determined by the first determining unit in Fig. 6 or embodiment corresponding to Fig. 7 that to form the thread of holding lock dependence be the thread of interlocking.
Thread updating block 390 is connected to the first judgment sub-unit 370 and second and obtains between subelement 340, hold while locking dependence for not forming when the second thread and the first thread, using the thread of holding the second mutual exclusion lock that thread is waited for as the second new thread, and trigger second and obtain subelement 340 and obtain the second thread stacks data that the second new thread is corresponding.
The system providing with respect to above-described embodiment is restarted detection method and the device of reason, and the disclosure also provides terminal device.
Refer to Fig. 9, show the structural representation of the terminal device that the disclosure relates to, this terminal device can be restarted for the system of implementing to provide in above-described embodiment the detection method of reason, particularly:
Terminal device can comprise RF (Radio Frequency, radio frequency) circuit 110, the storer 120 that includes one or more computer-readable recording mediums, input block 130, display unit 140, sensor 150, voicefrequency circuit 160, WiFi module 170, include one or one parts such as processor 180 and power supply 190 of processing above core.It will be understood by those skilled in the art that the terminal device structure shown in Fig. 9 does not form the restriction to terminal device, can comprise the parts more more or less than diagram, or combine some parts, or different parts are arranged.Wherein:
RF circuit 110 can be used for receiving and sending messages or communication process in, the reception of signal and transmission, especially, after the downlink information of base station is received, transfer to more than one or one processor 180 to process; In addition, send to base station by relating to up data.Conventionally, RF circuit 110 includes but not limited to antenna, at least one amplifier, tuner, one or more oscillator, subscriber identity module (SIM) card, transceiver, coupling mechanism, LNA(Low Noise Amplifier, low noise amplifier), diplexer etc.In addition, RF circuit 110 can also be by radio communication and network and other devices communicatings.This radio communication can be used arbitrary communication standard or agreement, include but not limited to GSM (Global System of Mobile communication, global system for mobile communications), GPRS (General Packet Radio Service, general packet radio service), CDMA (Code Division Multiple Access, CDMA), WCDMA (Wideband Code Division Multiple Access, Wideband Code Division Multiple Access (WCDMA)), LTE (Long Term Evolution, Long Term Evolution), Email, SMS (Short Messaging Service, Short Message Service) etc.
Storer 120 can be used for storing software program and module, and processor 180 is stored in software program and the module of storer 120 by operation, thereby carries out various function application and data processing.Storer 120 can mainly comprise storage program district and storage data field, wherein, and the application program (such as sound-playing function, image player function etc.) that storage program district can storage operation system, at least one function is required etc.; The data (such as voice data, phone directory etc.) that create according to the use of terminal device etc. can be stored in storage data field.In addition, storer 120 can comprise high-speed random access memory, can also comprise nonvolatile memory, for example at least one disk memory, flush memory device or other volatile solid-state parts.Correspondingly, storer 120 can also comprise Memory Controller, so that processor 180 and the access of input block 130 to storer 120 to be provided.
Input block 130 can be used for receiving numeral or the character information of input, and generation is inputted with user arranges and function control is relevant keyboard, mouse, control lever, optics or trace ball signal.Particularly, input block 130 can comprise touch-sensitive surperficial 131 and other input equipments 132.Touch-sensitive surperficial 131, also referred to as touch display screen or Trackpad, can collect user or near touch operation (using any applicable object or near the operations of annex on touch-sensitive surperficial 131 or touch-sensitive surperficial 131 such as finger, stylus such as user) thereon, and drive corresponding coupling arrangement according to predefined formula.Optionally, touch-sensitive surperficial 131 can comprise touch detecting apparatus and two parts of touch controller.Wherein, touch detecting apparatus detects user's touch orientation, and detects the signal that touch operation brings, and sends signal to touch controller; Touch controller receives touch information from touch detecting apparatus, and converts it to contact coordinate, then gives processor 180, and the order that energy receiving processor 180 is sent is also carried out.In addition, can adopt the polytypes such as resistance-type, condenser type, infrared ray and surface acoustic wave to realize touch-sensitive surperficial 131.Except touch-sensitive surperficial 131, input block 130 can also comprise other input equipments 132.Particularly, other input equipments 132 can include but not limited to one or more in physical keyboard, function key (such as volume control button, switch key etc.), trace ball, mouse, control lever etc.
Display unit 140 can be used for showing the information inputted by user or the various graphical user interface of the information that offers user and terminal device, and these graphical user interface can be made up of figure, text, icon, video and its combination in any.Display unit 140 can comprise display panel 141, optionally, can adopt the form such as LCD (Liquid Crystal Display, liquid crystal display), OLED (Organic Light-Emitting Diode, Organic Light Emitting Diode) to configure display panel 141.Further, touch-sensitive surperficial 131 can cover display panel 141, when touch-sensitive surperficial 131 detect thereon or near touch operation after, send processor 180 to determine the type of touch event, corresponding vision output is provided according to the type of touch event with preprocessor 180 on display panel 141.Although in Fig. 9, touch-sensitive surperficial 131 with display panel 141 be as two independently parts realize input and input function, in certain embodiments, can by touch-sensitive surperficial 131 and display panel 141 integrated and realize input and output function.
Terminal device also can comprise at least one sensor 150, such as optical sensor, motion sensor and other sensors.Particularly, optical sensor can comprise ambient light sensor and proximity transducer, and wherein, ambient light sensor can regulate according to the light and shade of ambient light the brightness of display panel 141, proximity transducer can, in the time that terminal device moves in one's ear, cut out display panel 141 and/or backlight.As the one of motion sensor; Gravity accelerometer can detect the size of the acceleration that (is generally three axles) in all directions; when static, can detect size and the direction of gravity, can be used for identifying application (such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as passometer, knock) of mobile phone attitude etc.; As for also other sensors such as configurable gyroscope, barometer, hygrometer, thermometer, infrared ray sensor of terminal device, do not repeat them here.
Voicefrequency circuit 160, loudspeaker 161, microphone 162 can provide the audio interface between user and terminal device.Voicefrequency circuit 160 can, by the electric signal after the voice data conversion receiving, be transferred to loudspeaker 161, is converted to voice signal output by loudspeaker 161; On the other hand, the voice signal of collection is converted to electric signal by microphone 162, after being received by voicefrequency circuit 160, be converted to voice data, after again voice data output processor 180 being processed, through RF circuit 110 to send to such as another terminal device, or export voice data to storer 120 so as further process.Voicefrequency circuit 160 also may comprise earphone jack, so that communicating by letter of peripheral hardware earphone and terminal device to be provided.
WiFi belongs to short range wireless transmission technology, terminal device by WiFi module 170 can help that user sends and receive e-mail, browsing page and access streaming video etc., it provides wireless broadband internet access for user.Although Fig. 9 shows WiFi module 170, be understandable that, it does not belong to must forming of terminal device, completely can be as required in the essential scope that does not change invention and omit.
Processor 180 is control centers of terminal device, utilize the various piece of various interface and the whole mobile phone of connection, by moving or carry out the software program and/or the module that are stored in storer 120, and call the data that are stored in storer 120, carry out various functions and the deal with data of terminal device, thereby mobile phone is carried out to integral monitoring.Optionally, processor 180 can comprise one or more processing cores; Preferably, processor 180 can integrated application processor and modem processor, and wherein, application processor is mainly processed operating system, user interface and application program etc., and modem processor is mainly processed radio communication.Be understandable that, above-mentioned modem processor also can not be integrated in processor 180.
Terminal device also comprises that the power supply 190(powering to all parts is such as battery), preferably, power supply can be connected with processor 180 logics by power-supply management system, thereby realizes the functions such as management charging, electric discharge and power managed by power-supply management system.Power supply 190 can also comprise the random component such as one or more direct current or AC power, recharging system, power failure detection circuit, power supply changeover device or inverter, power supply status indicator.
Although not shown, terminal device can also comprise camera, bluetooth module etc., does not repeat them here.In the present embodiment, the touch-screen display when display unit of terminal device.
Described terminal device also comprises one or more than one instruction (instruction or program), one of them or more than one instruction are stored in storer, and are configured to carry out described more than one or one instruction comprise for carrying out the instruction of following operation by more than one or one processor:
Obtain syslog file;
Search the process message that whether comprises pressure ends with system process in described syslog file;
In the time comprising the process message of forcing ends with system process in syslog file, obtain thread stacks data, and cause the reason of system deadlock according to described thread stacks data acquisition;
When the reason that causes system deadlock is when interlock due to cross-thread, determine the thread interlocking;
, determine and hold the thread that the lock time exceedes Preset Time because thread is held the lock time while exceeding Preset Time when causing system deadlock former.
Preferably, described more than one or one instruction also comprises the instruction for carrying out following operation:
Search in the process message of described pressure ends with system process whether comprise thread title, in the time comprising thread title in the process message of described pressure ends with system process, carry out the step of obtaining thread stacks data; In the time not comprising thread title, determine that thread holds the lock time and exceed Preset Time and cause system deadlock.
Preferably, described more than one or one instruction also comprises the instruction for carrying out following operation:
Obtain the first thread stacked data corresponding to the first thread in process message;
Whether search in described the first thread stacked data and comprise and wait for mutual exclusion lock message, described wait mutual exclusion lock message comprises the second thread of holding the first mutual exclusion lock that thread is waited for;
When the first thread stacked data does not comprise while waiting for mutual exclusion lock message, determine that the first thread holds the lock time and exceed Preset Time and cause system deadlock;
In the time that the first thread stacked data exists wait mutual exclusion lock message, obtain the second thread stacks data corresponding to the second thread of holding the first mutual exclusion lock that thread is waited for;
Search in described the second thread stacks data and whether comprise and wait for mutual exclusion lock message;
When the second thread stacks data do not comprise while waiting for mutual exclusion lock message, determine that the second thread holds lock overlong time and cause system deadlock;
When the second thread stacks packet is when waiting for mutual exclusion lock message, judge whether the second thread and the first thread form to hold lock dependence;
When the second thread and the first thread form while holding lock dependence, determine because cross-thread interlocking causes system deadlock;
When the second thread and the first thread do not form while holding lock dependence, using the thread of holding the second mutual exclusion lock that thread is waited for as the second new thread, return to carry out and obtain second new thread correspondence the second thread stacks data.
In a possible embodiment of the present disclosure, described more than one or one instruction also comprises the instruction for carrying out following operation:
Judge whether the mutual exclusion lock that the first thread is held is the mutual exclusion lock that the second thread is waited for;
The mutual exclusion lock of holding when the first thread be the second thread wait for mutual exclusion lock time, determine that the first thread and the second cross-thread form to hold lock dependence; And determine that it is the thread of interlocking that formation is held the thread of lock dependence.
The mutual exclusion lock of holding when the first thread be not the second thread wait for mutual exclusion lock time, determine that the first thread and the second cross-thread do not form to hold lock dependence.
In another possible embodiment of the present disclosure, described more than one or one instruction also comprises the instruction for carrying out following operation:
According to the wait mutual exclusion lock message in the thread stacks data that obtain, build and hold lock dependence diagram data;
Described in judgement, hold in lock dependence diagram data whether have loop, if described in hold lock dependence diagram data and have loop, determine because each thread on loop forms and hold lock dependence.And determine that it is the thread of interlocking that formation is held the thread of lock dependence.
The disclosure also provides a kind of computer-readable recording medium, and this computer-readable recording medium can be the computer-readable recording medium comprising in the storer in above-described embodiment; Also can be individualism, be unkitted the computer-readable recording medium of allocating in terminal.Described computer-readable recording medium stores more than one or one instruction, and described more than one or one instruction is used for execution graph 2, Fig. 3, Fig. 4, the system providing embodiment illustrated in fig. 5 by one or more than one processor and restarts the detection method of reason.
Those skilled in the art can be well understood to the mode that technology in disclosure embodiment can add essential general hardware platform by software and realize.Based on such understanding, the part that technical scheme in disclosure embodiment contributes to prior art in essence in other words can embody with the form of software product, this computer software product can be stored in storage medium, as ROM/RAM, magnetic disc, CD etc., comprise that some instructions (can be personal computers in order to make a computer equipment, server, or the network equipment etc.) carry out the method described in some part of each embodiment of the disclosure or embodiment.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, between each embodiment identical similar part mutually referring to, what each embodiment stressed is and the difference of other embodiment.Especially,, for system embodiment, because it is substantially similar in appearance to embodiment of the method, so description is fairly simple, relevant part is referring to the part explanation of embodiment of the method.
Above-described disclosure embodiment, does not form the restriction to disclosure protection domain.Any amendment of doing within spirit of the present disclosure and principle, be equal to and replace and improvement etc., within all should being included in protection domain of the present disclosure.

Claims (13)

1. system is restarted a detection method for reason, it is characterized in that, comprising:
Obtain syslog file;
Search the process message that whether comprises pressure ends with system process in described syslog file;
In the time comprising the process message of forcing ends with system process in syslog file, obtain thread stacks data, and cause the reason of system deadlock according to described thread stacks data acquisition;
Because when cross-thread interlocking, determine the thread of interlocking when causing system deadlock former;
, determine and hold the thread that the lock time exceedes Preset Time because thread is held the lock time while exceeding Preset Time when causing system deadlock former.
2. method according to claim 1, is characterized in that, also comprises:
Search in the process message of described pressure ends with system process whether comprise thread title, in the time comprising thread title in the process message of described pressure ends with system process, carry out the step of obtaining thread stacks data; In the time not comprising thread title, determine that thread holds the lock time and exceed Preset Time and cause system deadlock.
3. method according to claim 1 and 2, is characterized in that, obtains thread stacks data, and causes the step of the reason of system deadlock according to described thread stacks data acquisition, in the following way:
Obtain the first thread stacked data corresponding to the first thread in described process message;
Whether search in described the first thread stacked data and comprise and wait for mutual exclusion lock message, described wait mutual exclusion lock message comprises the second thread of holding the first mutual exclusion lock that thread is waited for;
When the first thread stacked data does not comprise while waiting for mutual exclusion lock message, determine that the first thread holds the lock time and exceed Preset Time and cause system deadlock;
In the time that the first thread stacked data exists wait mutual exclusion lock message, obtain the second thread stacks data corresponding to the second thread of holding the first mutual exclusion lock that thread is waited for;
Search in described the second thread stacks data and whether comprise and wait for mutual exclusion lock message;
When the second thread stacks data do not comprise while waiting for mutual exclusion lock message, determine that the second thread holds lock overlong time and cause system deadlock;
When the second thread stacks packet is when waiting for mutual exclusion lock message, judge whether the second thread and the first thread form to hold lock dependence;
When the second thread and the first thread form while holding lock dependence, determine because cross-thread interlocking causes system deadlock;
When the second thread and the first thread do not form while holding lock dependence, using the thread of holding the second mutual exclusion lock that thread is waited for as the second new thread, return to carry out and obtain second new thread correspondence the second thread stacks data.
4. method according to claim 3, is characterized in that, judges whether the second thread and the first thread form the step of holding lock dependence, in the following way:
Judge whether the mutual exclusion lock that the first thread is held is the mutual exclusion lock that the second thread is waited for;
The mutual exclusion lock of holding when the first thread be the second thread wait for mutual exclusion lock time, determine that the first thread and the second cross-thread form to hold lock dependence;
The mutual exclusion lock of holding when the first thread be not the second thread wait for mutual exclusion lock time, determine that the first thread and the second cross-thread do not form to hold lock dependence.
5. method according to claim 3, is characterized in that, judges whether the second thread and the first thread form the step of holding lock dependence, in the following way:
According to the wait mutual exclusion lock message in the thread stacks data that obtain, build and hold lock dependence diagram data;
Described in judgement, hold in lock dependence diagram data whether have loop, if described in hold lock dependence diagram data and have loop, determine because each thread on loop forms and hold lock dependence.
6. according to the method described in claim 4 or 5, it is characterized in that, determine that it is the thread of interlocking that formation is held the thread of lock dependence.
7. system is restarted a pick-up unit for reason, it is characterized in that, comprising:
The first acquiring unit, for obtaining syslog file;
First searches unit, whether comprises the process message of forcing ends with system process for described syslog file;
Second acquisition unit, when comprise the process message of forcing ends with system process when described syslog file, obtains thread stacks data, and causes the reason of system deadlock according to the thread stacks data acquisition obtaining;
The first determining unit, for when causing system deadlock former because when cross-thread interlocking, determine the thread of interlocking;
The second determining unit, for when causing system deadlock former because thread is held the lock time while exceeding Preset Time, determine and hold the thread that the lock time exceedes Preset Time.
8. system according to claim 7 is restarted the pick-up unit of reason, it is characterized in that, also comprises:
Second searches unit, whether comprises thread title for the process message of searching described pressure ends with system process, in the time comprising thread title in the process message of described pressure ends with system process, triggers second acquisition unit and obtains thread stacks data; In the time not comprising thread title, determine that thread holds the lock time and exceed Preset Time and cause system deadlock.
9. the pick-up unit of restarting reason according to the system described in claim 7 or 8, is characterized in that, described second acquisition unit comprises:
First obtains subelement, for obtaining the first thread stacked data that described process message the first thread is corresponding;
First searches subelement, whether comprises wait mutual exclusion lock message for searching described the first thread stacked data, and described wait mutual exclusion lock message comprises the second thread of holding the first mutual exclusion lock that thread is waited for;
First determines subelement, when do not comprise wait mutual exclusion lock message when the first thread stacked data, determines that the first thread holds the lock time and exceed Preset Time and cause system deadlock;
Second obtains subelement, while waiting for mutual exclusion lock message, obtains the second thread stacks data corresponding to the second thread of holding the first mutual exclusion lock that thread is waited for for existing when the first thread stacked data;
Second searches subelement, whether comprises wait mutual exclusion lock message for searching described the second thread stacks data;
Second determines subelement, while waiting for mutual exclusion lock message, determines that the second thread is held and locks overlong time and cause system deadlock for not comprising when the second thread stacks data;
The first judgment sub-unit, for when the second thread stacks packet is when waiting for mutual exclusion lock message, judges whether the second thread and the first thread form to hold lock dependence;
The 3rd determines subelement, while holding lock dependence, definitely causes system deadlock because cross-thread interlocks for forming when the second thread and the first thread;
Thread updating block, hold while locking dependence for not forming when the second thread and the first thread, using the thread of holding the second mutual exclusion lock that thread is waited for as the second new thread, and trigger second and obtain subelement and obtain the second thread stacks data that the second new thread is corresponding.
10. system according to claim 9 is restarted the pick-up unit of reason, it is characterized in that, described the first judgment sub-unit comprises:
The second judgment sub-unit, for judging whether the mutual exclusion lock that the first thread is held is the mutual exclusion lock that the second thread is waited for;
The 4th determines subelement, for the mutual exclusion lock of holding when the first thread be the second thread wait for mutual exclusion lock time, determine that the first thread and the second cross-thread formation holds lock dependence; Or, the mutual exclusion lock of holding when the first thread be not the second thread wait for mutual exclusion lock time, determine that the first thread and the second cross-thread do not form to hold lock dependence.
11. systems according to claim 9 are restarted the pick-up unit of reason, it is characterized in that, described the first judgment sub-unit comprises:
Construction unit, for according to the wait mutual exclusion lock message of the thread stacks data that obtain, builds and holds lock dependence diagram data;
Whether the 3rd judgment sub-unit, there is loop for holding lock dependence diagram data described in judging;
The 5th determines subelement, for when described in when holding lock dependence diagram data and having loop, determine that each thread formation on loop is held lock dependence.
12. restart the pick-up unit of reason according to the system described in claim 10 or 11, it is characterized in that, the first determining unit is configured to determine that forming the thread of holding lock dependence is the thread of interlocking.
13. 1 kinds of terminal devices, it is characterized in that, comprise storer, and one or more than one instruction, one of them or more than one instruction are stored in storer, and are configured to carry out described more than one or one instruction comprise for carrying out the instruction of following operation by more than one or one processor:
Obtain syslog file;
Search the process message that whether comprises pressure ends with system process in described syslog file;
In the time comprising the process message of forcing ends with system process in syslog file, obtain thread stacks data, and cause the reason of system deadlock according to described thread stacks data acquisition;
When the reason that causes system deadlock is when interlock due to cross-thread, determine the thread interlocking;
, determine and hold the thread that the lock time exceedes Preset Time because thread is held the lock time while exceeding Preset Time when causing system deadlock former.
CN201310594935.2A 2013-11-21 2013-11-21 The detection method of system reboot reason, device and terminal unit Active CN103942113B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310594935.2A CN103942113B (en) 2013-11-21 2013-11-21 The detection method of system reboot reason, device and terminal unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310594935.2A CN103942113B (en) 2013-11-21 2013-11-21 The detection method of system reboot reason, device and terminal unit

Publications (2)

Publication Number Publication Date
CN103942113A true CN103942113A (en) 2014-07-23
CN103942113B CN103942113B (en) 2017-03-01

Family

ID=51189788

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310594935.2A Active CN103942113B (en) 2013-11-21 2013-11-21 The detection method of system reboot reason, device and terminal unit

Country Status (1)

Country Link
CN (1) CN103942113B (en)

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104794016A (en) * 2015-04-23 2015-07-22 惠州Tcl移动通信有限公司 Mobile terminal crash testing and processing method and system
CN105930247A (en) * 2016-04-14 2016-09-07 北京小米移动软件有限公司 Method, device and mobile terminal for processing problem of system restart
CN106339285A (en) * 2016-08-19 2017-01-18 浪潮电子信息产业股份有限公司 Method for analyzing unexpected restart of LINUX system
CN107451257A (en) * 2017-07-31 2017-12-08 郑州云海信息技术有限公司 A kind of maintainable system and method based on distributed file system
CN108012031A (en) * 2017-11-30 2018-05-08 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer-readable recording medium
CN108038038A (en) * 2017-11-30 2018-05-15 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer-readable recording medium
CN108108257A (en) * 2017-12-28 2018-06-01 努比亚技术有限公司 Localization method, mobile terminal and readable storage medium storing program for executing are restarted based on MDSS
CN108170549A (en) * 2017-12-28 2018-06-15 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer readable storage medium
CN108182123A (en) * 2017-12-28 2018-06-19 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer readable storage medium
CN108182133A (en) * 2017-12-28 2018-06-19 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer readable storage medium
CN108228423A (en) * 2017-12-28 2018-06-29 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer readable storage medium
CN108595311A (en) * 2017-12-28 2018-09-28 努比亚技术有限公司 Restart localization method, mobile terminal and readable storage medium storing program for executing based on Peripheral Interface
CN109165110A (en) * 2018-07-27 2019-01-08 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer readable storage medium
CN109343996A (en) * 2018-10-30 2019-02-15 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer readable storage medium
CN109891392A (en) * 2017-09-30 2019-06-14 华为技术有限公司 A kind of processing method and processing device of system service time-out
CN110087034A (en) * 2019-04-25 2019-08-02 山西潞安金源煤层气开发有限责任公司 A kind of coal bed gas remote supervision system
CN111090528A (en) * 2019-12-25 2020-05-01 北京天融信网络安全技术有限公司 Deadlock determination method and device and electronic equipment
CN111159051A (en) * 2019-12-31 2020-05-15 北京天融信网络安全技术有限公司 Deadlock detection method and device, electronic equipment and readable storage medium
CN111552618A (en) * 2020-05-06 2020-08-18 上海龙旗科技股份有限公司 Method and device for collecting logs
CN112099960A (en) * 2020-09-21 2020-12-18 天津神舟通用数据技术有限公司 Distributed deadlock detection method based on path propulsion

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103034577A (en) * 2011-10-08 2013-04-10 腾讯科技(深圳)有限公司 Method and device for positioning slow shutdown
CN103399818A (en) * 2013-08-13 2013-11-20 中国科学技术大学苏州研究院 Deadlock detection method in operating system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103034577A (en) * 2011-10-08 2013-04-10 腾讯科技(深圳)有限公司 Method and device for positioning slow shutdown
CN103399818A (en) * 2013-08-13 2013-11-20 中国科学技术大学苏州研究院 Deadlock detection method in operating system

Cited By (30)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104794016A (en) * 2015-04-23 2015-07-22 惠州Tcl移动通信有限公司 Mobile terminal crash testing and processing method and system
CN105930247B (en) * 2016-04-14 2018-09-04 北京小米移动软件有限公司 Processing method, device and the mobile terminal of system reboot problem
CN105930247A (en) * 2016-04-14 2016-09-07 北京小米移动软件有限公司 Method, device and mobile terminal for processing problem of system restart
CN106339285A (en) * 2016-08-19 2017-01-18 浪潮电子信息产业股份有限公司 Method for analyzing unexpected restart of LINUX system
CN107451257A (en) * 2017-07-31 2017-12-08 郑州云海信息技术有限公司 A kind of maintainable system and method based on distributed file system
CN109891392B (en) * 2017-09-30 2022-01-11 华为技术有限公司 System service timeout processing method and device
US11693701B2 (en) 2017-09-30 2023-07-04 Huawei Technologies Co., Ltd. System service timeout processing method, and apparatus
CN109891392A (en) * 2017-09-30 2019-06-14 华为技术有限公司 A kind of processing method and processing device of system service time-out
CN108038038A (en) * 2017-11-30 2018-05-15 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer-readable recording medium
CN108012031B (en) * 2017-11-30 2021-03-26 努比亚技术有限公司 Mobile terminal restart positioning method, mobile terminal and computer readable storage medium
CN108012031A (en) * 2017-11-30 2018-05-08 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer-readable recording medium
CN108182133A (en) * 2017-12-28 2018-06-19 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer readable storage medium
CN108228423A (en) * 2017-12-28 2018-06-29 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer readable storage medium
CN108182123A (en) * 2017-12-28 2018-06-19 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer readable storage medium
CN108595311A (en) * 2017-12-28 2018-09-28 努比亚技术有限公司 Restart localization method, mobile terminal and readable storage medium storing program for executing based on Peripheral Interface
CN108170549A (en) * 2017-12-28 2018-06-15 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer readable storage medium
CN108108257A (en) * 2017-12-28 2018-06-01 努比亚技术有限公司 Localization method, mobile terminal and readable storage medium storing program for executing are restarted based on MDSS
CN108228423B (en) * 2017-12-28 2022-04-19 努比亚技术有限公司 Mobile terminal restart positioning method, mobile terminal and computer readable storage medium
CN108182133B (en) * 2017-12-28 2022-01-14 努比亚技术有限公司 Mobile terminal restart positioning method, mobile terminal and computer readable storage medium
CN108595311B (en) * 2017-12-28 2021-11-16 努比亚技术有限公司 Restart positioning method based on peripheral interface, mobile terminal and readable storage medium
CN109165110A (en) * 2018-07-27 2019-01-08 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer readable storage medium
CN109343996A (en) * 2018-10-30 2019-02-15 努比亚技术有限公司 Mobile terminal restarts localization method, mobile terminal and computer readable storage medium
CN110087034B (en) * 2019-04-25 2020-11-10 山西潞安金源煤层气开发有限责任公司 Coal bed gas remote monitoring system
CN110087034A (en) * 2019-04-25 2019-08-02 山西潞安金源煤层气开发有限责任公司 A kind of coal bed gas remote supervision system
CN111090528A (en) * 2019-12-25 2020-05-01 北京天融信网络安全技术有限公司 Deadlock determination method and device and electronic equipment
CN111090528B (en) * 2019-12-25 2023-09-26 北京天融信网络安全技术有限公司 Deadlock determination method and device and electronic equipment
CN111159051A (en) * 2019-12-31 2020-05-15 北京天融信网络安全技术有限公司 Deadlock detection method and device, electronic equipment and readable storage medium
CN111552618A (en) * 2020-05-06 2020-08-18 上海龙旗科技股份有限公司 Method and device for collecting logs
CN111552618B (en) * 2020-05-06 2024-03-12 上海龙旗科技股份有限公司 Method and equipment for collecting logs
CN112099960A (en) * 2020-09-21 2020-12-18 天津神舟通用数据技术有限公司 Distributed deadlock detection method based on path propulsion

Also Published As

Publication number Publication date
CN103942113B (en) 2017-03-01

Similar Documents

Publication Publication Date Title
CN103942113A (en) System restarting reason detection method, device and terminal equipment
KR20190046995A (en) Memory Return Method and Device
CN105824958A (en) Method, device and system for inquiring log
CN104123120B (en) A kind of browser page data filtering method, device and system
CN104636047A (en) Method and device for operating objects in list and touch screen terminal
CN103389863A (en) Display control method and device
CN104135728B (en) Method for connecting network and device
CN103455603A (en) Method and device for caching webpage content and loading webpage and terminal device
CN104571787A (en) Message display method and communication terminal
CN104717341A (en) Message prompting method and terminal
CN104301315A (en) Method and device for limiting information access
CN104142868A (en) Connection establishment method and device
CN104281394A (en) Method and device for intelligently selecting words
CN103177217B (en) A kind of file scanning method, system and client and server
CN104901805A (en) Identity authentication method and device and system
CN105302452A (en) Gesture interaction-based operation method and device
CN104077184A (en) Progress control method of application program and computer system
CN103945241A (en) Streaming data statistical method, system and related device
CN105630846A (en) Head portrait updating method and apparatus
CN104735132A (en) Information inquiry method, servers and terminal
CN103631625A (en) Data acquisition method, user terminal, server and system
CN103336838A (en) Method and device for processing webpage and terminal equipment
CN105512150A (en) Method and device for information search
CN103944922B (en) Data processing method, terminal, server and system
CN104901992A (en) Resource transfer method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant