CN103092746B - The localization method of thread exception and system - Google Patents
The localization method of thread exception and system Download PDFInfo
- Publication number
- CN103092746B CN103092746B CN201310046875.0A CN201310046875A CN103092746B CN 103092746 B CN103092746 B CN 103092746B CN 201310046875 A CN201310046875 A CN 201310046875A CN 103092746 B CN103092746 B CN 103092746B
- Authority
- CN
- China
- Prior art keywords
- thread
- monitored
- frequency
- abnormity
- abnormal
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a kind of localization method and system of thread exception, described method comprises: the running status monitoring each monitored thread, judges whether monitored thread runs abnormal; The generation dump file when judging to obtain monitored thread generation exception, described dump file comprises internal memory, the stack information of in-process each thread; By debugging described dump file, locate the code position at the abnormal place of monitored thread.The present invention can not only monitoring thread running status, and when thread operation exception, by internal memory and the stack information of the current operation of the automatic record thread of dump file, developer, according to the internal memory of record and stack information, just can cause the code position of thread exception by quick position.
Description
Technical field
The present invention relates to field of computer technology, particularly relate to a kind of localization method and system of thread exception.
Background technology
Thread is the elementary cell of operating system allocation process device time, can have multiple thread run time version simultaneously in process.Each thread maintenance abnormality handling procedure, dispatching priority and a group system are used for the structure of preserving thread context before this thread of scheduling.The method of existing monitoring thread running status has two kinds:
Heartbeat detection: set up a monitoring thread, whether have heartbeat, if certain thread does not have heartbeat in a period of time, then think that this thread is abnormal if monitoring each thread;
Status poll: set up a monitoring thread, inquire about the running status of each thread at set intervals, stops if finding that certain thread runs, then thinks that this thread is abnormal;
The major defect that above two kinds of prior aries have is:
Can only the state of monitoring thread, if thread can not determine the particular location of thread exception extremely;
When thread is when carrying out complicated and time consumption computing, adopt above two kinds of technology may there is the situation of erroneous judgement thread running status.
Summary of the invention
(1) technical matters that will solve
The technical problem to be solved in the present invention is: the localization method and the system that provide a kind of thread exception, cause the code position of thread exception with quick position.
(2) technical scheme
For solving the problem, on the one hand, the invention provides a kind of localization method of thread exception, comprising:
Monitor the running status of each monitored thread, judge whether monitored thread runs abnormal;
The generation dump file when judging to obtain monitored thread generation exception, described dump file comprises internal memory, the stack information of in-process each thread;
By debugging described dump file, locate the code position at the abnormal place of monitored thread.
Preferably, before the step of the running status of the monitored thread of described monitoring, also comprise the step increasing monitoring thread, monitored the running status of each monitored thread by described monitoring thread.
Preferably, monitored the running status of each monitored thread by described monitoring thread, judge monitored thread runs whether abnormal step comprises:
Described each monitored thread is registered to described monitoring thread when initialization, and sets the time-out time of each monitored thread, the initial value of counter, the initial value of frequency of abnormity and frequency of abnormity limit value;
Each monitored thread upgrades self counter in normal course of operation;
If monitoring thread finds that certain monitored thread does not upgrade the counter of self in the time-out time of described setting, then for the frequency of abnormity of this monitored thread adds 1;
If the frequency of abnormity that monitored thread is corresponding is greater than the frequency of abnormity limit value of described setting, then judges that this monitored thread occurs abnormal, and counter corresponding for this monitored thread and frequency of abnormity are reset to corresponding initial value.
Preferably, if the frequency of abnormity that described monitored thread is corresponding is greater than the frequency of abnormity limit value of described setting, then judge that this monitored thread abnormal step occurs and comprises: if continuous abnormal number of times corresponding to monitored thread is greater than the frequency of abnormity limit value of described setting, then judge that this monitored thread occurs abnormal.
Preferably, if monitoring thread finds that certain monitored thread does not upgrade the counter of self in previous time-out time, but in current time-out time, have updated the counter of self, then frequency of abnormity corresponding for described monitored thread is reset to corresponding initial value.
Preferably, after judging the step that this monitored thread generation is abnormal, be also included in the step of the identifier of recording exceptional thread in daily record.
Preferably, the step of described debugging dump file comprises: find corresponding abnormal thread according to the identifier of described abnormal thread.
Preferably, described dump file is dmp file.
On the other hand, present invention also offers a kind of positioning system of thread exception, comprising:
Monitoring module, for monitoring the running status of each monitored thread, judges whether monitored thread runs abnormal;
Dump file generation module, for the generation dump file when judging to obtain monitored thread generation exception, described dump file comprises internal memory, the stack information of in-process each thread;
Abnormal locating module, for by the described dump file of debugging, locates the code position at the abnormal place of monitored thread.
(3) beneficial effect
The present invention can not only monitoring thread running status, and when thread operation exception, by internal memory and the stack information of the current operation of the automatic record thread of dump file, developer is according to the internal memory of record and stack information, just the code position of thread exception be can cause by quick position, debugging and the reparation of thread facilitated.
It is abnormal that the continuous abnormal number of times that the monitored thread of the present invention is corresponding just judges when being greater than the frequency of abnormity limit value of described setting that this monitored thread occurs, and can reduce the probability of some thread erroneous judgement complicated and consuming time.
Method of the present invention increases monitoring thread and can complete, and the scope of application is comparatively wide, is also suitable for announced software.
Accompanying drawing explanation
Fig. 1 is the schematic flow sheet of the localization method of a kind of thread exception according to the embodiment of the present invention;
Fig. 2 is the schematic flow sheet of the localization method of a kind of thread exception according to the embodiment of the present invention;
Fig. 3 is according to the sequential chart between embodiment of the present invention monitoring thread and monitored thread;
Fig. 4 is the structural schematic block diagram of the positioning system according to a kind of thread exception of the embodiment of the present invention.
Embodiment
Below in conjunction with drawings and Examples, that the present invention is described in detail is as follows.
Embodiment one:
Figure 1 shows that the schematic flow sheet of the localization method of a kind of thread exception that the present embodiment is recorded, described method comprises:
S110: the running status monitoring each monitored thread, judges whether monitored thread runs abnormal;
S120: the generation dump file when judging to obtain monitored thread generation exception;
S130: by debugging described dump file, locates the code position at the abnormal place of monitored thread.
In the present embodiment, described dump file comprises internal memory, the stack information of in-process each thread.
The method of the present embodiment can not only monitoring thread running status, and when thread operation exception, by internal memory and the stack information of the current operation of the automatic record thread of dump file, developer is according to the internal memory of record and stack information, just the code position of thread exception be can cause by quick position, debugging and the reparation of thread facilitated.
Embodiment two:
Figure 2 shows that the schematic flow sheet of the localization method of the another kind of thread exception that the present embodiment is recorded, described method comprises:
S210: increase monitoring thread in the application;
S220: described each monitored thread is registered to described monitoring thread when initialization, and set the time-out time of each monitored thread, the initial value of counter, the initial value of frequency of abnormity and frequency of abnormity limit value;
S230: each monitored thread upgrades self counter in normal course of operation;
S240: if monitoring thread finds that certain monitored thread does not upgrade the counter of self in the time-out time of described setting, then for the frequency of abnormity of this monitored thread adds 1;
S250: if continuous abnormal number of times corresponding to monitored thread is greater than the frequency of abnormity limit value of described setting, then judge that this monitored thread occurs abnormal, generate described dump file, and counter corresponding for this monitored thread and frequency of abnormity are reset to corresponding initial value, the identifier of recording exceptional thread in daily record; Wherein, in order to obtain the continuous abnormal number of times of monitored thread, if monitoring thread finds that certain monitored thread does not upgrade the counter of self in previous time-out time, but in current time-out time, have updated the counter of self, then frequency of abnormity corresponding for described monitored thread is reset to corresponding initial value; The identifier of described abnormal thread is used for finding corresponding abnormal thread when debugging dump file according to the identifier of described abnormal thread;
S260: by debugging described dump file, locates the code position at the abnormal place of monitored thread.
In the present embodiment, described dump file is dmp file, in the present embodiment when determining monitored thread and occurring abnormal, generates described dmp file by calling MiniDumpWriteDump function; After generating dmp file, by WinDBG instrument debugging dmp file, can the abnormal thread operation code position of quick position.
Fig. 3 is the sequential chart between the present embodiment monitoring thread and monitored thread, as shown in Figure 3, comprises a monitoring thread Monitor and three monitored thread ThreadA, ThreadB and ThreadC in this implementation.Wherein, monitored thread ThreadA and ThreadB of the first two, successively through initialization, is registered to described monitoring thread, and sets time-out time Ti, counter C1
iinitial value, frequency of abnormity C2
iinitial value and frequency of abnormity limit value; Monitored thread ThreadC does not also carry out initialization.
The counter C1 of self is constantly upgraded in the operational process of two monitored thread ThreadA and ThreadB
i, monitoring thread finds that certain monitored thread is in the time-out time Ti of setting, fails to upgrade its counter C1i, then think that this thread is abnormal, its frequency of abnormity C2
iadd 1;
At monitored thread continuous abnormal number of times C2
iwhen being greater than the frequency of abnormity limit value of setting, generate described dmp file, and counter reset C1
iwith frequency of abnormity C2
ifor initial value.
It is abnormal that the continuous abnormal number of times that monitored thread is corresponding just judges when being greater than the frequency of abnormity limit value of described setting that this monitored thread occurs, and can reduce the probability of some thread erroneous judgement complicated and consuming time.
Embodiment three:
Figure 4 shows that the structural schematic block diagram of the positioning system of a kind of thread exception that the present embodiment is recorded, described system comprises:
Monitoring module 410, for monitoring the running status of each monitored thread, judges whether monitored thread runs abnormal;
Dump file generation module 420, for the generation dump file when judging to obtain monitored thread generation exception, described dump file comprises internal memory, the stack information of in-process each thread;
Abnormal locating module 430, for by the described dump file of debugging, locates the code position at the abnormal place of monitored thread.
The system of the present embodiment can not only monitoring thread running status, and when thread operation exception, by internal memory and the stack information of the current operation of the automatic record thread of dump file, developer is according to the internal memory of record and stack information, just the code position of thread exception be can cause by quick position, debugging and the reparation of thread facilitated.
Above embodiment is only for illustration of the present invention; and be not limitation of the present invention; the those of ordinary skill of relevant technical field; without departing from the spirit and scope of the present invention; can also make a variety of changes and modification; therefore all equivalent technical schemes also belong to category of the present invention, and scope of patent protection of the present invention should be defined by the claims.
Claims (7)
1. a localization method for thread exception, is characterized in that, comprising:
Monitor the running status of each monitored thread, judge whether monitored thread runs abnormal;
The generation dump file when judging to obtain monitored thread generation exception, described dump file comprises internal memory, the stack information of in-process each thread;
By debugging described dump file, locate the code position at the abnormal place of monitored thread;
Before the step of the running status of the monitored thread of described monitoring, also comprise the step increasing monitoring thread, monitored the running status of each monitored thread by described monitoring thread;
Monitored the running status of each monitored thread by described monitoring thread, judge monitored thread runs whether abnormal step comprises:
Described each monitored thread is registered to described monitoring thread when initialization, and sets the time-out time of each monitored thread, the initial value of counter, the initial value of frequency of abnormity and frequency of abnormity limit value;
Each monitored thread upgrades self counter in normal course of operation;
If monitoring thread finds that certain monitored thread does not upgrade the counter of self in the time-out time of described setting, then for the frequency of abnormity of this monitored thread adds 1;
If the frequency of abnormity that monitored thread is corresponding is greater than the frequency of abnormity limit value of described setting, then judges that this monitored thread occurs abnormal, and counter corresponding for this monitored thread and frequency of abnormity are reset to corresponding initial value.
2. the method for claim 1, it is characterized in that, if the frequency of abnormity that described monitored thread is corresponding is greater than the frequency of abnormity limit value of described setting, then judge that this monitored thread abnormal step occurs and comprises: if continuous abnormal number of times corresponding to monitored thread is greater than the frequency of abnormity limit value of described setting, then judge that this monitored thread occurs abnormal.
3. method as claimed in claim 2, it is characterized in that, if monitoring thread finds that certain monitored thread does not upgrade the counter of self in previous time-out time, but in current time-out time, have updated the counter of self, then frequency of abnormity corresponding for described monitored thread is reset to corresponding initial value.
4. the method for claim 1, is characterized in that, is also included in the step of the identifier of recording exceptional thread in daily record after judging the step that this monitored thread generation is abnormal.
5. method as claimed in claim 4, it is characterized in that, the step of described debugging dump file comprises: find corresponding abnormal thread according to the identifier of described abnormal thread.
6. the method for claim 1, is characterized in that, described dump file is dmp file.
7. a positioning system for thread exception, is characterized in that, comprising:
Monitoring module, for being monitored the running status of each monitored thread by monitoring thread, judge whether monitored thread runs abnormal, comprise: described each monitored thread is registered to described monitoring thread when initialization, and set the time-out time of each monitored thread, the initial value of counter, the initial value of frequency of abnormity and frequency of abnormity limit value; Each monitored thread upgrades self counter in normal course of operation; If monitoring thread finds that certain monitored thread does not upgrade the counter of self in the time-out time of described setting, then for the frequency of abnormity of this monitored thread adds 1; If the frequency of abnormity that monitored thread is corresponding is greater than the frequency of abnormity limit value of described setting, then judges that this monitored thread occurs abnormal, and counter corresponding for this monitored thread and frequency of abnormity are reset to corresponding initial value;
Dump file generation module, for the generation dump file when judging to obtain monitored thread generation exception, described dump file comprises internal memory, the stack information of in-process each thread;
Abnormal locating module, for by the described dump file of debugging, locates the code position at the abnormal place of monitored thread.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310046875.0A CN103092746B (en) | 2013-02-05 | 2013-02-05 | The localization method of thread exception and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310046875.0A CN103092746B (en) | 2013-02-05 | 2013-02-05 | The localization method of thread exception and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103092746A CN103092746A (en) | 2013-05-08 |
CN103092746B true CN103092746B (en) | 2015-12-02 |
Family
ID=48205347
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310046875.0A Active CN103092746B (en) | 2013-02-05 | 2013-02-05 | The localization method of thread exception and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103092746B (en) |
Families Citing this family (24)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103810099B (en) * | 2013-11-21 | 2017-05-24 | 北京奇虎科技有限公司 | Code tracing method and code tracing system |
CN104932964A (en) * | 2014-03-17 | 2015-09-23 | 无锡天脉聚源传媒科技有限公司 | Monitoring processing method and apparatus of computer functional programs |
CN103984898B (en) * | 2014-05-29 | 2017-02-01 | 北京神州绿盟信息安全科技股份有限公司 | Detection method and detection device for attack in spray pattern |
CN106445769B (en) * | 2015-08-11 | 2020-12-15 | 腾讯科技(深圳)有限公司 | Computer operation monitoring method, device and system |
CN106708710A (en) * | 2015-11-12 | 2017-05-24 | 高德软件有限公司 | Thread jamming identification method and apparatus |
CN105824749B (en) * | 2016-03-09 | 2019-06-25 | 上海博达数据通信有限公司 | The analysis method of User space process exception under a kind of Linux system |
CN105740080B (en) * | 2016-03-11 | 2019-02-22 | 深圳市茁壮网络股份有限公司 | A kind of stuck detection method of program and processor |
CN108153651A (en) * | 2016-12-06 | 2018-06-12 | 阿里巴巴集团控股有限公司 | The slow abnormal localization method of card, electronic equipment and system |
CN108243056B (en) * | 2016-12-27 | 2020-11-20 | 大唐移动通信设备有限公司 | Method and device for acquiring abnormal information |
CN106980555B (en) * | 2017-03-24 | 2020-04-07 | 山东浪潮商用系统有限公司 | Overtime thread processing method and device |
CN108959015A (en) * | 2017-05-19 | 2018-12-07 | 北京京东尚科信息技术有限公司 | Judge system or the method and apparatus whether system module blocks |
CN107704356B (en) | 2017-06-12 | 2019-06-28 | 平安科技(深圳)有限公司 | Exception stack information acquisition method, device and computer readable storage medium |
CN107479986A (en) * | 2017-07-03 | 2017-12-15 | 阿里巴巴集团控股有限公司 | The control method and device of service traffics |
CN109947636B (en) * | 2017-12-20 | 2022-11-04 | 浙江宇视科技有限公司 | Abnormal thread positioning method and device |
CN108415806A (en) * | 2018-02-07 | 2018-08-17 | 深圳市亿联智能有限公司 | A kind of high efficiency thread life monitoring mode |
CN109542632A (en) * | 2018-11-30 | 2019-03-29 | 郑州云海信息技术有限公司 | A kind of method and device handling access request |
CN110032435B (en) * | 2019-03-25 | 2021-06-08 | 北京和利时系统工程有限公司 | Method and device for managing threads in control system |
CN110413432B (en) * | 2019-07-02 | 2023-09-01 | Oppo广东移动通信有限公司 | Information processing method, electronic equipment and storage medium |
CN111125008B (en) | 2019-12-20 | 2022-04-22 | 浪潮电子信息产业股份有限公司 | Dynamic repairing method and system of abnormal inode and related components |
CN113407368B (en) * | 2020-03-16 | 2023-03-21 | 广东龙芯中科电子科技有限公司 | Process management method and device and electronic equipment |
CN114625428B (en) * | 2020-12-10 | 2024-03-26 | 荣耀终端有限公司 | Application exception processing method and electronic equipment |
CN112948158A (en) * | 2021-02-19 | 2021-06-11 | 山东英信计算机技术有限公司 | File sharing method, device, equipment and computer readable storage medium |
CN113672449A (en) * | 2021-07-07 | 2021-11-19 | 浙江大华技术股份有限公司 | Intelligent operation and maintenance abnormity monitoring method and device, computer equipment and storage medium |
CN114003390A (en) * | 2021-11-16 | 2022-02-01 | 平安养老保险股份有限公司 | Method and device for determining abnormal thread, computer equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5930470A (en) * | 1996-09-03 | 1999-07-27 | Kabushiki Kaisha Toshiba | Debugging system and debugging method |
CN1996257A (en) * | 2006-12-26 | 2007-07-11 | 华为技术有限公司 | Method and system for monitoring process |
CN102855160A (en) * | 2012-08-22 | 2013-01-02 | 北京奇虎科技有限公司 | Method, device and system for software repair |
-
2013
- 2013-02-05 CN CN201310046875.0A patent/CN103092746B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5930470A (en) * | 1996-09-03 | 1999-07-27 | Kabushiki Kaisha Toshiba | Debugging system and debugging method |
CN1996257A (en) * | 2006-12-26 | 2007-07-11 | 华为技术有限公司 | Method and system for monitoring process |
CN102855160A (en) * | 2012-08-22 | 2013-01-02 | 北京奇虎科技有限公司 | Method, device and system for software repair |
Also Published As
Publication number | Publication date |
---|---|
CN103092746A (en) | 2013-05-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103092746B (en) | The localization method of thread exception and system | |
CN114328102B (en) | Equipment state monitoring method, equipment state monitoring device, equipment and computer readable storage medium | |
CN109039740B (en) | Method and equipment for processing operation and maintenance monitoring alarm | |
US8645769B2 (en) | Operation management apparatus, operation management method, and program storage medium | |
US9424157B2 (en) | Early detection of failing computers | |
US10095576B2 (en) | Anomaly recovery method for virtual machine in distributed environment | |
CN106789306B (en) | Method and system for detecting, collecting and recovering software fault of communication equipment | |
EP3167371B1 (en) | A method for diagnosing power supply failure in a wireless communication device | |
CN105243004A (en) | Failure resource detection method and apparatus | |
WO2017220013A1 (en) | Service processing method and apparatus, and storage medium | |
CN104360952A (en) | Software test system and software test method | |
US8984333B2 (en) | Automatic computer storage medium diagnostics | |
CN103605592A (en) | Mechanism of detecting malfunctions of distributed computer system | |
CN111611048A (en) | Migration method and device of virtual machine in cloud computing environment and computer equipment | |
CN104158843A (en) | Storage unit invalidation detecting method and device for distributed file storage system | |
JP2018180982A (en) | Information processing device and log recording method | |
CN108021463B (en) | GPU fault management method based on finite-state machine | |
CN117573306A (en) | Batch task scheduling system, method, device, computer equipment and storage medium | |
CN115102838B (en) | Emergency processing method and device for server downtime risk and electronic equipment | |
US20220229755A1 (en) | Docking stations health | |
CN114780270A (en) | Memory fault processing method and device, electronic equipment and computer readable storage medium | |
CN117349127B (en) | GPU card-falling detection method and device | |
CN113986142B (en) | Disk fault monitoring method, device, computer equipment and storage medium | |
CN113836035B (en) | Battery management system testing method and device and electronic equipment | |
CN115454954A (en) | Data processing method, system and device and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |