Fault locating method and device, electronic equipment, medium and program product
By monitoring and comparing the function identifiers and called functions between adjacent tracking points, faulty functions in the business system can be quickly and accurately located, solving the problems of a large number of tracking points and heavy server load in existing technologies, and achieving efficient fault location.
Patent Information
- Application Number
- CN202111468103.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-03
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2041-12-03
AI Technical Summary
In business systems, existing technologies require a large number of data points to determine fault functions, resulting in a large amount of code modification and increased server load, and fault location is not quick or accurate enough.
By monitoring and comparing the function identifiers and called functions between adjacent tracking points, faulty functions can be identified, reducing the number of tracking points, lowering server load, and improving the accuracy and speed of fault location.
It enables quick and accurate location of faulty functions in business systems, reduces the number of data points, lowers server load, and simplifies code modifications.
Smart Images

Figure CN114138649B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present disclosure relate to the technical field of computer, in particular to a fault positioning method and device, electronic equipment, medium and program product. BACKGROUND
[0002] In the case that a business system has a large number of customers, a slight failure of the business system may affect tens of thousands of customers in an instant. Therefore, in order to avoid the failure of the business system affecting the customers, the business system needs to quickly realize self-healing when the failure occurs. In order to enable the business system to quickly realize self-healing when the failure occurs, the failure needs to be positioned to determine the location of the failure, so that the determined failure location can be notified to the corresponding technical personnel when the business system fails, so that the technical personnel can timely troubleshoot the failure.
[0003] In order to determine the specific location of the failure, the current monitoring can be performed by using the method of burying points. The burying point refers to inserting an output statement in an application program. When the program runs to the output statement, the preset character can be output. If the preset character is monitored, it means that the program before the output statement has no problem. In this way, the location of the failure in the program can be determined. However, the technical solution of burying points can only determine whether the program between two burying points has a failure. In order to determine the running situation of each function in the program, the burying points need to be performed between any two functions. Therefore, when the size of the business system is large, the number of burying points needs to be greatly increased, the amount of code modification is large, and the server will also be additionally burdened. SUMMARY
[0004] In order to solve the problems in the related art, the embodiments of the present disclosure provide a fault positioning method and device, electronic equipment, medium and program product.
[0005] In a first aspect, the embodiments of the present disclosure provide a fault positioning method.
[0006] Specifically, the fault positioning method comprises:
[0007] After monitoring the first burying point output information corresponding to the first burying point, monitoring the second burying point output information corresponding to the second burying point, the second burying point is located at the adjacent burying point position after the first burying point position in the currently running program, and the currently running program has at least two functions between the first burying point and the second burying point;
[0008] When the second burying point output information is not monitored within the first preset time length, the identifier of each to-be-monitored function between the first burying point and the second burying point is acquired;
[0009] obtaining an identity of a calling function being invoked in at least one thread being executed currently;
[0010] based on the identity of each function to be monitored and the identity of the calling function, determining a function to be monitored belonging to the calling function from the each function to be monitored as a faulty function.
[0011] With reference to the first aspect, in a first implementation manner of the first aspect, the method further includes:
[0012] determining each buried point position according to historical fault information and a load capacity of a server in the system;
[0013] setting a corresponding buried point code at each buried point position.
[0014] With reference to the first aspect and the first implementation manner of the first aspect, in a second implementation manner of the first aspect, the method further includes:
[0015] after monitoring first buried point output information corresponding to the first buried point, deleting the first buried point output information.
[0016] With reference to the first aspect and the above implementation manners of the first aspect, in a third implementation manner of the first aspect, the method further includes:
[0017] obtaining a thread list, the thread list including at least one thread being executed;
[0018] obtaining a method stack of the at least one thread being executed;
[0019] obtaining the identity of the calling function based on function information at a top of the method stack.
[0020] With reference to the first aspect and the above implementation manners of the first aspect, in a fourth implementation manner of the first aspect, the method further includes:
[0021] determining the first preset time length according to a historical normal runtime length between the first buried point and the second buried point.
[0022] In a second aspect, a fault locating apparatus is provided in the embodiments of the present disclosure.
[0023] Specifically, the fault locating apparatus includes:
[0024] The monitoring module is configured to monitor the output information of the second embedding point after detecting the output information of the first embedding point corresponding to the first embedding point. The second embedding point is located at the adjacent embedding point position after the first embedding point position in the currently running program. The currently running program has at least two functions between the first embedding point and the second embedding point.
[0025] The first acquisition module is configured to acquire the identifiers of each function to be monitored between the first and second tracking points when no output information of the second tracking point is detected within a first preset time period.
[0026] The second acquisition module is configured to acquire the identifier of the function being called in at least one currently executing thread;
[0027] The first determining module is configured to determine the monitored functions that belong to the calling function as fault functions based on the identifiers of each monitored function and the identifier of the calling function.
[0028] In conjunction with the second aspect, in a first implementation of the second aspect of this disclosure, the apparatus further includes:
[0029] The second determination module is configured to determine the location of each embedding point based on historical fault information and the load capacity of the server in the system.
[0030] The settings module is configured to set the corresponding embedding code at each embedding point location.
[0031] In conjunction with the second aspect and the first implementation of the second aspect, in a second implementation of the present disclosure, the apparatus further includes:
[0032] The deletion module is configured to delete the first tracking point output information after detecting the first tracking point output information corresponding to the first tracking point.
[0033] In conjunction with the second aspect and the above-described implementation methods of the second aspect, in the third implementation method of the second aspect of this disclosure, the second acquisition module is configured as follows:
[0034] Get a list of threads, which includes at least one currently executing thread;
[0035] Obtain the method stack of the at least one currently executing thread;
[0036] Based on the function information at the top of the method stack, the identifier of the called function is obtained.
[0037] In conjunction with the second aspect and the above-described implementations of the second aspect, in a fourth implementation of the second aspect of this disclosure, the apparatus further includes:
[0038] The third determining module is configured to determine the first preset time length according to a historical normal runtime length between the first and second bury points.
[0039] In a third aspect, an electronic device is provided, which includes a memory and a processor. The memory is configured to store one or more computer instructions supporting a fault locating apparatus to perform the fault locating method described above. The processor is configured to execute the computer instructions stored in the memory. The fault locating apparatus can further include a communication interface configured to enable the fault locating apparatus to communicate with other devices or communication networks.
[0040] In a fourth aspect, a computer readable storage medium is provided, which is configured to store computer instructions for a fault locating apparatus. The computer instructions include computer instructions for performing the fault locating method described above.
[0041] In a fifth aspect, a computer program product is provided, which includes computer programs / instructions. When the computer programs / instructions are executed by a processor, the steps of the fault locating method described above are implemented.
[0042] According to the technical solution provided by the embodiments of the present disclosure, after the first bury point output information corresponding to the first bury point is monitored, the second bury point output information corresponding to the second bury point is monitored. The second bury point is located at a neighboring bury point position after the first bury point position in a currently running program. The currently running program has at least two functions between the first bury point and the second bury point. When the second bury point output information is not monitored within the first preset time length, the identification of each to-be-monitored function between the first bury point and the second bury point is obtained. The identification of a calling function being called in at least one thread being currently executed is obtained. Based on the identification of each to-be-monitored function and the identification of the calling function, a to-be-monitored function belonging to the calling function in each to-be-monitored function is determined as a fault function. The bury point monitoring can be performed first. Since there are at least two functions between any two bury points, the range of the function that appears to be faulty can be determined. Then, the calling function being currently called is compared to determine the fault function. In this way, the bury point does not need to be performed between any two functions, the number of bury points is reduced, the server load is reduced, and the fault locating is also quick and accurate.
[0043] It should be understood that the general description above and the following detailed description are only exemplary and explanatory, and cannot limit the embodiments of the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0044] Other features, objects, and advantages of the embodiments of the present disclosure will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings. In the drawings:
[0045] Figure 1 A flowchart illustrating a fault locating method according to an embodiment of the present disclosure is shown;
[0046] Figure 2 A flowchart illustrating another fault locating method according to an embodiment of the present disclosure is shown;
[0047] Figure 3 A flowchart illustrating another fault locating method according to an embodiment of the present disclosure is shown;
[0048] Figure 4 A flowchart illustrating step S103 in the fault locating method according to an embodiment of the present disclosure is shown;
[0049] Figure 5 A flowchart illustrating still another fault locating method according to an embodiment of the present disclosure is shown
[0050] Figure 6 A structural block diagram of a fault locating apparatus according to an embodiment of the present disclosure is shown;
[0051] Figure 7 A structural block diagram of another fault locating apparatus according to an embodiment of the present disclosure is shown;
[0052] Figure 8 A structural block diagram of still another fault locating apparatus according to an embodiment of the present disclosure is shown;
[0053] Figure 9 A structural block diagram of still another fault locating apparatus according to an embodiment of the present disclosure is shown;
[0054] Figure 10 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown;
[0055] Figure 11 A structural schematic diagram of a computer system suitable for implementing the fault locating method according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0056] Hereinafter, exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings so as to be easily implemented by those skilled in the art. Also, parts irrelevant to the description of the exemplary embodiments are omitted in the accompanying drawings for the sake of clarity.
[0057] In the present disclosure, it should be understood that terms such as "include" or "have" are intended to indicate that there exist the features, numbers, steps, actions, parts or combinations thereof disclosed in the specification, and do not exclude the possibility that one or more other features, numbers, steps, actions, parts or combinations thereof exist or are added.
[0058] It should also be noted that the embodiments in the present disclosure and the features in the embodiments can be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0059] In the present disclosure, the acquisition of user information or user data is an operation authorized, confirmed by the user, or actively selected by the user.
[0060] As mentioned above, in the case where a business system has a large number of customers, a slight failure of the business system may affect tens of thousands of customers at a moment. Therefore, in order to avoid the failure of the business system affecting the customers, the business system needs to be able to quickly realize self-recovery when a failure occurs. In order to enable the business system to quickly realize self-recovery when a failure occurs, the failure needs to be located to determine the position where the failure occurs, so that the determined failure position can be notified to the corresponding technical personnel when the business system fails, so that the technical personnel can timely troubleshoot the failure. In order to determine the specific position of the failure, the current monitoring can be performed by using the burying point. The burying point refers to inserting an output statement in an application program. When the program runs to the output statement, the preset character can be output. If the preset character is monitored, it means that the program before the output statement has no problem. In this way, the position of the failure in the program can be determined. However, the technical solution of burying points can only determine whether the program between two burying points fails. In order to determine the running situation of each function in the program, the burying points need to be performed between any two functions. Therefore, when the size of the business system is large, the number of burying points needs to be greatly increased, the amount of code modification is large, and it also brings additional burden to the server.
[0061] Considering the above problems, in the present embodiment, a failure locating method is proposed, which can first perform burying point monitoring. Since there are at least two functions between any two burying points, the function range of the failure can be determined, and then compared with the calling function currently being called to determine the failure function. In this way, the burying points do not need to be performed between any two functions, the number of burying points is reduced, the server load is reduced, and the failure locating is also very fast and accurate.
[0062] Figure 1 A flowchart of a failure locating method according to an embodiment of the present disclosure is shown as follows, Figure 1 As shown in the figure, the failure locating method comprises the following steps S101-S104:
[0063] In step S101, after monitoring the first buried point output information corresponding to the first buried point, the second buried point output information corresponding to the second buried point is monitored, the second buried point is located at a neighboring buried point position after the first buried point position in a currently running program, and the currently running program has at least two functions between the first buried point and the second buried point.
[0064] In step S102, when the second buried point output information is not monitored within the first preset time length, the identification of each to-be-monitored function between the first buried point and the second buried point is obtained.
[0065] In step S103, the identification of a calling function being called in at least one thread currently being executed is obtained.
[0066] In step S104, based on the identification of each to-be-monitored function and the identification of the calling function, a to-be-monitored function belonging to the calling function in each to-be-monitored function is determined as a fault function.
[0067] In an embodiment of the present disclosure, the fault locating method can be applied to a computer, a computing device, an electronic device, a server, a server cluster, and the like that can perform fault locating.
[0068] In an embodiment of the present disclosure, the buried point refers to inserting a buried point code at a buried point position in a program of a business module in a business system, so that the buried point code is run to generate corresponding buried point output information when running to the buried point position of the business module. For example, the buried point code is used to indicate the generation of an identification information, such as a buried point code at a first buried point position used to indicate the generation of identification information 1, and a buried point code at a second buried point position used to indicate the generation of identification information 2. The first buried point output information is identification information 1, and the second buried point output information is identification information 1.
[0069] In an embodiment of the present disclosure, there are two or more functions between neighboring buried points in the business system. The function, also known as a method in an object-oriented design computer program, refers to a program or code that can be directly referenced by another program or code. The number of buried points can be determined according to the load capacity of the server of the system, and then the buried points are uniformly set in the business system. The number of functions between neighboring buried points is the same, so that the buried point mode is simple and easy to implement. Alternatively, the positions of each buried point can be determined according to historical fault information and the load capacity of the server in the system, so that the buried point is accurate and the fault monitoring is faster.
[0070] In an embodiment of the present disclosure, the number of functions between neighboring buried points can be the same or different. The maximum runtime length required for normal program running between neighboring buried points can be determined according to the number of functions between neighboring buried points.
[0071] In an embodiment of the present disclosure, after the point-in-time monitoring is performed in the business system, the order of each point-in-time monitoring, the maximum running time corresponding to adjacent point-in-time monitoring, and the function information (e.g., function identifier) between adjacent point-in-time monitoring can be stored.
[0072] In an embodiment of the present disclosure, for a software or system designed based on an object-oriented design method, one or more processes can be run, and each process can implement the function of the process through one or more threads during the running of the process. In the process, any thread can call any function in the application to implement the function of the thread.
[0073] In an embodiment of the present disclosure, when the first point-in-time monitoring output information corresponding to the first point-in-time monitoring is monitored, it indicates that the program running before the first point-in-time monitoring is normal, and the second point-in-time monitoring is an adjacent point-in-time monitoring after the first point-in-time monitoring. In order to determine whether the program between the first point-in-time monitoring and the second point-in-time monitoring is running normally, the second point-in-time monitoring output information corresponding to the second point-in-time monitoring needs to be monitored, and the first preset time length is the maximum running time required for the program to run from the first point-in-time monitoring position to the second point-in-time monitoring position under normal running conditions. If the second point-in-time monitoring output information corresponding to the second point-in-time monitoring is monitored within the first preset time length, it indicates that the program between the first point-in-time monitoring and the second point-in-time monitoring is running normally, and the point-in-time monitoring output information of the adjacent point-in-time monitoring after the second point-in-time monitoring can be continuously monitored. If the second point-in-time monitoring output information corresponding to the second point-in-time monitoring is not monitored within the first preset time length, it indicates that the program between the first point-in-time monitoring and the second point-in-time monitoring fails to run to the second point-in-time monitoring position, and the functions to be monitored between the first point-in-time monitoring and the second point-in-time monitoring can be obtained. These functions to be monitored are the functions that may fail. In order to determine which function in these functions to be monitored fails, the identifier of the calling function being called in the at least one thread being executed can be obtained. Since only the calling function being called fails, the program cannot continue to run. Therefore, the identifiers of the functions to be monitored and the identifier of the calling function can be compared, and the function to be monitored belonging to the calling function in the functions to be monitored can be determined as the fault function.
[0074] The fault locating method proposed in this embodiment can first perform point-in-time monitoring. Since there are at least two functions between any two point-in-time monitoring, the range of the function that may fail can be determined. Then, the calling function being called is compared to determine the fault function. In this way, the point-in-time monitoring does not need to be performed between any two functions, the number of point-in-time monitoring is reduced, the load of the server is reduced, and the fault locating is also fast and accurate.
[0075] In an embodiment of the present disclosure, as shown in Figure 2 The fault locating method can further include the following steps:
[0076] In step S105, each embedding point position is determined according to historical fault information and load capacity of a server in the system.
[0077] In step S106, a corresponding embedding point code is set at each embedding point position.
[0078] In this embodiment, the program positions that have appeared faults in the system can be obtained from historical fault logs, and the embedding point positions can be determined according to the following rules: the more faults that appear in a program, the more embedding points are set in the program, and the greater the load capacity of a server in the system, the more embedding point positions are set. The number of embedding points can be determined according to the load capacity of the server in the system, and then each embedding point position in the program can be determined according to the historical fault information. The corresponding embedding point code can be inserted at each embedding point position, so as to realize embedding.
[0079] This embodiment determines each embedding point position by historical fault information and load capacity of a server in the system, and performs embedding, which can set more embedding points in a program that frequently appears faults, so that when a fault appears in the program, the densely set embedding points can quickly detect the fault area; and can set less embedding points in a program that less frequently appears faults, so as to reduce the load of the server.
[0080] In an embodiment of the present disclosure, as shown in Figure 3 The fault positioning method can further include the following steps:
[0081] In step S107, after monitoring first embedding point output information corresponding to a first embedding point, the first embedding point output information is deleted.
[0082] In this embodiment, in order to reduce the storage pressure of the system, after monitoring embedding point output information corresponding to any embedding point, the embedding point output information can be directly deleted.
[0083] In an embodiment of the present disclosure, as shown in Figure 4 Step S103 in the fault positioning method can be implemented as the following steps:
[0084] In step S1031, a thread list is obtained, and the thread list includes at least one executing thread.
[0085] In step S1032, a method stack of the at least one executing thread is obtained.
[0086] In step S1033, based on function information at the top of the method stack, an identifier of the calling function is obtained.
[0087] In this embodiment, the stack, also known as a stack, is a data structure with limited operations, such as a linked list. One end of the stack can insert and delete data, and the other end cannot be modified. The end where data can be inserted is called the top of the stack, and the other end is called the bottom of the stack. The process of data entering the stack from the top of the stack is called stacking (or stacking, stacking). The process of data leaving the stack from the top of the stack is called out (or pushing the stack). When new data is stacked, the element originally at the top of the stack is moved.
[0088] In this embodiment, a thread list can be obtained, which can include at least one thread being executed, for example, a thread list being executed by a server. For software or systems designed based on object-oriented design methods, when a function is called, the thread can first add the relevant information of the function to be called to the method stack, and after the call to the function ends, the thread can pop the relevant information of the function. That is, there is at least one function information in the method stack, and the function at the top of the method stack is the function currently being called by the thread. Therefore, after obtaining the threads being executed, the function information at the top of the method stack of these threads can be obtained by thread snapshotting, and the function information includes the identification of the function, so that the identification of the called function can be obtained from the function information at the top of the method stack. The identification of the called function is the identification of the function at the top of the method stack.
[0089] The embodiment can obtain the called function being called by the thread by obtaining the function at the top of the method stack of the thread being executed, and the method is simple and fast.
[0090] In an embodiment of the present disclosure, as shown in Figure 5 The fault positioning method can further include the following steps:
[0091] In step S108, the first preset time length is determined according to the historical normal running time length between the first and second burying points.
[0092] In this embodiment, the historical normal running time length between the first and second burying points can be obtained, and the maximum time length in the historical running time length is determined as the first preset time length. In this way, the first preset time length can be accurately determined, avoiding that the first preset time length is too short, resulting in a subsequent fault judgment error, and also avoiding that the first preset time length is too long, resulting in that the fault occurrence cannot be monitored in time.
[0093] The following is an apparatus embodiment of the present disclosure, which can be used to execute the method embodiments of the present disclosure.
[0094] Figure 6 A structural block diagram of a fault positioning device according to an embodiment of the present disclosure is shown, which can be realized by software, hardware, or a combination of the two to become part or all of an electronic device.
[0095] like Figure 6 As shown, the fault location device 600 includes: a monitoring module 601, a first acquisition module 602, a second acquisition module 603, and a first determination module 604.
[0096] The monitoring module 601 is configured to monitor the output information of the second embedding point after monitoring the first embedding point output information corresponding to the first embedding point. The second embedding point is located at the adjacent embedding point position after the first embedding point position in the currently running program. The currently running program has at least two functions between the first embedding point and the second embedding point.
[0097] The first acquisition module 602 is configured to acquire the identifiers of each function to be monitored between the first and second tracking points when no output information of the second tracking point is detected within a first preset time period.
[0098] The second acquisition module 603 is configured to acquire the identifier of the function being called in at least one currently executing thread;
[0099] The first determining module 604 is configured to determine the monitored functions belonging to the calling function among the monitored functions as fault functions based on the identifiers of each monitored function and the identifier of the calling function.
[0100] In one embodiment of this disclosure, the fault location device 600 can be applied to computers, computing devices, electronic devices, servers, server clusters, etc., that can perform fault location.
[0101] In one embodiment of this disclosure, "insertion point" refers to inserting insertion point code at the insertion point location within the program of a business module in a business system. When the program reaches the insertion point location of the business module, the insertion point code will be executed to generate corresponding insertion point output information. For example, the insertion point code is used to indicate the generation of identification information. If the insertion point code at the first insertion point location indicates the generation of identification information 1, and the insertion point code at the second insertion point location indicates the generation of identification information 2, then the first insertion point output information is identification information 1, and the second insertion point output information is identification information 2.
[0102] In an embodiment of the present disclosure, there are two or more functions between adjacent buries in the business system. Functions, also known as methods in object-oriented design computer programs, refer to a piece of program or code that can be directly referenced by another piece of program or code. The number of buries can be determined according to the load capacity of the server of the system, and then the buries are uniformly set in the business system. The number of functions between adjacent buries is the same. In this way, the bury method is simple and easy to implement. Alternatively, the positions of the buries can be determined according to historical fault information and the load capacity of the server in the system. In this way, the bury is accurate and the fault monitoring is faster.
[0103] In an embodiment of the present disclosure, the number of functions between adjacent buries can be the same or different. The maximum runtime required for the normal operation of the program between adjacent buries can be determined according to the number of functions between adjacent buries.
[0104] In an embodiment of the present disclosure, after burying in the business system, the order of each bury, the maximum runtime corresponding to adjacent buries, and the function information (such as function identifier) between adjacent buries can be stored.
[0105] In an embodiment of the present disclosure, for software or systems designed based on an object-oriented design method, one or more processes can be run, and each process can implement the function of the process through one or more threads during running. Any thread can call any function in the application program to implement the function of the thread during running.
[0106] In one embodiment of this disclosure, when the output information of the first tracking point is detected, it indicates that the program running before the first tracking point is normal. The second tracking point is an adjacent tracking point after the first tracking point. To determine whether the program between the first and second tracking points is running normally, it is necessary to monitor the output information of the second tracking point. The first preset duration is the maximum runtime required for the program to run from the position of the first tracking point to the position of the second tracking point under normal running conditions. If the output information of the second tracking point is detected within the first preset duration, it indicates that the program between the first and second tracking points is running normally, and the tracking point output information of the adjacent tracking points after the second tracking point can continue to be monitored. If the output information of the second tracking point is not detected within the first preset duration, it indicates that the program between the first and second tracking points has malfunctioned and cannot run to the position of the second tracking point. At this time, each function to be monitored between the first and second tracking points can be obtained; these functions to be monitored are the functions that may cause malfunctions. To determine which of these monitored functions is faulty, we can obtain the identifier of the calling function currently being invoked by at least one currently executing thread. Since only a faulty calling function will cause the program to stop running, we can compare the identifiers of each monitored function with the identifier of the calling function to identify the monitored function that belongs to the calling function.
[0107] The fault location device proposed in this embodiment can first perform data point monitoring. Since there are at least two functions between any two data points, the range of functions where the fault occurs can be determined. Then, it is compared with the currently called function to determine the faulty function. This eliminates the need to place data points between any two functions, reducing the number of data points, lowering the server load, and making fault location quick and accurate.
[0108] In one embodiment of this disclosure, such as Figure 7 As shown, the device further includes:
[0109] The second determination module 605 is configured to determine the location of each embedding point based on historical fault information and the load capacity of the server in the system.
[0110] The setting module 606 is configured to set the corresponding embedding code at each embedding point location.
[0111] In the embodiment, the program positions in the system where failures have occurred can be obtained from the historical failure log, and the positions of the embedded points can be determined according to the following rules: the more failures occur in a program, the more embedded points are made in the program, and the greater the load capacity of the server in the system, the more positions of the embedded points. The number of embedded points can be determined according to the load capacity of the server in the system, and then the positions of the embedded points in the program can be determined according to the historical failure information. The corresponding embedded point code can be inserted at each position of the embedded points, so as to realize embedding.
[0112] The embodiment determines the positions of the embedded points through historical failure information and the load capacity of the server in the system, embeds more points in the program where failures frequently occur, so that when a failure occurs in the program, the densely arranged embedded points can quickly detect the area where the failure occurs, and embeds fewer points in the program where failures rarely occur, so as to reduce the load of the server.
[0113] In an embodiment of the present disclosure, as shown in Figure 8 The apparatus further includes:
[0114] The deletion module 607 is configured to delete the first embedded point output information after monitoring the first embedded point output information corresponding to the first embedded point.
[0115] In the embodiment, in order to reduce the storage pressure of the system, the embedded point output information corresponding to any embedded point can be directly deleted after being monitored.
[0116] In an embodiment of the present disclosure, the second acquisition module 603 is configured to:
[0117] Acquire a thread list, the thread list including at least one executing thread;
[0118] Acquire a method stack of the at least one executing thread;
[0119] Obtain the identification of the calling function based on function information at the top of the method stack.
[0120] In the embodiment, a stack, also known as a stack, is a data structure with limited operation, such as a linked list. One end of the stack can insert and delete data, and the other end cannot be modified. The end where data can be inserted is called the top of the stack, and the other end is called the bottom of the stack. The process of data entering the stack from the top is called stack push (or stack in, stack in). The process of data leaving the stack from the top is called stack out (or stack push). When new data is pushed into the stack, the element originally at the top of the stack moves backward.
[0121] In this embodiment, a thread list can be acquired, which can include at least one thread being executed, for example, a thread list of a server being run. For software or system designed based on an object-oriented design method, when a function is called, a thread can first add relevant information of the function to be called to a method stack, and after ending the call of the function, the thread can pop the relevant information of the function from the method stack. That is, there is at least one function information in the method stack, and the function at the top of the method stack is the function currently called by the thread. Therefore, after the threads being executed are acquired, the function information at the top of the method stack of these threads can be obtained by means of thread snapshot, and the function information includes the identification of the function, so that the identification of the called function can be obtained from the function information at the top of the method stack, and the identification of the called function is the identification of the function at the top of the method stack.
[0122] The embodiment can obtain the called function called by the thread by acquiring the function at the top of the method stack of the thread being executed, and the method is simple and fast.
[0123] In an embodiment of the present disclosure, as shown in Figure 9 The apparatus further includes:
[0124] The third determination module 608 is configured to determine the first preset time length according to the historical normal runtime length between the first and second bury points.
[0125] In this embodiment, the historical normal runtime length between the first and second bury points can be acquired, and the maximum time length in the historical runtime length is determined as the first preset time length, so that the first preset time length can be accurately determined, the first preset time length set too short is avoided, the subsequent fault judgment is avoided, and the first preset time length set too long is avoided, and the occurrence of the fault is not monitored in time.
[0126] The present disclosure also discloses an electronic device, Figure 10 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown.
[0127] As shown in Figure 10 The electronic device 1000 includes a memory 1001 and a processor 1002; the memory 1001 is configured to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor 1002 to implement the above method steps, and the method includes:
[0128] monitor second-buried-point output information corresponding to a second buried point after monitoring first-buried-point output information corresponding to a first buried point, the second buried point being located at a neighboring buried point position after the first buried point position in a currently running program, the currently running program having at least two functions between the first buried point and the second buried point;
[0129] when the second-buried-point output information is not monitored within the first preset time length, obtaining an identifier of each to-be-monitored function between the first buried point and the second buried point;
[0130] obtaining an identifier of a calling function being called in at least one thread being currently executed;
[0131] based on the identifier of each to-be-monitored function and the identifier of the calling function, determining a to-be-monitored function belonging to the calling function in the to-be-monitored functions as a fault function.
[0132] In an embodiment of the present disclosure, the method further comprises:
[0133] determining each buried point position according to historical fault information and load capacity of a server in a system;
[0134] setting a corresponding buried point code at each buried point position.
[0135] In an embodiment of the present disclosure, the method further comprises:
[0136] after monitoring first-buried-point output information corresponding to a first buried point, deleting the first-buried-point output information.
[0137] In an embodiment of the present disclosure, the obtaining of the identifier of the calling function being called in at least one thread being currently executed comprises:
[0138] obtaining a thread list, the thread list comprising at least one thread being executed;
[0139] obtaining a method stack of the at least one thread being executed;
[0140] obtaining the identifier of the calling function based on function information at a top of the method stack.
[0141] In an embodiment of the present disclosure, the method further comprises:
[0142] determining the first preset time length according to a historical normal running time length between the first buried point and the second buried point.
[0143] Figure 11 is a structural schematic diagram of a computer system suitable for implementing a fault positioning method according to an embodiment of the present disclosure.
[0144] As Figure 11 shown, the computer system 1100 includes a processing unit 1101 that can execute the various processing of the above-described embodiments according to a program stored in a read-only memory (ROM) 1102 or a program loaded from a storage section 1108 into a random access memory (RAM) 1103. In the RAM 1103, various programs and data required for the operation of the system 1100 are also stored. The processing unit 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.
[0145] The following components are connected to the I / O interface 1105: an input section 1106 including input devices such as a keyboard and a mouse; an output section 1107 including output devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 1108 including a hard disk; and a communication section 1109 including a network interface card such as a LAN card, a modem, and the like. The communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to the I / O interface 1105 as necessary. A removable recording medium 1111 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like is attached to the drive 1110 as necessary, so that a computer program read therefrom is installed into the storage section 1108 as necessary. Among them, the processing unit 1101 can be implemented as a CPU, a GPU, a TPU, a FPGA, a NPU, or the like.
[0146] In particular, according to embodiments of the present disclosure, the above-described method can be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a non-transitory computer readable medium, the computer program containing program code for executing the fault localization method. In such embodiments, the computer program can be downloaded and installed from a network via the communication section 1109, and / or installed from the removable recording medium 1111.
[0147] The flow and block diagrams in the drawings represent possible architectural, functional, and operational architectures of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block can represent a module, a segment, or a portion of code that comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flowchart illustrations, and combinations thereof, can be implemented by special purpose hardware-based systems that perform the specified functions or operations, or combinations of special purpose hardware and computer instructions.
[0148] The units or modules described in the embodiments of the present disclosure can be implemented by software, or by hardware. The described units or modules can also be arranged in a processor, and the name of the unit or module does not constitute a limitation on the unit or module itself in some cases.
[0149] As another aspect, the embodiments of the present disclosure also provide a computer readable storage medium, which can be the computer readable storage medium included in the apparatus described in the above embodiments, or can exist separately from the apparatus and not be assembled into the apparatus. The computer readable storage medium stores one or more programs for execution by one or more processors to perform the methods described in the embodiments of the present disclosure.
[0150] The above description is merely preferred embodiments of the present disclosure and a description of the applied technical principles. Those skilled in the art should understand that the scope of the application involved in the embodiments of the present disclosure is not limited to the technical solutions formed by the specific combinations of the above technical features, and should also cover other technical solutions formed by any combinations of the above technical features or equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features disclosed in the embodiments of the present disclosure (but not limited to) having similar functions to form technical solutions.
Claims
1. A fault locating method, comprising: determining each embedding point position according to historical fault information and load capacity of a server in a system; setting a corresponding embedding point code at each embedding point position; monitoring second embedding point output information corresponding to a second embedding point after monitoring first embedding point output information corresponding to a first embedding point, the second embedding point being located at a neighboring embedding point position after the first embedding point position in a currently running program, the currently running program having at least two functions between the first embedding point and the second embedding point; acquiring an identifier of each to-be-monitored function between the first embedding point and the second embedding point when the second embedding point output information is not monitored within a first preset time length, the first preset time length being a maximum running time length required for the program to run from the first embedding point position to the second embedding point position under normal running conditions; acquiring an identifier of a calling function being called in at least one thread being currently executed; and determining a to-be-monitored function belonging to the calling function among the each to-be-monitored function as a fault function based on the identifier of each to-be-monitored function and the identifier of the calling function.
2. The method of claim 1, further comprising: deleting the first embedding point output information after monitoring the first embedding point output information corresponding to the first embedding point.
3. The method of claim 1, wherein the acquiring of the identifier of the calling function being called in the at least one thread being currently executed comprises: acquiring a thread list, the thread list including at least one thread being executed; acquiring a method stack of the at least one thread being executed; and obtaining the identifier of the calling function based on function information at a top of the method stack.
4. The method of claim 1, further comprising: determining the first preset time length according to a historical normal running time length between the first embedding point and the second embedding point.
5. A fault locating apparatus, comprising: a second determining module configured to determine each embedding point position according to historical fault information and load capacity of a server in a system; a setting module configured to set a corresponding embedding point code at each embedding point position; a monitoring module configured to monitor second embedding point output information corresponding to a second embedding point after monitoring first embedding point output information corresponding to a first embedding point, the second embedding point being located at a neighboring embedding point position after the first embedding point position in a currently running program, the currently running program having at least two functions between the first embedding point and the second embedding point; a first acquiring module configured to acquire an identifier of each to-be-monitored function between the first embedding point and the second embedding point when the second embedding point output information is not monitored within a first preset time length, the first preset time length being a maximum running time length required for the program to run from the first embedding point position to the second embedding point position under normal running conditions; a second acquiring module configured to acquire an identifier of a calling function being called in at least one thread being currently executed; and The first determining module is configured to determine, based on the identities of the respective to-be-monitored functions and the identity of the calling function, a to-be-monitored function belonging to the calling function from the respective to-be-monitored functions as a fault function.
6. An electronic device comprising a memory and at least one processor; wherein, The memory is configured to store one or more computer instructions, wherein the one or more computer instructions are executed by the at least one processor to implement the method steps of any one of claims 1-4. 7.A computer readable storage medium having stored thereon computer instructions that, when executed by a processor, implement the method steps of any one of claims 1-4. 8.A computer program product comprising computer programs / instructions that, when executed by a processor, implement the method steps of any one of claims 1-4.
Citation Information
Patent Citations
Mobile terminal code-free buried point solving method
CN111352849A
Exception monitoring method and device
CN112596938A