Fault tracking method and device for abnormal threads of database, equipment and storage medium
By building a fault tracing information set under a multi-process coroutine architecture, the problem of incomplete database fault tracing information is solved, and more accurate fault root cause location and analysis are achieved.
Patent Information
- Application Number
- CN202511278349.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-09
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-09-09
AI Technical Summary
In the existing technology, database fault tracking information is incomplete, which makes it difficult for operation and maintenance personnel to accurately locate the cause of the fault and unable to repair the database fault in a timely manner.
By using thread identification information to determine the current and historical stack information of the exception thread from multiple symbol tables and memory spaces under a multi-process coroutine architecture, and combining the function name and code segment address, a fault tracing information set is constructed, including the current and historical function names to supplement the function call process of the exception thread.
It provides a more detailed and complete function calling process, improves the accuracy of fault root cause location in a distributed environment, and ensures the accuracy and completeness of fault analysis.
Smart Images

Figure CN120803794A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of database technology, and in particular to a method, device, equipment and storage medium for tracing a fault of an abnormal database thread. Background Art
[0002] As the amount of data stored in databases continues to grow, they often fail due to various issues in real-world applications, resulting in their inability to properly respond to and process incoming requests. In related technologies, it is often necessary to use data obtained through testing to determine the cause of database access failures. For example, using a network bandwidth testing tool to measure real-time network bandwidth can be used to determine the cause of database failures.
[0003] In the process of realizing the concept of the present invention, there are at least the following problems in the related art: the information obtained for fault cause analysis is incomplete, which makes it difficult for operation and maintenance personnel or tools used for fault analysis to determine the root cause of the database failure based on the currently obtained fault tracing information, and thus cannot repair the database failure in a timely manner. Summary of the Invention
[0004] In view of the above problems, the present invention provides a method, apparatus, device and storage medium for tracing faults of abnormal threads in a database.
[0005] According to a first aspect of the present application, a method for fault tracing of a database exception thread is provided, comprising: in response to receiving an exception prompt signal representing that a current execution thread is running abnormally, taking the current execution thread as an exception thread; determining pointer information indicating a function code segment address being run from current stack information of the exception thread; determining a target symbol table matching thread identification information of the exception thread from a plurality of symbol tables according to the thread identification information of the exception thread; the symbol tables comprising mapping relationships between function names and function code segment addresses; determining a plurality of first function names corresponding to a plurality of function code segment addresses included in the current stack information of the exception thread based on the target symbol table and the pointer information; determining historical stack information of the exception thread running on other processes from a plurality of memory spaces corresponding to a plurality of processes according to the thread identification information of the exception thread; the historical stack information comprising a plurality of historical function code segment addresses, a first program to which the plurality of historical function code segment addresses belong being different in function from a second program to which the plurality of function code segment addresses belong, each program corresponding to at least one symbol table; determining a plurality of second function names corresponding to the plurality of historical function code segment addresses according to a historical target symbol table matching the program to which the plurality of historical function code segment addresses belong; and determining a fault tracing information set based on the plurality of function code segment addresses, the plurality of historical function code segment addresses, the plurality of first function names and the plurality of second function names.
[0006] According to an embodiment of the present application, the historical target symbol table is obtained by: determining task identification information corresponding to other processes running the exception thread from a first mapping table according to the thread identification information of the exception thread; wherein the first mapping table records task identification information executed during running of the exception thread; determining the first program from a plurality of programs according to the task identification information; and accessing a symbol table storage space according to program identification information of the first program to determine the historical target symbol table corresponding to the first program.
[0007] According to an embodiment of the present application, the determining of the plurality of first function names corresponding to the plurality of function code segment addresses included in the current stack information of the exception thread based on the target symbol table and the pointer information comprises: backtracking in the current stack information of the exception thread according to the pointer information to determine the plurality of function code segment addresses; and determining the plurality of first function names corresponding to the plurality of function code segment addresses in the plurality of symbol tables according to the plurality of function code segment addresses.
[0008] According to the embodiment of the present application, the above determining the plurality of function code segment addresses according to the pointer information in the current stack information of the abnormal thread comprises: determining whether the function code segment represented by the function code segment address of the current backtracking is a top function code segment; continuing backtracking in the case that the function code segment represented by the function code segment address of the current backtracking is not the top function code segment; and stopping backtracking and obtaining the plurality of function code segment addresses in the case that the function code segment represented by the function code segment address of the current backtracking is the top function code segment.
[0009] According to the embodiment of the present application, the above determining the fault tracking information set based on the plurality of function code segment addresses, the plurality of historical function code segment addresses, the plurality of first function names and the plurality of second function names comprises: determining the function execution order of the plurality of function code segment addresses and the plurality of historical function code segment addresses based on the current stack information of the abnormal thread and the historical stack information of the abnormal thread; and sorting the plurality of first function names and the plurality of second function names based on the function execution order to obtain the fault tracking information set.
[0010] According to the embodiment of the present application, the plurality of memory spaces corresponding to the plurality of processes are located in a shared memory; and the above determining the historical stack information of the abnormal thread running on other processes corresponding to the thread identification information of the abnormal thread from the plurality of memory spaces corresponding to the plurality of processes comprises: determining the historical stack information of the abnormal thread in the shared memory according to the thread identification information of the abnormal thread.
[0011] According to the embodiment of the present application, the above method further comprises: in response to the abnormal signal triggered by the abnormal thread, obtaining a callback function corresponding to the abnormal signal; and using the callback function to decrypt the encrypted symbol table set in the memory to obtain the plurality of symbol tables.
[0012] The second aspect of the present application provides a database abnormal thread fault tracking device, comprising: a pointer determination module, configured to determine a pointer information indicating a function code segment address being run from current stack information of a current execution thread as an abnormal thread in response to receiving an abnormal prompt signal representing that the current execution thread runs abnormally; a first determination module, configured to determine a target symbol table matching thread identification information of the abnormal thread from a plurality of symbol tables according to the thread identification information of the abnormal thread; the symbol table comprises a mapping relationship between a function name and a function code segment address; a function determination module, configured to determine a plurality of first function names corresponding to a plurality of function code segment addresses included in the current stack information of the abnormal thread based on the target symbol table and the pointer information; an information determination module, configured to determine historical stack information of the abnormal thread running on other processes matching the thread identification information of the abnormal thread from a plurality of memory spaces corresponding to a plurality of processes according to the thread identification information of the abnormal thread; the historical stack information comprises a plurality of historical function code segment addresses, a first program to which the plurality of historical function code segment addresses belong is different from a second program to which the plurality of function code segment addresses belong in function, and each program corresponds to at least one symbol table; a second determination module, configured to determine a plurality of second function names corresponding to the plurality of historical function code segment addresses according to a historical target symbol table matching a program to which the plurality of historical function code segment addresses belong; and an information set determination module, configured to determine a fault tracking information set based on the plurality of function code segment addresses, the plurality of historical function code segment addresses, the plurality of first function names and the plurality of second function names.
[0013] The third aspect of the present application provides an electronic device, comprising: one or more processors; a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method.
[0014] The fourth aspect of the present application further provides a computer readable storage medium having stored thereon a computer program or instructions, wherein the computer program or instructions are executed by a processor to implement the steps of the method.
[0015] According to the embodiment of the present application, under the multi-process coroutine architecture, the abnormal thread can be migrated between multiple processes, causing the current stack information and the historical stack information corresponding to the abnormal thread to be stored in multiple memory spaces, according to the thread identification information of the abnormal thread, the historical stack information of the abnormal thread running on other processes that matches the thread identification information of the abnormal thread is determined from the multiple memory spaces corresponding to the multiple processes one by one. The multiple historical function code segment addresses included in the historical stack information belong to a first program, the second program to which the multiple function code segment addresses belong has different functions, and each program corresponds to at least one symbol table, based on the target symbol table and pointer information corresponding to the thread identification information of the abnormal thread, multiple first function names corresponding to the multiple function code segment addresses included in the current stack information are determined; according to the historical target symbol table matching the program to which the multiple historical function code segment addresses belong, multiple second function names corresponding to the multiple historical function code segment addresses are determined, so as to supplement the function call process of the abnormal thread before migration based on the multiple function code segment addresses, the multiple historical function code segment addresses, the multiple first function names and the multiple second function names. The fault tracking information set of the abnormal thread migrated between the multiple processes is determined, thereby providing a more detailed and complete function call process for fault analysis of the abnormal thread, and improving the accuracy of fault root cause positioning in a distributed environment. BRIEF DESCRIPTION OF DRAWINGS
[0016] The above and other objects, features and advantages of the present application will become more apparent from the following description when taken in conjunction with the accompanying drawings, in which:
[0017] Figure 1 A diagram showing the application scenario of the fault tracking method of the database abnormal thread according to an embodiment of the present application is shown.
[0018] Figure 2 A flowchart showing the fault tracking method of the database abnormal thread according to an embodiment of the present application is shown.
[0019] Figure 3 A relationship diagram showing the relationship between threads and processes according to an embodiment of the present application is shown.
[0020] Figure 4 A flowchart showing the fault tracking method of the database abnormal thread according to another embodiment of the present application is shown.
[0021] Figure 5 A schematic diagram showing the fault tracking information set according to an embodiment of the present application is shown.
[0022] Figure 6 A structural block diagram of the fault tracking device of the database abnormal thread according to an embodiment of the present application is shown.
[0023] Figure 7 A block diagram of an electronic device suitable for implementing a fault tracking method of a database exception thread according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0024] Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. It should be understood, however, that the description which follows is merely illustrative and is not intended to limit the scope of the present application. In the following detailed description of embodiments of the present application, numerous specific details are set forth in order to provide a thorough understanding of the present application. However, it will be apparent to one skilled in the art that one or more embodiments of the present application can be practiced without these specific details. In other instances, well-known structures and functions have not been described in detail in order to avoid obscuring aspects of the present application.
[0025] The terms used herein are merely used to describe specific embodiments and are not intended to limit the present application. The terms "include" and "have" and the like used herein indicate the presence of the described features, steps, operations, and / or components but do not preclude the presence or addition of one or more other features, steps, operations, or components.
[0026] All terms used herein, including technical and scientific terms, have the same meanings as those generally understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having meanings consistent with the context of the present specification, and should not be interpreted in an idealized or overly formal way.
[0027] In the case of using expressions similar to "at least one of A, B, and C, etc.", it should generally be interpreted to include at least one of A, B, or C, or a combination thereof, unless otherwise specified. For example, "a system having at least one of A, B, and C" should be interpreted to include a system having at least one of A, B, or C, or a system having a combination of at least one of A, B, and C.
[0028] In the technical solutions of the present application, the collection, updating, analysis, processing, use, transmission, provision, disclosure, storage, etc. of the data involved (for example, including but not limited to user personal information) comply with the relevant legal regulations, are used for legal purposes, and do not violate public order and good customs. In particular, necessary measures are taken to prevent illegal access to user personal information data, and to maintain user personal information security and network security.
[0029] According to an embodiment of the present application, under the multi-process coroutine architecture, the thread has the feature of cross-process migration. This makes the stack information originally belonging to the same thread scattered and divided into multiple different and discontinuous stack spaces. The single-process stack snapshot used in the related art can only intercept the fragment information of the last resident process of the abnormal thread, and a large amount of related information in the stack space of other processes cannot be obtained, resulting in incomplete fault tracking information, and it is difficult to accurately determine the fault cause of the database based on the fault tracking information obtained in the related art.
[0030] Based on this, an embodiment of the present application provides a fault tracking method of a database abnormal thread. In response to receiving an abnormal prompt signal for characterizing that a current execution thread runs abnormally, the current execution thread is taken as an abnormal thread. Pointer information for indicating a function code segment address being run is determined from current stack information of the abnormal thread. According to thread identification information of the abnormal thread, a target symbol table matched with the thread identification information of the abnormal thread is determined from a plurality of symbol tables. The symbol table includes a mapping relationship between a function name and a function code segment address. Based on the target symbol table and the pointer information, a plurality of first function names corresponding to a plurality of function code segment addresses included in the current stack information of the abnormal thread are determined. According to the thread identification information of the abnormal thread, historical stack information of the abnormal thread running on other processes is determined from a plurality of memory spaces corresponding to a plurality of processes, which is matched with the thread identification information of the abnormal thread. The historical stack information includes a plurality of historical function code segment addresses. A first program to which the plurality of historical function code segment addresses belong is different in function from a second program to which the plurality of function code segment addresses belong. Each program corresponds to at least one symbol table. According to a historical target symbol table matched with the program to which the plurality of historical function code segment addresses belong, a plurality of second function names corresponding to the plurality of historical function code segment addresses are determined. Based on the plurality of function code segment addresses, the plurality of historical function code segment addresses, the plurality of first function names and the plurality of second function names, a fault tracking information set is determined.
[0031] Figure 1 An application scenario diagram of the fault tracking method of the database abnormal thread according to an embodiment of the present application is shown.
[0032] As shown in Figure 1 , the application scenario 100 according to the embodiment can include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104 and a server 105. The network 104 is used as a medium to provide a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103 and the server 105. The network 104 can include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0033] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages and the like. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, and the like (only as examples).
[0034] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smartphones, tablet computers, laptop computers, desktop computers, and the like.
[0035] The server 105 can be a server providing various services, such as a background management server supporting websites browsed by the user using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (only as an example). The background management server can analyze and process received user requests and the like, and feed back the processing results (such as web pages, information, or data generated or obtained according to user requests) to the terminal device.
[0036] It should be noted that the database exception thread fault tracking method provided by the embodiment of the present application can generally be executed by the server 105. Correspondingly, the database exception thread fault tracking device provided by the embodiment of the present application can generally be arranged in the server 105. The database exception thread fault tracking method provided by the embodiment of the present application can also be executed by a server or a server cluster different from the server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or the server 105. Correspondingly, the database exception thread fault tracking device provided by the embodiment of the present application can also be arranged in a server or a server cluster different from the server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or the server 105.
[0037] It should be understood that Figure 1 The number of the first terminal device, the second terminal device, the third terminal device, the network, and the server in the above description is only illustrative. According to actual needs, there can be any number of the first terminal device, the second terminal device, the third terminal device, the network, and the server.
[0038] The database exception thread fault tracking method of the embodiment of the present application will be described in detail below based on the scenario described above. Figure 1 Figures 2-5 The database exception thread fault tracking method of the embodiment of the present application will be described in detail below based on the scenario described above.
[0039] Figure 2 A flowchart of a fault tracking method of a database abnormal thread according to an embodiment of the present application is shown.
[0040] As shown in the figure, the fault tracking method of the database abnormal thread according to the embodiment comprises operations S210-S260. Figure 2
[0041] In operation S210, in response to receiving an abnormal prompt signal for characterizing that the current execution thread runs abnormally, the current execution thread is taken as an abnormal thread, and pointer information for indicating a function code segment address being run is determined from the current stack information of the abnormal thread.
[0042] In operation S220, according to the thread identification information of the abnormal thread, a target symbol table matching the thread identification information of the abnormal thread is determined from a plurality of symbol tables; the symbol table comprises a mapping relationship between a function name and a function code segment address.
[0043] In operation S230, based on the target symbol table and the pointer information, a plurality of first function names corresponding to a plurality of function code segment addresses included in the current stack information of the abnormal thread are determined.
[0044] In operation S240, according to the thread identification information of the abnormal thread, historical stack information of the abnormal thread running on other processes matching the thread identification information of the abnormal thread is determined from a plurality of memory spaces corresponding to a plurality of processes; the historical stack information comprises a plurality of historical function code segment addresses, a first program to which the plurality of historical function code segment addresses belong is different from a second program to which the plurality of function code segment addresses belong in function, and each program corresponds to at least one symbol table.
[0045] In operation S250, according to a historical target symbol table matching the program to which the plurality of historical function code segment addresses belong, a plurality of second function names corresponding to the plurality of historical function code segment addresses are determined.
[0046] In operation S260, based on the plurality of function code segment addresses, the plurality of historical function code segment addresses, the plurality of first function names and the plurality of second function names, a fault tracking information set is determined.
[0047] According to the embodiment of the present application, under a multi-process coroutine architecture, a process is a basic unit of resource allocation, which contains all resources required for program running, for example, the process is allocated with an independent memory space. A thread is a basic unit for executing tasks, and the thread can be migrated between different processes, therefore, information related to the abnormal thread, for example, historical stack information, will be scattered and stored in a plurality of discontinuous memory spaces because the abnormal thread has been migrated between a plurality of processes.
[0048] According to an embodiment of the present application, the abnormality prompt signal can be composed of multiple characters, for example, the abnormality prompt signal can be "error0". In the case that an exception occurs to a thread running in the database, the abnormality prompt signal can be sent to determine the fault tracking information set for the abnormal thread through fault tracking.
[0049] According to an embodiment of the present application, in response to receiving the abnormality prompt signal for characterizing the abnormal running of the current execution thread, the current execution thread is taken as an abnormal thread, and the pointer information pushed into the stack is determined from the current stack information of the abnormal thread, wherein the current stack information is stored in the stack storage space of the process in which the abnormal thread is located when the exception occurs; the pointer information in the current stack information includes the function code segment address being run, and the pointer information can be the function code segment address being run.
[0050] According to an embodiment of the present application, the thread identification information of the abnormal thread can be in the form of characters. According to the thread identification information of the abnormal thread, the historical stack information matching the thread identification information of the abnormal thread is searched from the multiple memory spaces corresponding to the multiple processes one by one. The historical stack information can include multiple historical function code segment addresses, and the historical function code segment addresses are addresses of the function code segments called by the abnormal thread in other processes.
[0051] According to an embodiment of the present application, the function code segment represents a code segment of a function, and the program can include multiple function code segments. The symbol table can be generated after the program is compiled, and the symbol table includes multiple function code segment addresses and function names corresponding to the multiple function code segment addresses respectively. The program can include multiple function code segments.
[0052] According to an embodiment of the present application, the first program is used to represent the program corresponding to the historical code segment address, and the second program is used to represent the program corresponding to the function code segment address, and there can be multiple first programs and multiple second programs. The functions of the first program and the second program are different, that is, the source code, the compiler output and the runtime behavior of the first program are different from the source code, the compiler output and the runtime behavior of the second program, for example: the first program is used to implement algorithm A, and the second program is used to implement algorithm B, the historical function code segment belonging to the first program and the function code segment belonging to the second program can have shared code, but the core functions of the first program and the second program are different, which can cause the historical function code segment address belonging to the first program to be different from the function code segment address belonging to the second program.
[0053] According to an embodiment of the present application, according to the thread identification information of the abnormal thread, the target symbol table and the historical target symbol table matching the thread identification information of the abnormal thread are determined from the multiple symbol tables stored in the storage space.
[0054] According to an embodiment of the present application, based on the mapping relationship between the function names included in the target symbol table and the function code segment addresses, the first function name corresponding to the pointer information is searched in the target symbol table, and a plurality of first function names corresponding to the plurality of function code segment addresses included in the current stack information.
[0055] According to an embodiment of the present application, for the historical code segment addresses of the plurality of historical code segments belonging to the first program, the plurality of historical function code segment addresses are matched based on the historical target symbol table respectively, to determine a plurality of second function names corresponding to the plurality of historical function code segment addresses.
[0056] According to an embodiment of the present application, the following data is sorted in the form of key-value pairs: the plurality of function code segment addresses and the plurality of first function names corresponding to the plurality of function code segment addresses, and the plurality of historical function code segment addresses and the plurality of second function names corresponding to the plurality of function code segment addresses, to determine a fault tracking information set, so that the database operation and maintenance personnel can determine the fault reason based on the fault tracking information set, and maintain the database system based on the fault reason.
[0057] According to an embodiment of the present application, under the multi-process coroutine architecture, the abnormal thread can be migrated between a plurality of processes, causing the current stack information and the historical stack information corresponding to the abnormal thread to be stored in a plurality of memory spaces. According to the thread identification information of the abnormal thread, the historical stack information of the abnormal thread running on other processes that matches the thread identification information of the abnormal thread is determined from a plurality of memory spaces corresponding to a plurality of processes. The plurality of historical function code segment addresses included in the historical stack information belong to a first program, the plurality of function code segment addresses belong to a second program, the functions of the first program and the second program are different, and each program corresponds to at least one symbol table. Based on the target symbol table corresponding to the thread identification information of the abnormal thread and the pointer information, a plurality of first function names corresponding to the plurality of function code segment addresses included in the current stack information are determined. According to the historical target symbol table matching the program to which the plurality of historical function code segment addresses belong, a plurality of second function names corresponding to the plurality of historical function code segment addresses are determined. In order to supplement the function call process of the abnormal thread before migration based on the plurality of function code segment addresses, the plurality of historical function code segment addresses, the plurality of first function names and the plurality of second function names, the fault tracking information set of the abnormal thread migrated between the plurality of processes is determined, thereby providing a more detailed and complete function call process for fault analysis of the abnormal thread, and improving the accuracy of fault root cause positioning in a distributed environment.
[0058] Figure 3 A relationship diagram showing the relationship between threads and processes according to an embodiment of the present application is shown.
[0059] AsFigure 3 As shown, the process Q and the process P are only containers of the execution body, and the thread 1, the thread 2 and the thread 3 are the execution bodies, and the thread 1, the thread 2 and the thread 3 can migrate between different processes. Specifically, with reference to the time direction, in the process Q, the execution order of the threads is the thread 1, the thread 2, the thread 3 and the thread 1, and in the process P, the execution order of the threads is the thread 2, the thread 3, the thread 1 and the thread 2. The thread 1 is previously executed in the process Q, and after a predetermined time duration, the thread 1 is interrupted. The thread 1 jumps to the process P to execute, and after a predetermined time duration, the thread 1 is interrupted. Then, the thread 1 jumps to the process Q to execute.
[0060] Similarly, the thread 2 is previously executed in the process P, and after a predetermined time duration, the thread 2 is interrupted. The thread 2 jumps to the process Q to execute, and after a predetermined time duration, the thread 2 is interrupted. Then, the thread 2 jumps to the process P to execute.
[0061] According to the embodiment of the present application, the fault tracking method of the database exception thread further comprises: in response to the exception signal triggered by the exception thread, acquiring a callback function corresponding to the exception signal; and using the callback function to decrypt the encrypted symbol table set in the memory space to obtain a plurality of symbol tables.
[0062] According to the embodiment of the present application, in response to the exception signal triggered by the exception thread, the callback function corresponding to the exception signal is matched and executed, so that the encrypted symbol table set stored in the memory is decrypted using the decryption key to obtain a plurality of symbol tables.
[0063] According to the embodiment of the present application, the symbol table set is dynamically decrypted in the memory space by the special callback function, which reduces the opportunity of long-term exposure of the symbol table in the memory, reduces the possibility of accidental modification or pollution by other processes or threads, ensures the accuracy and reliability of the symbol table, and thus improves the accuracy of the fault tracking information set.
[0064] According to the embodiment of the present application, the plurality of memory spaces corresponding to the plurality of processes are located in the shared memory; and the historical stack information of the exception thread running on the other process, which matches the thread identification information of the exception thread, is determined from the plurality of memory spaces corresponding to the plurality of processes according to the thread identification information of the exception thread, including: determining the historical stack information of the exception thread in the shared memory according to the thread identification information of the exception thread.
[0065] According to the embodiment of the present application, the plurality of memory spaces corresponding to the plurality of processes are located in the shared memory, and the historical stack information of the exception thread can be acquired by accessing the shared memory.
[0066] According to the embodiment of the present application, the plurality of memory spaces corresponding to the plurality of processes are stored in the shared memory, so that the time for searching the history stack information in other related processes is shortened, the risk that the history stack information is covered by other information before being searched is reduced, and the completeness and accuracy of the fault tracking information are improved.
[0067] According to the embodiment of the present application, the history target symbol table is obtained by: determining, according to the thread identification information of the abnormal thread, the task identification information corresponding to other processes running the abnormal thread from a first mapping table, wherein the first mapping table records the task identification information executed in the running process of the abnormal thread; determining, according to the task identification information, the first program from the plurality of programs; and accessing the symbol table storage space according to the program identification information of the first program, and determining the history target symbol table corresponding to the first program.
[0068] According to the embodiment of the present application, the plurality of memory spaces corresponding to the plurality of processes are stored in the shared memory, so that the time for searching the history stack information in other related processes is shortened, the risk that the history stack information is covered by other information before being searched is reduced, and the completeness and accuracy of the fault tracking information are improved.
[0069] According to the embodiment of the present application, the thread is used as a task execution carrier and can be used to execute different tasks, and there is a fixed mapping relationship between the tasks and the programs, and the same program can be used to execute one or more tasks. According to the task identification information, the first program corresponding to the task identification information is determined from the plurality of programs, wherein there can be a plurality of first programs corresponding to the task identification information. According to the program identification information of the first program, the symbol table space for storing the symbol table is accessed, and the history target symbol table corresponding to the first program is determined. There is no direct corresponding relationship between the processes and the tasks and between the processes and the programs.
[0070] According to the embodiment of the present application, the first mapping table recording the mapping relationship between the thread identification information and the task identification information of the abnormal thread in the thread execution process is used to determine the task identification information corresponding to the thread identification information of the abnormal thread. According to the program called in the task execution process, the program identification information corresponding to the task identification information is determined, and the plurality of history target symbol tables are determined according to the program identification information, so as to determine the plurality of second function names according to the plurality of history target symbol tables, supplement the function calling process before the abnormal thread migration, and improve the accuracy of the fault tracking information.
[0071] According to an embodiment of the present invention, based on the target symbol table and pointer information, multiple first function names corresponding one-to-one to multiple function code segment addresses included in the current stack information of the exception thread are determined, including: backtracing in the current stack information of the exception thread according to the pointer information to determine the multiple function code segment addresses; and determining multiple first function names corresponding one-to-one to the function code segment addresses in multiple symbol tables according to the multiple function code segment addresses.
[0072] According to an embodiment of the present invention, a match is performed in a target symbol table based on pointer information to determine a first function name corresponding to the function code segment address where an exception occurs. A stack pointer of current stack information points to a stack top address of a stack for storing current stack information, and based on the stack pointer of current stack information, current stack information is backtraced to determine multiple function code segment addresses.
[0073] According to an embodiment of the present invention, based on the stack pointer of the current stack information, the current stack information is traced back frame by frame, the execution order of multiple function code segments can be determined, and a function code segment address sequence can be obtained, so that multiple symbol tables are traversed in the storage space used to store symbol tables according to the function code segment address sequence to determine multiple first function names corresponding to the multiple function code segment addresses, and the execution order of the multiple first function names.
[0074] According to an embodiment of the present invention, the first function name corresponding to the address of the running function code segment is determined based on pointer information, backtracing is performed in the current stack information, multiple function code segment addresses are determined, and multiple first function names corresponding one-to-one to the multiple function code segment addresses are determined in multiple symbol tables. The execution process of the abnormal thread is accurately traced to the function call level to improve the accuracy of fault tracing information.
[0075] According to an embodiment of the present invention, backtracing is performed in the current stack information of the exception thread to determine multiple function code segment addresses, including: determining whether the function code segment represented by the current backtraced function code segment address is a top-level function code segment; if the function code segment represented by the current backtraced function code segment address is not a top-level function code segment, continuing backtracing; if the function code segment represented by the current backtraced function code segment address is a top-level function code segment, stopping backtracing to obtain multiple function code segment addresses.
[0076] According to an embodiment of the present invention, the top-level function code segment represents the function code segment that is called first in the current stack information. Determining whether the function code segment represented by the address of the currently backtraced function code segment is the top-level function code segment is performed by continuously searching toward the bottom of the current stack storing the current stack information using a stack pointer to determine multiple function code segment addresses.
[0077] According to the embodiment of the present application, the call hierarchy relationship between functions is clearly presented by continuously backtracking from the current function code segment where the exception occurs to the top function code segment, which helps to more accurately restore the execution process of the exception thread, provides more logical context information for fault analysis, and thus improves the accuracy of fault tracking information.
[0078] Figure 4 A flowchart of a fault tracking method of a database exception thread according to another embodiment of the present application is shown.
[0079] As shown in Figure 4 In response to receiving an exception prompt signal 401 for characterizing that the current execution thread runs abnormally, the stack Stack 410 storing the current stack information is backtracked from the function code segment address indicated by the pointer information, and a plurality of function code segment addresses are determined.
[0080] According to the thread identification information 402 of the exception thread, at least one task identification information corresponding to a plurality of processes running the exception thread is determined from the first mapping table 403, wherein the first mapping table 403 records the task identification information executed by the exception thread during the running process, and the first mapping table 403 includes the corresponding relationship between the processes 1~process n and the task identification information 1~task identification information n, wherein n is an integer greater than 1. The process executing the exception thread can be determined according to the thread identification of the exception thread. It is assumed that the processes executing the exception thread include process 2, process 3 and process 5. According to the thread identification information 402 of the exception thread, the task identification information set 404 is determined from the first mapping table 403, wherein the task identification information set 404 includes the task identification information 2 corresponding to the process 2, the task identification information 3 corresponding to the process 3, and the task identification information 5 corresponding to the process 5.
[0081] According to the task identification information set 404, the target program identification information set 406 corresponding to the task identification information 2, the task identification information 3 and the task identification information 5 is determined from the program identification information set 405, wherein the program identification information set 405 includes at least the program identification information of the first program and the program identification information of the second program. Here, the number of individuals in the plurality of program identification information sets 405 is only illustrative. There can be multiple first programs and second programs corresponding to the task identification information 2, the task identification information 3 and the task identification information 5, i.e., there can be multiple program identification information of the first program and the program identification information of the second program corresponding to the task identification information 2, the task identification information 3 and the task identification information 5.
[0082] According to the target program identification information set 406, a target symbol table set 408 corresponding to the abnormal thread is determined from a plurality of symbol tables in the access symbol table storage space 407, wherein the target program identification information set 406 includes program identification information of the first program and program identification information of the second program. The plurality of symbol tables include symbol table 1, symbol table 2, symbol table 3 and symbol table 4; the target symbol table set 408 includes symbol table 1, symbol table 2 and symbol table 4, and the target symbol table set 408 includes a target symbol table and a historical target symbol table.
[0083] Based on the symbol table 1, the symbol table 2 and the symbol table 4, each function code segment address is matched in turn to determine a plurality of first function names 409 corresponding to the plurality of function code segment addresses in the symbol table 1, or the symbol table 2, or the symbol table 4. Each function code segment address corresponds to a first function name.
[0084] According to the thread identification information 402 of the abnormal thread, the historical stack information of the abnormal thread running on other processes that matches the thread identification information 402 of the abnormal thread is determined from the shared memory memory 440, wherein the historical stack information is saved in the stack Stack 420 and the stack Stack 430, and the abnormal thread corresponds to a stack in each process.
[0085] The stack Stack 420 is traversed based on the stack pointer of the stack Stack 420 to backtrack the historical function code segment address stored in the stack Stack 420, and the stack Stack 430 is traversed based on the stack pointer of the stack Stack 430 to backtrack the historical function code segment address stored in the stack Stack 430 to determine a plurality of historical function code segment addresses.
[0086] In the symbol table 1, or the symbol table 2, or the symbol table 4, each historical function code segment address is matched in turn to determine a plurality of second function names 410 corresponding to the plurality of historical function code segment addresses. Each historical function code segment address corresponds to a second function name.
[0087] Based on the plurality of function code segment addresses, the plurality of historical function code segment addresses, the plurality of first function names 409 and the plurality of second function names 410, a fault tracking information set 411 is determined.
[0088] According to the embodiment of the application, by determining a plurality of function code segment addresses from the current stack information of the abnormal thread, determining a plurality of historical function code segment addresses from the historical stack information, and matching in combination with a plurality of symbol tables, the function name corresponding to the function code segment address can be more accurately obtained, so that the execution process of the abnormal thread is more comprehensively and accurately restored through the fault tracking information set, and a more reliable basis is provided for fault analysis.
[0089] According to an embodiment of the present application, the fault tracking information set is determined based on the plurality of function code segment addresses, the plurality of historical function code segment addresses, the plurality of first function names and the plurality of second function names, comprising: determining the function execution order of the plurality of function code segment addresses and the plurality of historical function code segment addresses based on the current stack information of the abnormal thread and the historical stack information of the abnormal thread; and sorting the plurality of first function names and the plurality of second function names based on the function execution order to obtain the fault tracking information set.
[0090] According to an embodiment of the present application, the function execution order of the plurality of first function names and the plurality of second function names corresponding to the plurality of function code segment addresses is determined based on the current stack information and the historical stack information of the abnormal thread. The function execution order here reflects the actual order of calling and executing each function code segment at the time of the exception. The plurality of first function names and the plurality of second function names are sorted according to the determined function execution order. After the above sorting operation, a set containing the ordered function code segment addresses, first function names and second function names is finally obtained, i.e. the fault tracking information set.
[0091] According to an embodiment of the present application, by explicitly determining the function execution order, the key function or code segment causing the fault can be more accurately located, and subsequent fault diagnosis can be performed, for example, the function execution order can be matched with the event time stamp recorded in the system log to further determine the state and behavior of the system at the time of each function execution, thereby more comprehensively diagnosing the fault.
[0092] Figure 5 A schematic diagram of a fault tracking information set according to an embodiment of the present application is shown.
[0093] As shown in Figure 5 The fault tracking information set 500 at least includes code segment addresses and function names, wherein the code segment addresses include a current function code segment address 511, a plurality of function code segment addresses 512 and a plurality of historical function code segment addresses 513; and the function names include a plurality of first function names 521 and a plurality of second function names 522.
[0094] The function names can be matched in the extent to determine the annotation information 531 of each of the plurality of first function names 521 and the annotation information 532 of each of the plurality of second function names 522.
[0095] According to an embodiment of the present application, the annotation information is obtained by matching with the function names to provide the purpose, function and implementation logic of the functions for the plurality of first function names and the plurality of second function names, thereby improving the accuracy of the fault tracking information set.
[0096] Based on the database abnormal thread fault tracking method, the application further provides a database abnormal thread fault tracking device. Figure 6 The device is described in detail.
[0097] Figure 6 The structure block diagram of the database abnormal thread fault tracking device according to the embodiment of the application is shown.
[0098] As Figure 6 shown, the database abnormal thread fault tracking device 600 of the embodiment includes a pointer determining module 610, a first determining module 620, a function determining module 630, an information determining module 640, a second determining module 650 and an information set determining module 660.
[0099] The pointer determining module 610 is configured to, in response to receiving an abnormal prompt signal for representing that the current execution thread runs abnormally, determine pointer information for indicating the address of the current function code segment being run from the current stack information of the abnormal thread, taking the current execution thread as the abnormal thread. In an embodiment, the pointer determining module 610 can be configured to perform the operation S210 described above, and details are not repeated here.
[0100] The first determining module 620 is configured to determine a target symbol table matching the thread identification information of the abnormal thread from a plurality of symbol tables according to the thread identification information of the abnormal thread; the symbol table includes the mapping relationship between the function name and the function code segment address. In an embodiment, the first determining module 620 can be configured to perform the operation S220 described above, and details are not repeated here.
[0101] The function determining module 630 is configured to determine a plurality of first function names corresponding to a plurality of function code segment addresses included in the current stack information of the abnormal thread based on the target symbol table and the pointer information. In an embodiment, the function determining module 630 can be configured to perform the operation S230 described above, and details are not repeated here.
[0102] The information determining module 640 is configured to determine the historical stack information of the abnormal thread running on other processes from a plurality of memory spaces corresponding to a plurality of processes according to the thread identification information of the abnormal thread; the historical stack information includes a plurality of historical function code segment addresses, the first program to which the plurality of historical function code segment addresses belong is different from the second program to which the plurality of function code segment addresses belong, and each program corresponds to at least one symbol table. In an embodiment, the information determining module 640 can be configured to perform the operation S240 described above, and details are not repeated here.
[0103] The second determining module 650 is configured to determine a plurality of second function names corresponding to the plurality of historical function code segment addresses according to the historical object symbol table corresponding to the programs to which the plurality of historical function code segment addresses belong.
[0104] The information set determining module 660 is configured to determine a fault tracking information set based on the plurality of function code segment addresses, the plurality of historical function code segment addresses, the plurality of first function names and the plurality of second function names.
[0105] According to an embodiment of the present application, the historical object symbol table is obtained by: determining task identification information corresponding to other processes running the abnormal thread according to thread identification information of the abnormal thread from a first mapping table, wherein the first mapping table records task identification information executed by the abnormal thread during running; determining the first program from a plurality of programs according to the task identification information; and accessing a symbol table storage space according to program identification information of the first program to determine the historical object symbol table corresponding to the first program.
[0106] According to an embodiment of the present application, the function determining module 630 comprises an address determining unit and a function name determining unit.
[0107] The address determining unit is configured to backtrack in current stack information of the abnormal thread according to the pointer information to determine the plurality of function code segment addresses.
[0108] The function name determining unit is configured to determine the plurality of first function names in the plurality of symbol tables according to the plurality of function code segment addresses.
[0109] According to an embodiment of the present application, the address determining unit comprises a determining subunit, a backtracking subunit and an address determining subunit.
[0110] The determining subunit is configured to determine whether a function code segment represented by a currently backtracked function code segment address is a top-level function code segment.
[0111] The backtracking subunit is configured to continue backtracking in a case where the function code segment represented by the currently backtracked function code segment address is not the top-level function code segment.
[0112] The address determining subunit is configured to stop backtracking and obtain the plurality of function code segment addresses in a case where the function code segment represented by the currently backtracked function code segment address is the top-level function code segment.
[0113] According to an embodiment of the present application, the information set determining module 660 comprises a sequence determining unit and an information set determining unit.
[0114] The sequence determining unit is configured to determine the function execution sequence of the plurality of function code segment addresses and the plurality of historical function code segment addresses based on the current stack information of the abnormal thread and the historical stack information of the abnormal thread.
[0115] The information set determining unit is configured to sort the plurality of first function names and the plurality of second function names based on the function execution sequence to obtain the fault tracking information set.
[0116] According to the embodiment of the present application, the plurality of memory spaces corresponding to the plurality of processes are located in the shared memory.
[0117] The information determining module comprises: determining the historical stack information of the abnormal thread in the shared memory according to the thread identification information of the abnormal thread.
[0118] According to the embodiment of the present application, the fault tracking device 600 of the database abnormal thread further comprises: a function obtaining module and a decryption module.
[0119] The function obtaining module is configured to obtain a callback function corresponding to an abnormal signal triggered by an abnormal thread in response to the abnormal signal.
[0120] The decryption module is configured to decrypt the encrypted symbol table set in the memory by using the callback function to obtain a plurality of symbol tables.
[0121] According to an embodiment of the present application, any of the pointer determining module 610, the first determining module 620, the function determining module 630, the information determining module 640, the second determining module 650 and the information set determining module 660 can be combined in one module, or any of them can be split into multiple modules. Alternatively, at least part of the function of one or more of these modules can be combined with at least part of the function of other modules, and implemented in one module. According to an embodiment of the present application, at least one of the pointer determining module 610, the first determining module 620, the function determining module 630, the information determining module 640, the second determining module 650 and the information set determining module 660 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on board, a system on package, an application specific integrated circuit (ASIC), or any other reasonable way of integrating or packaging a circuit, etc. or implemented by hardware or firmware, or implemented in any one of software, hardware and firmware or in a proper combination of any of them. Alternatively, at least one of the pointer determining module 610, the first determining module 620, the function determining module 630, the information determining module 640, the second determining module 650 and the information set determining module 660 can be at least partially implemented as a computer program module which can perform the corresponding function when it is run.
[0122] Figure 7 A block diagram of an electronic device suitable for implementing the fault tracing method of database exception threads according to an embodiment of the present application is shown.
[0123] As shown in Figure 7 The electronic device 700 according to an embodiment of the present application includes a processor 701 which can perform various appropriate actions and processes according to programs stored in a read only memory (ROM) 702 or loaded from a storage portion 708 into a random access memory (RAM) 703. The processor 701 can include, for example, a general purpose microprocessor (e.g. a CPU), an instruction set processor and / or a related chipset and / or a special purpose microprocessor (e.g. an application specific integrated circuit (ASIC)), etc. The processor 701 can also include an on-board memory for cache use. The processor 701 can include a single processing unit or multiple processing units for performing different actions of the method processes according to embodiments of the present application.
[0124] In the RAM 703, various programs and data required for the operation of the electronic device 700 are stored. The processor 701, the ROM 702, and the RAM 703 are connected to each other via the bus 704. The processor 701 performs various operations of the method flow according to the embodiments of the present application by executing the programs in the ROM 702 and / or the RAM 703. It should be noted that the programs can also be stored in one or more memories other than the ROM 702 and the RAM 703. The processor 701 can also perform various operations of the method flow according to the embodiments of the present application by executing the programs stored in the one or more memories.
[0125] According to the embodiments of the present application, the electronic device 700 can further include an input / output (I / O) interface 705, which is also connected to the bus 704. The electronic device 700 can further include one or more of the following components connected to the input / output (I / O) interface 705: an input part 706 including a keyboard, a mouse, etc.; an output part 707 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage part 708 including a hard disk, etc.; and a communication part 709 including a network interface card such as a LAN card, a modem, etc. The communication part 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the input / output (I / O) interface 705 as necessary. A removable recording medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 710 as necessary, so that a computer program read out therefrom is installed in the storage part 708 as necessary.
[0126] The present application also provides a computer readable storage medium, which can be included in the device / apparatus / system described in the above embodiments; or can exist separately without being assembled into the device / apparatus / system. The above computer readable storage medium carries one or more programs, when the one or more programs are executed, the method according to the embodiments of the present application is implemented.
[0127] According to an embodiment of the present application, the computer readable storage medium can be a non-transitory computer readable storage medium, for example, can include but not limited to: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, the computer readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present application, the computer readable storage medium can include one or more memories of the ROM 702 and / or the RAM 703 described above and / or one or more memories other than the ROM 702 and the RAM 703.
[0128] Embodiments of the present application also include a computer program product, which includes a computer program containing program codes for executing the method shown in the flow chart. When the computer program product is run in a computer system, the program codes are used to make the computer system implement the database exception thread fault tracking method provided by the embodiments of the present application.
[0129] The above functions defined in the system / device of the embodiments of the present application are performed when the computer program is executed by the processor 701. According to an embodiment of the present application, the system, device, module, unit, etc. described above can be implemented by computer program modules.
[0130] In one embodiment, the computer program can rely on tangible storage media such as optical storage media, magnetic storage media, etc. In another embodiment, the computer program can also be transmitted, distributed, downloaded and installed in the form of signals on a network medium, and be downloaded and installed through the communication part 709 and / or installed from the detachable medium 711. The program codes contained in the computer program can be transmitted by any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
[0131] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709 and / or installed from the detachable medium 711. When the computer program is executed by the processor 701, the above functions defined in the system of the embodiments of the present application are performed. According to an embodiment of the present application, the system, device, apparatus, module, unit, etc. described above can be implemented by computer program modules.
[0132] According to embodiments of the present application, program code for implementing the computer programs provided by embodiments of the present application can be written in any combination of one or more programming languages, and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. The programming language can include, but is not limited to, Java, C++, python, "C" language, or similar programming languages. The program code can execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the remote computing device, or entirely on the remote computing device or server. In the latter scenario, the remote computing device can be connected to the user's computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computing device, such as through the Internet using an Internet Service Provider.
[0133] The computer program instructions can also be loaded onto a computer or other programmable information processing apparatus to cause a series of operations to be performed on the computer or other programmable information processing apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable information processing apparatus implement the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0134] Those skilled in the art will appreciate that the features recited in the various embodiments of the present application can be combined and / or integrated in a variety of ways, even if such combinations or integrations are not expressly noted in the present application. In particular, the features recited in the various embodiments of the present application can be combined and / or integrated in a variety of ways without departing from the spirit and scope of the present application. All such combinations and / or integrations are within the scope of the present application.
[0135] The embodiments of the present application have been described above. However, these embodiments are merely for the purpose of illustration and are not intended to limit the scope of the present application. Although the embodiments are described separately above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Those skilled in the art can make various substitutions and modifications without departing from the scope of the present application, and these substitutions and modifications should fall within the scope of the present application.
Claims
1. A method for tracing a database abnormal thread fault, characterized in that: The method comprises: In response to receiving an abnormal prompt signal indicating that a currently executing thread is running abnormally, the currently executing thread is treated as an abnormal thread, and pointer information indicating an address of a running function code segment is determined from current stack information of the abnormal thread; According to the thread identification information of the abnormal thread, a target symbol table matching the thread identification information of the abnormal thread is determined from a plurality of symbol tables; the symbol table includes a mapping relationship between a function name and a function code segment address; Determine, based on the target symbol table and the pointer information, a plurality of first function names corresponding one-to-one to a plurality of function code segment addresses included in the current stack information; determining, based on the thread identification information of the abnormal thread, historical stack information of the abnormal thread running on other processes that matches the thread identification information of the abnormal thread from a plurality of memory spaces corresponding one-to-one to a plurality of processes; the historical stack information includes a plurality of historical function code segment addresses, a first program to which the plurality of historical function code segment addresses belong has different functions from a second program to which the plurality of historical function code segment addresses belong, and each program corresponds to at least one symbol table; Determining a plurality of second function names corresponding one-to-one to the plurality of historical function code segment addresses according to a historical target symbol table that matches the program to which the plurality of historical function code segment addresses belong; A fault tracing information set is determined based on the plurality of function code segment addresses, the plurality of historical function code segment addresses, the plurality of first function names, and the plurality of second function names.
2. The fault tracing method according to claim 1, characterized in that: The historical target symbol table is obtained by the following operations: According to the thread identification information of the abnormal thread, determining the task identification information corresponding to other processes that have run the abnormal thread from a first mapping table; wherein the first mapping table records the task identification information executed during the running process of the abnormal thread; determining the first program from a plurality of programs according to the task identification information; According to the program identification information of each of the first programs, a symbol table storage space is accessed to determine the historical target symbol table corresponding to the first program.
3. The fault tracing method according to claim 1, characterized in that: The step of determining, based on the target symbol table and the pointer information, a plurality of first function names corresponding one-to-one to a plurality of function code segment addresses included in the current stack information comprises: Backtracking in the current stack information of the abnormal thread according to the pointer information to determine the addresses of the multiple function code segments; The multiple first function names corresponding to the multiple function code segment addresses are determined in the multiple symbol tables according to the multiple function code segment addresses.
4. The fault tracing method according to claim 3, characterized in that: The step of backtracking in the current stack information of the abnormal thread according to the pointer information to determine the addresses of the multiple function code segments includes: Determine whether the function code segment represented by the address of the currently backtraced function code segment is a top-level function code segment; When the function code segment represented by the address of the currently backtraced function code segment is not the top-level function code segment, continue backtracing; When the function code segment represented by the address of the currently backtraced function code segment is the top-level function code segment, backtracing is stopped to obtain the multiple function code segment addresses.
5. The fault tracing method according to claim 1, characterized in that: The determining of the fault tracing information set based on the multiple function code segment addresses, the multiple historical function code segment addresses, the multiple first function names, and the multiple second function names includes: Determining a function execution order of the multiple function code segment addresses and the multiple historical function code segment addresses based on the current stack information of the abnormal thread and the historical stack information of the abnormal thread; The multiple first function names and the multiple second function names are sorted based on the function execution order to obtain the fault tracing information set.
6. The fault tracing method according to claim 1, characterized in that: The multiple memory spaces corresponding to the multiple processes are located in the shared memory; The determining, based on the thread identification information of the abnormal thread, from a plurality of memory spaces corresponding one-to-one to a plurality of processes, history stack information of the abnormal thread running on other processes that matches the thread identification information of the abnormal thread includes: The historical stack information of the abnormal thread is determined in the shared memory according to the thread identification information of the abnormal thread.
7. The fault tracing method according to claim 1, characterized in that: The method further comprises: In response to an abnormal signal triggered by an abnormal thread, obtaining a callback function corresponding to the abnormal signal; The callback function is used to decrypt the encrypted symbol table set in the memory to obtain a plurality of the symbol tables.
8. A fault tracing device for abnormal database threads, characterized in that: The device comprises: a pointer determination module for, in response to receiving an abnormal prompt signal indicating that a currently executing thread is operating abnormally, treating the currently executing thread as an abnormal thread and determining pointer information indicating an address of a running function code segment from current stack information of the abnormal thread; A first determining module is configured to determine, from a plurality of symbol tables, a target symbol table that matches the thread identification information of the abnormal thread according to the thread identification information of the abnormal thread; the symbol table includes a mapping relationship between a function name and a function code segment address; a function determination module, configured to determine, based on the target symbol table and the pointer information, a plurality of first function names corresponding one-to-one to a plurality of function code segment addresses included in the current stack information; an information determination module, configured to determine, based on the thread identification information of the abnormal thread, historical stack information of the abnormal thread running on other processes that matches the thread identification information of the abnormal thread from a plurality of memory spaces corresponding one-to-one to a plurality of processes; the historical stack information comprising a plurality of historical function code segment addresses, a first program to which the plurality of historical function code segment addresses belong and a second program to which the plurality of function code segment addresses belong have different functions, and each program corresponds to at least one symbol table; A second determining module is configured to determine a plurality of second function names corresponding one-to-one to the plurality of historical function code segment addresses based on a historical target symbol table that matches the program to which the plurality of historical function code segment addresses belong; The information set determining module is configured to determine a fault tracing information set based on the multiple function code segment addresses, the multiple historical function code segment addresses, the multiple first function names, and the multiple second function names.
9. An electronic device comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Embedded system progress abnormal tracking position-finding method
CN101211309A
Function call stack backtracking method and device, program exception processing method and device, equipment and medium
CN113342431A
Method for collecting abnormal information of application program and related equipment
CN118152171A
Process exception processing method and device, electronic equipment and storage medium
CN119690609A
Method for acquiring function call information, and apparatus, electronic device and medium
WO2023016485A1