A method, device, equipment and medium for reproducing a program crash event
The method addresses the challenge of sporadic and hard-to-reproduce application crashes in vehicle systems by generating and analyzing crash stack and attribute files, enhancing system stability and safety.
Patent Information
- Application Number
- CN202210752772.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-29
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2042-06-29
AI Technical Summary
In vehicle systems, application crashes due to errors or exceptions are often sporadic and difficult to reproduce manually, limiting the ability to pinpoint the exact execution scenario, which compromises vehicle safety.
A method to capture and reconstruct application crashes by generating crash stack and attribute files from environment variables, program properties, and database queries, enabling detailed analysis and reproduction of crash scenarios.
Enhances the stability and safety of vehicle systems by providing a systematic approach to reproduce and analyze crash scenarios, improving the reliability of vehicle operations.
Smart Images

Figure CN115016973B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and particularly to a method, device, equipment and medium for reproducing program crash events. Background Art
[0002] With the continuous development of modern technology, intelligent driving technology has become increasingly mature. As the main direction of the development of intelligentization and Internet of Things in the current global automotive and transportation fields, intelligent driving has important value in future transportation.
[0003] Intelligent driving relies on the collaborative cooperation of artificial intelligence, visual computing, radar, monitoring devices and global positioning systems, and realizes the automatic operation of the vehicle operating system through a large amount of data processing and calculation.
[0004] During the operation of the vehicle system, the application program may encounter certain errors or exceptions, resulting in the program crashing and exiting. At the same time, many scenarios of program crashes are sporadic and not easily reproducible manually. Moreover, relying solely on logs to analyze problems makes it difficult to locate the position where the program goes wrong, and it is impossible to delve into the specific execution situation of the program, thus leading to a reduction in driving safety. Summary of the Invention
[0005] The present invention provides a method, device, equipment and medium for reproducing program crash events, which solves the technical problem that during the operation of the vehicle system, the application program may encounter certain errors or exceptions, resulting in the program crashing and exiting. At the same time, many scenarios of program crashes are sporadic and not easily reproducible manually. Moreover, relying solely on logs to analyze problems makes it difficult to locate the position where the program goes wrong, and it is impossible to delve into the specific execution situation of the program, thus leading to a reduction in driving safety.
[0006] A method for reproducing program crash events provided by the present invention includes:
[0007] When a crashed program is detected, read the program attribute information from the environment variables corresponding to the crashed program, and obtain the program stack information corresponding to the crashed program;
[0008] Generate a crash stack file using the program stack information and the program attribute information;
[0009] In response to the received program identification information, retrieve the program database associated with the crashed program and perform format conversion to generate multiple crash attribute files;
[0010] When an input crash reproduction request is received, construct a crash event corresponding to the crashed program using the crash stack file and the crash attribute files.
[0011] Optionally, the program attribute information includes the attribution vehicle identifier and the crash timestamp; the step of generating a crash stack file by using the program stack information and the program attribute information includes:
[0012] Create an initial stack file by using the vehicle identifier and the crash timestamp as the file name;
[0013] Load the program stack information into the initial stack file to generate a crash stack file.
[0014] Optionally, the program identification information includes a process identifier and a thread identifier, the program database includes a running database and an attribute database, and the crash attribute file includes a crash sub-attribute file and a crash running status file; the step of retrieving the program database associated with the crashed program in response to the received program identification information and performing format conversion to generate multiple crash attribute files includes:
[0015] In response to the received process identifier and thread identifier, use the process identifier and the thread identifier as search terms to retrieve the attribute database associated with the crashed program, and determine the corresponding crash attribute information;
[0016] Convert the process identifier, the thread identifier, and the crash attribute information into a key-value pair format to generate a crash sub-attribute file;
[0017] Use the process identifier to retrieve the running database associated with the crashed program, and determine the corresponding running information;
[0018] Convert the running information into a text format to generate a crash running status file.
[0019] Optionally, the method further includes: writing the crash stack file and the multiple crash attribute files into a preset container shared directory respectively.
[0020] Optionally, the method further includes:
[0021] Real-time statistics of the generation quantity of the crash stack file and the crash attribute files;
[0022] When the generation quantity is less than a preset generation threshold, jump to execute the step of generating a crash stack file by using the program stack information and the program attribute information;
[0023] When the generation quantity is greater than or equal to the generation threshold, write the multiple crash attribute files into the container shared directory respectively.
[0024] Optionally, the method further includes: detecting in real time the remaining space information of the disk to which the container shared directory belongs; the remaining space information includes the remaining space ratio and the remaining space value;
[0025] When the remaining space value is less than a preset value threshold, or the remaining space ratio is less than a preset ratio threshold, stop executing the step of writing the crash stack file and the multiple crash attribute files to a preset container shared directory.
[0026] Optionally, before the step of, when detecting a crashed program, reading program attribute information from the environment variables corresponding to the crashed program and obtaining the program stack information corresponding to the crashed program, the method further includes:
[0027] Responding to a function start instruction input on a preset configuration page, starting an initial crash detection component;
[0028] When a function modification instruction is received on the configuration page, modifying the configuration information in the crash detection component with the function modification instruction to obtain a target crash detection component;
[0029] Copying the detection threads in the target crash detection component to a preset mounted directory to obtain a container shared directory.
[0030] A second aspect of the present invention provides a device for reproducing a program crash event, including:
[0031] An information reading module, configured to, when detecting a crashed program, read program attribute information from the environment variables corresponding to the crashed program and obtain the program stack information corresponding to the crashed program;
[0032] A crash stack file generation module, configured to generate a crash stack file by using the program stack information and the program attribute information;
[0033] A crash attribute file generation module, configured to respond to received program identification information, retrieve a program database associated with the crashed program and perform format conversion to generate multiple crash attribute files;
[0034] A crash event reproduction module, configured to, when receiving an input crash reproduction request, construct a crash event corresponding to the crashed program by using the crash stack file and the crash attribute file.
[0035] A third aspect of the present invention provides an electronic device, including a memory and a processor, where a computer program is stored in the memory, and when the computer program is executed by the processor, the processor is caused to execute the steps of the program crash event reproduction method according to any one of the first aspects of the present invention.
[0036] In a fourth aspect of the present invention, there is provided a computer-readable storage medium having stored thereon a computer program, which when executed implements the program crash event reproduction method according to any one of the first aspects of the present invention.
[0037] As can be seen from the above technical solutions, the present invention has the following advantages:
[0038] When a crashed program is detected, program attribute information is read from the environment variables corresponding to the crashed program, and program stack information corresponding to the crashed program is obtained. A crash stack file is generated using the program stack information and the program attribute information. At the same time, in response to the received program identification information, the program database associated with the crashed program is retrieved and format conversion is performed to generate multiple crash attribute files. When an input crash reproduction request is received, a crash event corresponding to the crashed program is constructed using the crash stack file and the crash attribute files. By effectively collecting the crash stack file and the crash attribute files corresponding to the crashed program, the technical problem of reduced program running stability caused by the occasional occurrence of program crash scenarios during the operation of the vehicle system, which in turn affects the driving safety, is solved. The scenario reproduction of the crashed program is more effectively realized, providing a data basis for improving the subsequent program running stability and driving safety. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0040] Figure 1 It is a flowchart of the steps of a program crash event reproduction method provided in Embodiment 1 of the present invention;
[0041] Figure 2 It is a flowchart of the steps of a program crash event reproduction method provided in Embodiment 2 of the present invention;
[0042] Figure 3 It is a structural block diagram of a program crash event reproduction device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0043] Embodiments of the present invention provide a method, apparatus, device, and medium for reproducing a program crash event, which are used to solve the technical problem that during the operation of a vehicle system, an application program may encounter certain errors or exceptions, resulting in the program crashing and exiting. Moreover, many scenarios of program crashes are sporadic and not easily reproducible by humans. Analyzing problems solely based on logs makes it difficult to locate the position where the program goes wrong and impossible to delve into the specific execution situation of the program, thereby reducing the driving safety.
[0044] To make the objectives, features, and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the embodiments described below are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts belong to the scope of protection of the present invention.
[0045] Please refer to Figure 1 , Figure 1 which is a flowchart of the steps of a method for reproducing a program crash event provided in Embodiment 1 of the present invention.
[0046] A method for reproducing a program crash event provided by the present invention includes the following steps:
[0047] Step 101: When a crashed program is detected, read program attribute information from the environment variables corresponding to the crashed program, and obtain the program stack information corresponding to the crashed program.
[0048] Environment variables refer to some parameters used to specify the operating environment of the operating system. In this embodiment, they refer to the environment parameters required for the system to run the crashed program, such as the function of the crashed program and the complete path where the program is located.
[0049] In the embodiments of the present application, when the Ubuntu system detects a crashed program, it reads program attribute information from the environment variables corresponding to the crashed program and obtains the program stack information corresponding to the crashed program from the standard output of Linux.
[0050] It should be noted that in an intelligent driving vehicle, the program attribute information includes, but is not limited to, the vehicle number to which the crashed program belongs and the crashed program name. The program stack information refers to the memory image, which stores the corresponding information of the memory when the program crashes and is mainly used for debugging the program, such as a corefile file.
[0051] Step 102: Generate a crash stack file using the program stack information and the program attribute information.
[0052] After obtaining the program stack information and program property information, a file can be created and named according to the program property information, and then the program stack information can be written into the created file to generate a crash stack file.
[0053] It should be noted that while generating the crash stack file, it can be written to a preset disk location. For example, in an intelligent driving vehicle, the intelligent driving system usually runs in a docker container, and the saving of the crash stack file corefile belongs to the behavior of the host. Therefore, the shared directory between the host and the container can be mounted at the disk location where the docker container is located to form a container shared directory.
[0054] Step 103: In response to the received program identification information, retrieve the program database associated with the crashed program and perform format conversion to generate multiple crash property files.
[0055] The program identification information refers to the identifier used to identify the process or thread corresponding to the crashed program, such as the process identifier PID and the thread identifier TID, which can be read from the process parameters of the handler program in the Linux system. The handler program is used to process the corefile.
[0056] The crash property file refers to a file that contains some properties of the crashed program and is used to record the crash properties corresponding to the crashed program and the running state when the program crashes. It can include a crash sub-property file and a crash running state file.
[0057] Meanwhile, if the program identification information is received, the program database associated with the crashed program can be retrieved according to the cost identification information to retrieve the corresponding crash properties and other relevant crash information, such as whether to save the corefile, the time spent on fixing the crash, and the running information of the crashed program, etc.
[0058] After retrieving the file corresponding to the crashed program from the program database, since the uses of the files are different, for the convenience of users to view and use the above files, format conversion can be performed separately according to the types of the files to generate multiple crash property files, so as to facilitate writing to the container shared directory where the above crash stack file is located in different formats.
[0059] Step 104: When a received input crash reproduction request is received, construct a crash event corresponding to the crashed program by using the crash stack file and the crash property file.
[0060] In a specific implementation, the above-mentioned crash stack file and crash property file are used to deeply analyze the occasional exceptions that occur in the intelligent driving system for fault location. Therefore, after generating the crash stack file and crash property file, when a crash reproduction request entered by the user is received, the above-mentioned crash stack file and crash property file can be read, reloaded into the Linux system to reproduce the crash process corresponding to the crashed program, and at the same time, a corresponding crash event is constructed for technicians to view, so as to effectively reproduce the occasional exception.
[0061] In the embodiment of the present application, when a crashed program is detected, program property information is read from the environment variables corresponding to the crashed program, and the program stack information corresponding to the crashed program is obtained. A crash stack file is generated using the program stack information and program property information. At the same time, in response to the received program identification information, the program database associated with the crashed program is retrieved and format conversion is performed to generate multiple crash property files. When an input crash reproduction request is received, a crash event corresponding to the crashed program is constructed using the crash stack file and the crash property file. Through the effective collection of the crash stack file and the crash property file corresponding to the crashed program, the technical problem that the program running stability is reduced due to the occasionality of the program crash scenario during the operation of the vehicle system, thereby affecting the driving safety, is solved, and the scenario reproduction of the crashed program is more effectively realized, providing a data basis for the subsequent improvement of the program running stability and driving safety.
[0062] Please refer to Figure 2 , Figure 2 which is a flowchart of the steps of a method for reproducing a program crash event provided in Embodiment 2 of the present invention.
[0063] A method for reproducing a program crash event provided by the present invention includes the following steps:
[0064] Step 201, when a crashed program is detected, read program property information from the environment variables corresponding to the crashed program, and obtain the program stack information corresponding to the crashed program;
[0065] In the embodiment of the present application, the specific implementation process of step 201 is similar to that of step 101 and will not be elaborated here.
[0066] Optionally, before executing step 201, the method may further include the following steps S11 - S13:
[0067] S11, in response to a function start instruction input on a preset configuration page, start an initial crash detection component;
[0068] S12. When a function modification instruction is received on the configuration page, use the function modification instruction to modify the configuration information in the crash detection component to obtain a target crash detection component;
[0069] S13. Copy the detection thread in the target crash detection component to a preset mount directory to obtain a container shared directory.
[0070] In the embodiment of the present application, taking the intelligent driving system as an example, before detecting the crashing program, it is necessary to first configure the intelligent driving system. By responding to the function start instruction input on the configuration page, the initial crash detection component is started. At the same time, a corresponding function modification instruction is input on the configuration page, and the configuration information in the crash detection component is functionally modified through this function modification instruction to obtain a target crash detection component. At the same time, the detection thread in the target crash detection component can be copied to a preset mount directory to obtain a container shared directory, so as to facilitate the detection thread to cache the crash stack file and the crash property file in time when detecting a crashing program.
[0071] In a specific implementation, taking the intelligent driving system using the linux system as an example, its intelligent driving system runs in a docker container. At this time, the above function start instruction can be ulimit -S -c unlimited. The initial crash detection component of the host, such as the coredump function component, is started through the above function start instruction. At the same time, if a function modification instruction is received on the configuration page, such as echo -n ${desired_core_pattern}|sudo tee / proc / sys / kernel / core_pattern> / dev / null. At this time, the corepattern in the coredump function component can be modified through the above function modification instruction. Thus, the absolute path of the handler is written to the position of the program that undertakes the corefile, and according to the Linux documentation, the attributes related to the crashing application that need to be selected are used as the input parameters of the handler. At this point, the binary content of the corefile and information about several crashing programs, such as the pid process identifier, the tid thread identifier, and the crash signal, can be received from the standard input in the handler.
[0072] In another example of the present application, for the intelligent driving system using the linux system, the configuration process can also be implemented by the following code method:
[0073] 1. Obtain and check the core pattern of the current host
[0074] 2. Compare the current pattern with the desired value, and continue the operation if they are different
[0075] 3. Create a storage directory for the hander directory and coredump-related files
[0076] 4. Copy the hander file from the vehicle software to the handler directory
[0077] 5. Enable the coredump function: ulimit -S -c unlimited
[0078] 6. Modify core_pattern with the following code:
[0079] echo -n ${desired_core_pattern} | sudo tee / proc / sys / kernel / core_pattern > / dev / null
[0080] 7. Modify the core limit
[0081] Step 202: Generate a crash stack file using the program stack information and program attribute information;
[0082] Optionally, the program attribute information includes the affiliated vehicle identifier and the crash timestamp. Step 202 may include the following sub-steps:
[0083] Create an initial stack file using the vehicle identifier and the crash timestamp as the file name;
[0084] Load the program stack information into the initial stack file to generate a crash stack file.
[0085] The crash timestamp refers to the data recording the time when the crashed program was detected.
[0086] The affiliated vehicle identifier refers to the identifier corresponding to the vehicle to which the crashed program belongs, such as the vehicle number and license plate number.
[0087] In the embodiments of the present application, the program attribute information includes the affiliated vehicle identifier and the crash timestamp. After obtaining the program stack information and program attribute information, the vehicle identifier and the crash timestamp can be used as the file name to create an initial stack file, and further load the program stack information into the initial stack file to generate a crash stack file.
[0088] In a specific implementation, the name of the created crash stack file can be "vehicle number.timestamp.core.file". At the same time, the crash stack file can also be written to the above container shared directory through the direct IO method.
[0089] Optionally, the program identification information includes a process identifier and a thread identifier, the program database includes a running database and an attribute database, and the crash attribute file includes a crash sub-attribute file and a crash running status file;
[0090] Step 203, in response to the received process identifier and thread identifier, use the process identifier and thread identifier as search terms to retrieve the attribute database associated with the crashed program, and determine the corresponding crash attribute information;
[0091] When receiving the process identifier and thread identifier, according to the process identifier and thread identifier, they can be used as keywords to retrieve the attribute database associated with the crashed program, so as to determine the situation of the crashed program in this crash, such as whether to save the core file, the time required for crash modification, etc., to determine the corresponding crash attribute information.
[0092] Step 204, convert the process identifier, thread identifier, and crash attribute information into key-value pair format to generate a crash sub-attribute file;
[0093] After retrieving the crash attribute information, for the convenience of subsequent searching and using, the process identifier, thread identifier, and crash attribute information can be converted into key-value pair format, such as json format, so as to generate a crash sub-attribute file.
[0094] It should be noted that the above crash sub-attribute file can be named in the following way: "vehicle number.timestamp.core.metadata", and at the same time write it to the above container shared directory.
[0095] Step 205, use the process identifier to retrieve the running database associated with the crashed program, and determine the corresponding running information;
[0096] At the same time, the process identifier can be used as a search term to retrieve the running database associated with the crashed program, so as to determine various running information of the crashed program from it.
[0097] Step 206, convert the running information into text format to generate a crash running status file.
[0098] After obtaining the running information, for the convenience of subsequent user reading and using, the running information can be converted into text format, so as to generate a crash running status file.
[0099] It should be noted that the naming rule of the crash running status file can be: "vehicle number.timestamp.core.proc". After generating the crash running status file, for the convenience of subsequent extraction and saving system resources, it can be written to the above container shared directory.
[0100] Step 207: When a received input crash reproduction request is received, construct a crash event corresponding to the crashed program by using the crash stack file and the crash property file.
[0101] In the embodiment of the present application, the specific implementation process of the above step 207 is similar to that of step 104, and will not be elaborated here.
[0102] Furthermore, the method may further include the following steps:
[0103] Write the crash stack file and multiple crash property files into a preset container shared directory respectively.
[0104] In an example of the present invention, the method further includes the following steps S21 - S23:
[0105] S21: Statistically count the generation quantity of the crash stack file and the crash property file in real time;
[0106] S22: When the generation quantity is less than a preset generation threshold, jump to execute the step of generating a crash stack file by using program stack information and program property information;
[0107] S23: When the generation quantity is greater than or equal to the generation threshold, write multiple crash property files into the container shared directory respectively.
[0108] Since the computing platform resources equipped in intelligent driving vehicles are limited, it is still necessary to pay attention to system loads such as disk space and read - write efficiency while collecting crash stack files and crash property files.
[0109] In the embodiment of the present application, the generation quantity of the crash stack file and the crash property file can be statistically counted in real time. If the generation quantity is less than the preset generation threshold, it indicates that the load of this disk is still within the writable range at this time. At this time, step 202 can be jumped to execute to continue the generation and writing of the crash stack file and the crash property file. If the generation quantity is greater than or equal to the generation threshold, it indicates that the disk load is too high at this time. To reduce the disk load while ensuring the effectiveness of subsequent analysis, only multiple crash property files can be saved to the container shared directory and the writing of the crash stack file can be stopped.
[0110] In a specific implementation, a check mechanism for the number of historical saves can be added to the handler to limit the number of times each application's corefile is saved according to a preset value. Each property file stores whether to save the current corefile. The number of existing property files in all hosts is counted by reading them before execution. If the number is less than the limited number of times, the corefile is saved; otherwise, only the property information of this coredump is saved. Among them, the corefile contains the memory, register, and call information when the program crashes. The host machine is a computer platform deployed on an autonomous vehicle.
[0111] In another example of the present invention, the method further includes the following steps S31 - S32:
[0112] S31. Real - time detect the remaining space information of the disk to which the container shared directory belongs; the remaining space information includes the remaining space ratio and the remaining space value;
[0113] S32. When the remaining space value is less than a preset value threshold or the remaining space ratio is less than a preset ratio threshold, stop executing the step of writing the crash stack file and multiple crash property files to the preset container shared directory.
[0114] In this embodiment, the remaining space information of the disk to which the container shared directory belongs, such as the remaining space ratio and the remaining space value, can also be detected in real - time. If the remaining space value is less than the preset value threshold or the remaining space ratio is less than the preset ratio threshold, stop writing the crash stack file and multiple crash property files in the container shared directory, so as to ensure the normal operation of the system load.
[0115] If the remaining space value is greater than or equal to the preset value threshold and the remaining space ratio is greater than or equal to the preset ratio threshold, it indicates that the system is not overloaded at this time, and at this time, the crash stack file and the crash property file can continue to be written.
[0116] In the embodiment of the present application, when a crashed program is detected, program attribute information is read from the environment variables corresponding to the crashed program, and program stack information corresponding to the crashed program is obtained. A crash stack file is generated using the program stack information and the program attribute information. Meanwhile, in response to the received program identification information, the program database associated with the crashed program is retrieved and format conversion is performed to generate multiple crash attribute files. When an input crash reproduction request is received, a crash event corresponding to the crashed program is constructed using the crash stack file and the crash attribute files. By effectively collecting the crash stack file and the crash attribute files corresponding to the crashed program, the technical problem of reduced program running stability caused by the occasional occurrence of program crash scenarios during the operation of the vehicle system, which in turn affects driving safety, is solved. The scenario reproduction of the crashed program is more effectively realized, providing a data basis for improving the subsequent program running stability and driving safety.
[0117] Please refer to Figure 3 , Figure 3 which is a structural block diagram of a device for reproducing a program crash event provided in Embodiment 3 of the present invention.
[0118] The embodiment of the present invention provides a device for reproducing a program crash event, including:
[0119] An information reading module 301, configured to read program attribute information from the environment variables corresponding to the crashed program and obtain program stack information corresponding to the crashed program when a crashed program is detected;
[0120] A crash stack file generation module 302, configured to generate a crash stack file using the program stack information and the program attribute information;
[0121] A crash attribute file generation module 303, configured to retrieve the program database associated with the crashed program and perform format conversion in response to the received program identification information to generate multiple crash attribute files;
[0122] A crash event reproduction module 304, configured to construct a crash event corresponding to the crashed program using the crash stack file and the crash attribute files when an input crash reproduction request is received.
[0123] Optionally, the program attribute information includes the affiliated vehicle identification and the crash timestamp; the crash stack file generation module 302 is specifically configured to:
[0124] Create an initial stack file using the vehicle identification and the crash timestamp as the file name;
[0125] Load the program stack information into the initial stack file to generate a crash stack file.
[0126] Optionally, the program identification information includes a process identifier and a thread identifier, the program database includes a running database and an attribute database, and the crash attribute file includes a crash sub-attribute file and a crash running status file; specifically, the crash attribute file generation module 303 is configured to:
[0127] In response to the received process identifier and thread identifier, use the process identifier and thread identifier as search terms to retrieve the attribute database associated with the crashed program, and determine the corresponding crash attribute information;
[0128] Convert the process identifier, thread identifier, and crash attribute information into key-value pair format to generate a crash sub-attribute file;
[0129] Use the process identifier to retrieve the running database associated with the crashed program, and determine the corresponding running information;
[0130] Convert the running information into text format to generate a crash running status file.
[0131] Optionally, the device further includes:
[0132] A file writing module, configured to write the crash stack file and multiple crash attribute files into a preset container shared directory respectively.
[0133] Optionally, the device further includes:
[0134] A generation quantity statistics module, configured to statistically count the generation quantities of the crash stack file and the crash attribute files in real time;
[0135] A jump module, configured to, when the generation quantity is less than a preset generation threshold, jump to execute the step of generating the crash stack file using the program stack information and program attribute information;
[0136] A separate writing module, configured to, when the generation quantity is greater than or equal to the generation threshold, write multiple crash attribute files into the container shared directory respectively.
[0137] Optionally, the device further includes:
[0138] A remaining space information detection module, configured to detect the remaining space information of the disk to which the container shared directory belongs in real time; the remaining space information includes a remaining space ratio and a remaining space value;
[0139] A writing stop module, configured to stop executing the step of writing the crash stack file and multiple crash attribute files into the preset container shared directory when the remaining space value is less than a preset value threshold, or the remaining space ratio is less than a preset ratio threshold.
[0140] Optionally, the device further includes:
[0141] A component startup module, configured to start an initial crash detection component in response to a function startup instruction input on a preset configuration page;
[0142] A configuration modification module, configured to, when receiving a function modification instruction on the configuration page, modify the configuration information in the crash detection component with the function modification instruction to obtain a target crash detection component;
[0143] A thread replication module, configured to replicate the detection threads in the target crash detection component to a preset mounting directory to obtain a container shared directory.
[0144] An embodiment of the present invention provides an electronic device, including a memory and a processor. A computer program is stored in the memory. When the computer program is executed by the processor, the processor is caused to execute the steps of the program crash event reproduction method according to any embodiment of the present invention.
[0145] An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed, it implements the program crash event reproduction method according to any embodiment of the present invention.
[0146] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the foregoing method embodiments, and will not be described herein again.
[0147] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection can be through some interfaces. The indirect coupling or communication connection of the devices or units can be in an electrical, mechanical or other form.
[0148] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place, or can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0149] In addition, in each embodiment of the present invention, each functional unit can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0150] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.
[0151] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of each embodiment of the present invention.
Claims
1. A method for reproducing a program crash event, characterized in that, Including: When detecting that a crashed program appears, read program attribute information from the environment variables corresponding to the crashed program, and obtain the program stack information corresponding to the crashed program; The program stack information is a corefile file recording the memory image; Generate a crash stack file by using the program stack information and the program attribute information; In response to the received program identification information, retrieve the program database associated with the crashed program and perform format conversion to generate multiple crash attribute files; When receiving an input crash reproduction request, construct a crash event corresponding to the crashed program by using the crash stack file and the crash attribute files; The program attribute information includes the affiliated vehicle identification and the crash timestamp; The step of generating a crash stack file by using the program stack information and the program attribute information includes: Create an initial stack file by using the affiliated vehicle identification and the crash timestamp as the file name; Load the program stack information into the initial stack file to generate a crash stack file.
2. The method according to claim 1, wherein The program identification information includes a process identifier and a thread identifier, the program database includes a running database and an attribute database, and the crash attribute files include a crash sub-attribute file and a crash running status file; The step of, in response to the received program identification information, retrieving the program database associated with the crashed program and performing format conversion to generate multiple crash attribute files includes: In response to the received process identifier and thread identifier, use the process identifier and the thread identifier as search terms to retrieve the attribute database associated with the crashed program to determine the corresponding crash attribute information; Convert the process identifier, the thread identifier, and the crash attribute information into a key-value pair format to generate a crash sub-attribute file; Use the process identifier to retrieve the running database associated with the crashed program to determine the corresponding running information; Convert the running information into a text format to generate a crash running status file.
3. The method according to any one of claims 1-2, characterized in that, The method further includes: Write the crash stack file and the multiple crash attribute files into a preset container shared directory respectively.
4. The method according to claim 3, characterized in that, The method further includes: Real-time statistic the generation quantities of the crash stack file and the crash attribute files; When the generation quantity is less than a preset generation threshold, jump to execute the step of generating a crash stack file by using the program stack information and the program attribute information; When the generation quantity is greater than or equal to the generation threshold, write the multiple crash attribute files into the container shared directory respectively.
5. The method according to claim 3, characterized in that, The method further includes: Real-time detect the remaining space information of the disk to which the container shared directory belongs; the remaining space information includes the remaining space ratio and the remaining space value; When the remaining space value is less than a preset value threshold, or the remaining space ratio is less than a preset ratio threshold, stop executing the step of writing the crash stack file and the multiple crash attribute files into a preset container shared directory respectively.
6. The method according to claim 1, wherein Before the step of, when detecting a crashed program, reading program attribute information from the environment variables corresponding to the crashed program and obtaining the program stack information corresponding to the crashed program, the method further includes: Responding to a function start instruction input on a preset configuration page to start an initial crash detection component; When a function modification instruction is received on the configuration page, modifying the configuration information in the crash detection component with the function modification instruction to obtain a target crash detection component; Copying the detection thread in the target crash detection component to a preset mounting directory to obtain a container shared directory.
7. A device for reproducing a program crash event, characterized in that, Including: An information reading module, configured to, when detecting a crashed program, read program attribute information from the environment variables corresponding to the crashed program and obtain the program stack information corresponding to the crashed program; the program stack information is a corefile file recording a memory image; A crash stack file generation module, configured to generate a crash stack file using the program stack information and the program attribute information; A crash attribute file generation module, configured to, in response to received program identification information, retrieve a program database associated with the crashed program and perform format conversion to generate a plurality of crash attribute files; A crash event reproduction module, configured to, when receiving an input crash reproduction request, construct a crash event corresponding to the crashed program using the crash stack file and the crash attribute file; The program attribute information includes a belonging vehicle identification and a crash timestamp; the crash stack file generation module is specifically configured to: Create an initial stack file using the belonging vehicle identification and the crash timestamp as the file name; Load the program stack information into the initial stack file to generate a crash stack file.
8. An electronic device, characterized in that, Including a memory and a processor, where the memory stores a computer program, and when the computer program is executed by the processor, the processor is caused to execute the steps of the program crash event reproduction method according to any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it implements the program crash event reproduction method according to any one of claims 1-6.
Citation Information
Patent Citations
Crashed file storage method and device, and electronic equipment
CN108459921A
Method and device for reproducing faults
CN110941554A