A method, apparatus, storage medium, and electronic device for detecting concurrent defects in a program.
By combining automatic hijacking and lightweight predictive analytics, the problems of false negatives and false positives in concurrent defect detection of Go programs are solved, achieving more efficient defect localization.
Patent Information
- Application Number
- CN202211500228.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-28
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2042-11-28
AI Technical Summary
Existing concurrent defect detection methods for Go programs are prone to false negatives and false negatives, are highly dependent on other methods, and produce poor detection results.
By using automated hijacking tools to obtain synchronous statements and controlling their execution through hijacking functions, combined with lightweight predictive analytics to record and analyze execution trajectories, the location of defects can be determined, avoiding the blind enumeration of synchronous events.
It reduces the reliance on detection, improves detection effectiveness, and can effectively discover concurrency defects in Go programs.
Smart Images

Figure CN115981999B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer application technology, and specifically to a method, apparatus, storage medium, and electronic device for detecting program concurrency defects. Background Technology
[0002] Go is one of the most popular programming languages worldwide. Due to its fast compilation speed, static typing, memory safety, and simple concurrency programming model, it is often used to write high-concurrency programs for cloud service backends. Go provides a variety of concurrency primitives to help developers write concurrent programs more easily; however, if these primitives are used improperly, the program is more prone to concurrency defects. The different timing of lightweight thread interleaving in Go makes these concurrency defects difficult to find. The same program may perform perfectly in the test environment, but expose concurrency defects in the production environment. Among these concurrency defects, blocking defects are the most representative. Because path conditions and the order of event interleaving in Go programs are affected by concurrency, blocking defects are difficult to find in the test environment.
[0003] In existing technologies, the static testing tool GCatch searches for interdependent synchronization events in the scope of each channel and enumerates the combinations of paths where these synchronization events are located, thereby statically constructing possible execution trajectories and finally establishing a constraint model to solve potential blocking defects. The dynamic testing tool GFuzz forces the case order in Go's structures that can communicate with multiple channels to perform fuzz testing on the control flow it affects. At runtime, GFuzz monitors channel references to find whether the program is stuck in a blocking state.
[0004] However, static detection methods require an enumerated state space that is too large. In order to calculate the result within a valid time, GCatch needs to perform a lot of pruning on the program (including data reading and writing, functions, paths, etc.), which can lead to false negatives and false negatives. Dynamic detection methods trigger different paths in the program through different cases, but when detecting concurrent defects, they still rely on the program triggering the defect at the exact moment of runtime, which is highly dependent and results in poor detection results. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a method, apparatus, storage medium and electronic device for detecting concurrent defects in programs, in order to solve the technical problems that the existing defect blocking methods are prone to false negatives and false negatives, and are highly dependent on other methods, resulting in poor detection results.
[0006] The technical solution proposed in this invention is as follows:
[0007] In a first aspect, embodiments of the present invention provide a method for detecting program concurrency defects. This method includes: acquiring synchronization statements in a program to be detected using an automatic hijacking tool; acquiring a hijacking function and using the hijacking function to control the execution of the synchronization statements; when the synchronization statements are executed, determining whether a defect in the program to be detected is exposed; when the defect in the program to be detected is not exposed, recording the execution trajectory of the synchronization statements; and analyzing the execution trajectory using lightweight predictive analytics to determine the location of the defect in the program to be detected.
[0008] In conjunction with the first aspect, in one possible implementation of the first aspect, when the synchronization statement is executed, determining whether a defect in the program to be tested is exposed includes: when the synchronization statement is executed, injecting a delay into the synchronization statement; using a preset online detection mechanism to determine whether an error occurs in the synchronization statement after the delay is injected; and determining whether a defect in the program to be tested is exposed based on the determination result.
[0009] In conjunction with the first aspect, in another possible implementation of the first aspect, lightweight predictive analytics is used to analyze the execution trajectory to determine the location of the defect in the program to be detected, including: when an error occurs in the execution trajectory, determining the location of the defect in the program to be detected based on the location of the error in the execution trajectory.
[0010] In conjunction with the first aspect, in another possible implementation of the first aspect, lightweight predictive analytics is used to analyze the execution trajectory to determine the location of the defect in the program to be detected. This further includes: when no error occurs in the execution trajectory, determining whether the coverage of the synchronization statements in the program to be detected has increased based on the execution result of the synchronization statements; processing the latency injected into the synchronization statements based on the determination result; and determining the location of the defect in the program to be detected based on the processing result.
[0011] In conjunction with the first aspect, in another possible implementation of the first aspect, the delay injected in the synchronization statement is processed according to the judgment result, including: when the coverage increases, the delay is marked to obtain the target delay; the target delay is added to a preset seed queue, and after seed selection, the target delay is mutated.
[0012] In conjunction with the first aspect, in another possible implementation of the first aspect, after the synchronous statement is executed and it is determined whether the defect in the program to be detected is exposed, the method further includes: when the defect in the program to be detected is exposed, capturing the defect using a preset online detection tool.
[0013] Secondly, embodiments of the present invention provide a program concurrency defect detection device, which includes: an acquisition module for acquiring synchronization statements in a program to be detected using an automatic hijacking tool; a control module for acquiring a hijacking function and controlling the execution of the synchronization statements using the hijacking function; a judgment module for determining whether a defect in the program to be detected is exposed when the synchronization statement is executed; a recording module for recording the execution trajectory of the synchronization statement when the defect in the program to be detected is not exposed; and an analysis and determination module for analyzing the execution trajectory using lightweight predictive analytics to determine the location of the defect in the program to be detected.
[0014] In conjunction with the second aspect, in one possible implementation of the second aspect, the first judgment module includes: an injection submodule, used to inject a delay into the synchronization statement when the synchronization statement is executed; a first judgment submodule, used to use a preset online detection mechanism to determine whether an error has occurred in the synchronization statement after the delay is injected; and a first determination submodule, used to determine whether a defect in the program to be detected has been exposed based on the judgment result.
[0015] Thirdly, embodiments of the present invention provide a computer-readable storage medium storing computer instructions for causing the computer to execute the program concurrency defect detection method as described in the first aspect and any one of the embodiments of the present invention.
[0016] Fourthly, embodiments of the present invention provide an electronic device, including: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the program concurrency defect detection method as described in the first aspect and any one of the embodiments of the present invention.
[0017] The technical solution provided by this invention has the following effects:
[0018] The program concurrency defect detection method provided in this invention utilizes an automatic hijacking tool to obtain synchronization statements in the program to be detected; obtains a hijacking function and uses the hijacking function to control the execution of the synchronization statements; when the synchronization statements are executed, it is determined whether a defect in the program to be detected is exposed; if the defect in the program to be detected is not exposed, the execution trajectory of the synchronization statements is recorded; lightweight predictive analytics is used to analyze the execution trajectory to determine the location of the defect in the program to be detected. This invention utilizes lightweight predictive analytics, avoiding the need to establish constraint expressions for solving every synchronization event. Instead, it considers analyzing events more important for detecting blocking defects, calculating potential blocking locations through circular dependency cycles rather than blind enumeration. Therefore, by implementing this invention, dependency is reduced and detection effectiveness is improved. Attached Figure Description
[0019] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0020] Figure 1 This is a flowchart of a program concurrency defect detection method provided by an embodiment of the present invention;
[0021] Figure 2 This is a schematic flowchart of a program concurrency defect detection method provided by an embodiment of the present invention;
[0022] Figure 3 This is a structural block diagram of a concurrent defect detection device according to an embodiment of the present invention;
[0023] Figure 4 This is a schematic diagram of the structure of a computer-readable storage medium provided according to an embodiment of the present invention;
[0024] Figure 5 This is a schematic diagram of the structure of an electronic device provided according to an embodiment of the present invention. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0026] The reason why blocking defects in Go are difficult to find is that both path conditions and the order of event alternation are affected by concurrency, making it easier for potential blocking defects to be hidden during program execution. To address this problem, this invention provides a method for detecting program concurrency defects, such as... Figure 1 As shown, the method includes the following steps:
[0027] Step 101: Use an automatic hijacking tool to obtain the synchronization statements in the program to be tested.
[0028] The automatic hijacking tool can be Rattler, EvilFoca, etc. This embodiment of the invention does not specifically limit it, as long as it meets the hijacking requirements.
[0029] Specifically, the automatic hijacking tool is used to hijack the synchronous statements in the Go program, that is, to transform the original Go program into an instrumented program.
[0030] Step 102: Obtain the hijacking function and use the hijacking function to control the execution of the synchronous statement.
[0031] Specifically, hijacking functions are used to interfere with the execution of synchronized statements and record the program's execution trajectory.
[0032] This involves using instrumentation to record the execution trajectory of synchronized statements and utilizing Go compiler built-in tools for coverage statistics.
[0033] Step 103: When the synchronization statement is executed, determine whether the defects in the program to be detected are exposed.
[0034] Specifically, the instrumented Go program is run multiple times, and it is determined whether any defects in the program are exposed after execution.
[0035] Step 104: When the defects in the program to be tested are not exposed, record the execution trajectory of the synchronization statement.
[0036] Specifically, the execution trajectory may be triggered during the execution of the program under test. Therefore, after determining that the defects in the synchronous statements have not been exposed, it is also necessary to record the execution trajectory generated by the synchronous statements in the program under test during execution.
[0037] Step 105: Analyze the execution trajectory using lightweight predictive analytics to determine the location of the defect in the program to be detected.
[0038] Among them, using offline detectors for lightweight predictive analysis can avoid creating constraint expressions for each synchronization event and solving them. Instead, it can focus on analyzing events that are more important for detecting blocking defects and calculate possible blocking locations by using cyclic dependency loops rather than blindly enumerating.
[0039] Specifically, lightweight predictive analytics can be used to directly identify blocking defects caused by changes in the order of events during the execution of synchronous statements.
[0040] The program concurrency defect detection method provided in this invention utilizes lightweight predictive analysis, avoiding the need to establish and solve constraint expressions for each synchronization event. Instead, it focuses on analyzing events more important for detecting blocking defects, calculating potential blocking locations through cyclic dependency cycles rather than blind enumeration. Therefore, implementing this invention reduces dependencies and improves detection effectiveness.
[0041] As an optional implementation of this invention, step 103 includes: when the synchronization statement is executed, injecting a delay into the synchronization statement; using a preset online detection mechanism to determine whether an error has occurred in the synchronization statement after the delay is injected; and determining whether a defect in the program to be detected has been exposed based on the determination result.
[0042] To explore more paths, time delays are used to modify path conditions caused by shared variables, enabling efficient identification of potential concurrency defects while maintaining good performance, in conjunction with other online detection mechanisms.
[0043] The preset online detection mechanism can be a third-party detection tool, test assertion, etc. This embodiment of the invention does not specifically limit it, as long as it meets the online detection requirements.
[0044] Specifically, a delay is injected into the program after instrumentation, and online detection mechanisms such as third-party testing tools and test assertions are used to observe whether the program has errors. If an error occurs, it indicates that a defect in the synchronization statement has been exposed. A corresponding defect report can also be generated. If no error occurs, it indicates that a defect in the synchronization statement has not been exposed.
[0045] Furthermore, if a defect is exposed in the synchronization statement, it can be directly captured using a preset online detection tool. This preset online detection tool can be one of the third-party detection tools provided above; this embodiment of the invention does not specifically limit its use, as long as it meets the capture requirements.
[0046] As an optional implementation of this invention, step 105 includes: when an error occurs in the execution trajectory, determining the location of the defect in the program to be detected based on the location of the error in the execution trajectory.
[0047] Specifically, after analyzing the execution trajectory through lightweight predictive analytics, an error is found in the execution trajectory, that is, a defect is exposed during the execution process. At this point, the location of the defect in the program to be detected can be determined directly based on the location of the error in the execution trajectory.
[0048] As an optional implementation of this invention, step 105 further includes: when no error occurs in the execution trajectory, determining whether the coverage of the synchronization statement in the program to be tested has improved based on the execution result of the synchronization statement; processing the delay injected in the synchronization statement based on the determination result; and determining the location of the defect in the program to be tested based on the processing result.
[0049] Specifically, after analyzing the execution trajectory through lightweight predictive analytics, it was found that no errors occurred in the execution trajectory, meaning that the defect was not exposed during execution. At this point, the execution result of the synchronous statement is used to determine whether the coverage of synchronous statements in the program to be tested has improved. The execution result of the synchronous statement is the result of observing whether the program after the injection delay has errors using online detection mechanisms such as third-party detection tools and test assertions.
[0050] Specifically, if no error occurs in the program to be tested after the injection delay, check whether the execution of the program to be tested this time improves the coverage of its synchronous statements.
[0051] Furthermore, as the coverage increases, the delay is marked to obtain the target delay; the target delay is added to a preset seed queue, and after seed selection, the target delay is mutated.
[0052] Specifically, if the program coverage is improved, the delayed injection of this execution is marked as of interest and put into the seed queue. After the delayed sequence is mutated by seed selection, the next test loop continues until no new execution traces are generated.
[0053] In one instance, such as Figure 2 As shown, the testing tool (SyncFuzz) uses an automatic instrumentation tool to hijack the synchronization statements in the Go program (as shown in ①), and uses the hijacking function to intervene in the execution of the synchronization statements and record the program's execution trajectory. In ②, SyncFuzz runs the instrumented program multiple times. If the program does not expose a defect after execution but triggers a new execution trajectory, SyncFuzz will use lightweight predictive analytics to analyze the execution trajectory to find blocking defects caused by changes in the order of event alternation. If the defect is exposed during program execution, SyncFuzz uses the third-party online testing tool in ④ to capture the anomalies that occur in the program. Between multiple program runs, SyncFuzz assigns random time delays to the synchronization statements and mutates them to explore more execution paths affected by concurrency (as shown in ②) until no new paths are generated.
[0054] Specifically, in step ①, the original Go program is transformed into an instrumented program by SyncFuzz. SyncFuzz uses instrumentation to record synchronization statements and uses Go compiler built-in tools to perform coverage counting. In step ②, SyncFuzz performs its own fuzzing loop, which injects delays into the instrumented program and uses online detectors such as third-party detectors and test assertions to observe whether the program has errors. If an error occurs, bug reports are generated in step ⑤. If no error occurs, in step ③, offline detectors such as lightweight predictive analysis are used to detect the recorded program trajectory. If an error occurs, a bug report is generated. If no error occurs, it checks whether the execution improved coverage. If the program coverage improved, the delay injection of this execution is marked as of interest and placed in the seed queue. After seed selection to mutate the delay sequence, the next fuzzing loop continues.
[0055] SyncFuzz combines synchronization and fuzzing, borrowing fuzzing techniques to adjust the order of synchronous events in Go, thereby finding more concurrency defects.
[0056] Furthermore, SyncFuzz can quickly detect blocking defects that are difficult for GCatch and GFuzz to detect, such as Serving#2137 and Kubernetes#1321, on the core test set (GoKer) of the Go language concurrency defect benchmark test set (GoBench). At the same time, it can detect 17 concurrency defects, such as Grpc#4413 and Etcd#13024, on well-known open source projects such as grpc and etcd, including 14 new defects.
[0057] Therefore, the program concurrency defect detection method provided by the above embodiments of the present invention avoids both the blind enumeration of the program state space by the static detection tool GCatch and the inability of the dynamic detection tool GFuzz to handle potential blocking defects caused by the alternation order of events. Furthermore, it can also be extended to third-party detection tools, thus possessing a certain degree of non-blocking concurrency defect detection capability.
[0058] This invention also provides a program concurrency defect detection device, such as... Figure 3 As shown, the device includes:
[0059] The acquisition module 301 is used to acquire synchronization statements in the program to be detected using an automatic hijacking tool; for details, please refer to the relevant description of step 101 in the above method embodiment.
[0060] The control module 302 is used to acquire the hijacking function and use the hijacking function to control the execution of the synchronization statement; for details, please refer to the relevant description of step 102 in the above method embodiment.
[0061] The judgment module 303 is used to determine whether a defect in the program to be detected is exposed when the synchronization statement is executed; for details, please refer to the relevant description of step 103 in the above method embodiment.
[0062] The recording module 304 is used to record the execution trajectory of the synchronization statement when the defects in the program to be detected are not exposed; for details, please refer to the relevant description of step 104 in the above method embodiment.
[0063] The analysis and determination module 305 is used to analyze the execution trajectory using lightweight predictive analysis to determine the location of the defect in the program to be detected; for details, please refer to the relevant description of step 105 in the above method embodiment.
[0064] The program concurrency defect detection device provided in this invention utilizes lightweight predictive analysis, avoiding the need to establish and solve constraint expressions for each synchronization event. Instead, it focuses on analyzing events more important for detecting blocking defects, calculating potential blocking locations through cyclic dependency cycles rather than blind enumeration. Therefore, by implementing this invention, dependency is reduced and detection effectiveness is improved.
[0065] As an optional implementation of this invention, the judgment module includes: an injection submodule, used to inject a delay into the synchronization statement when the synchronization statement is executed; a first judgment submodule, used to use a preset online detection mechanism to determine whether an error has occurred in the synchronization statement after the delay is injected; and a first determination submodule, used to determine whether a defect in the program to be detected has been exposed based on the judgment result.
[0066] As an optional implementation of this invention, the analysis and determination module includes: a second determination submodule, used to determine the location of the defect in the program to be detected based on the location of the error in the execution trajectory when an error occurs in the execution trajectory.
[0067] As an optional implementation of this invention, the analysis and determination module further includes: a second judgment submodule, used to determine whether the coverage of the synchronization statement in the program to be detected has improved based on the execution result of the synchronization statement when no error occurs in the execution trajectory; a first processing submodule, used to process the delay injected in the synchronization statement based on the judgment result; and a third determination submodule, used to determine the location of the defect in the program to be detected based on the processing result.
[0068] As an optional implementation of this invention, the processing submodule includes: a marking submodule, used to mark the delay when the coverage increases to obtain a target delay; and a second processing submodule, used to add the target delay to a preset seed queue and perform mutation processing on the target delay after seed selection.
[0069] As an optional embodiment of the present invention, the device further includes: a capture module, used to capture the defect when the defect in the program to be detected is exposed using a preset online detection tool.
[0070] For a detailed description of the function of the program concurrency defect detection device provided in the embodiments of the present invention, please refer to the description of the program concurrency defect detection method in the above embodiments.
[0071] This invention also provides a storage medium, such as... Figure 4 As shown, a computer program 401 is stored thereon. When executed by a processor, this program implements the steps of the concurrent defect detection method in the above embodiments. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium may also include combinations of the above types of memory.
[0072] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium can also include combinations of the above types of memory.
[0073] This invention also provides an electronic device, such as... Figure 5 As shown, the electronic device may include a processor 51 and a memory 52, wherein the processor 51 and the memory 52 may be connected via a bus or other means. Figure 5 Taking the example of a connection between China and Israel via a bus.
[0074] Processor 51 can be a central processing unit (CPU). Processor 51 can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations of the above types of chips.
[0075] The memory 52, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the corresponding program instructions / modules in the embodiments of the present invention. The processor 51 executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions, and modules stored in the memory 52, thereby implementing the program concurrency defect detection method in the above method embodiments.
[0076] The memory 52 may include a program storage area and a data storage area. The program storage area may store applications required for operating the device and at least one function; the data storage area may store data created by the processor 51, etc. Furthermore, the memory 52 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 52 may optionally include memory remotely located relative to the processor 51, and these remote memories may be connected to the processor 51 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0077] The one or more modules are stored in the memory 52, and when executed by the processor 51, they perform the following: Figure 1-2 The program concurrency defect detection method in the illustrated embodiment.
[0078] For specific details regarding the aforementioned electronic devices, please refer to the relevant documentation. Figures 1 to 2 The relevant descriptions and effects in the illustrated embodiments are for understanding purposes only and will not be repeated here.
[0079] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A method for detecting concurrent defects in a program, characterized in that, The method includes: Use automated hijacking tools to obtain synchronization statements in the program under test; Obtain the hijacking function and use the hijacking function to control the execution of the synchronous statement; When the synchronization statement is executed, it is determined whether the defects in the program to be detected are exposed; If the defects in the program to be tested are not exposed, record the execution trajectory of the synchronization statement; Lightweight predictive analytics is used to analyze the execution trajectory and determine the location of the defect in the program to be detected. In this case, an offline detector is used to perform lightweight predictive analytics, which identifies blocking defects caused by changes in the order of events during the execution of synchronous statements by identifying circular dependency loops. When the synchronization statement is executed, determining whether a defect in the program to be detected is exposed includes: When the synchronization statement is executed, a delay is injected into the synchronization statement; The system uses a time delay and a preset online detection mechanism to determine whether an error has occurred in the synchronous statement after the injection delay. The time delay is used to explore more paths by changing the path conditions caused by shared variables. Based on the judgment result, determine whether the defects in the program to be tested are exposed; Analyzing the execution trajectory using lightweight predictive analytics to determine the location of the defect in the program to be detected includes: When an error occurs in the execution trajectory, the location of the defect in the program to be detected is determined based on the location of the error in the execution trajectory. If no errors occur in the execution trajectory, determine whether the coverage of the synchronization statements in the program to be tested has improved based on the execution result of the synchronization statements; The delay injected into the synchronization statement is processed based on the judgment result; The location of the defect in the program to be detected is determined based on the processing results; The process of handling the delay injected into the synchronization statement based on the judgment result includes: As the coverage increases, the latency is marked to obtain the target latency; The target delay is added to a preset seed queue, and after seed selection, the target delay is mutated.
2. The method according to claim 1, characterized in that, After the synchronization statement is executed and it is determined whether the defect in the program to be detected is exposed, the method further includes: When a defect is exposed in the program to be tested, the defect is captured using a preset online detection tool.
3. A concurrent defect detection device for a program, characterized in that, The device includes: The acquisition module is used to obtain synchronization statements in the program under test using automatic hijacking tools. A control module is used to acquire a hijacking function and use the hijacking function to control the execution of the synchronous statement; The judgment module is used to determine whether the defects in the program to be detected are exposed when the synchronization statement is executed; A recording module is used to record the execution trajectory of the synchronization statement when the defects in the program to be detected are not exposed; The analysis and determination module is used to analyze the execution trajectory using lightweight predictive analysis to determine the location of the defect in the program to be detected. The lightweight predictive analysis is performed using an offline detector and identifies blocking defects caused by changes in the order of alternating events during the execution of synchronous statements through circular dependency loops. The judgment module includes: An injection submodule is used to inject a delay into the synchronization statement when the synchronization statement is executed; The first judgment submodule is used to determine whether the synchronous statement after the injection delay has an error by using a time delay and a preset online detection mechanism. The time delay is used to explore more paths by changing the path conditions caused by shared variables. The first determining submodule is used to determine whether a defect in the program to be detected is exposed based on the judgment result. The analysis and determination module includes: The second determining submodule is used to determine the location of the defect in the program to be detected based on the location of the error in the execution trajectory when an error occurs in the execution trajectory. The second judgment submodule is used to determine whether the coverage of the synchronization statement in the program to be tested has improved based on the execution result of the synchronization statement when no error occurs in the execution trajectory. The first processing submodule is used to process the delay injected in the synchronization statement according to the judgment result; The third determining submodule is used to determine the location of the defect in the program to be detected based on the processing result; The first processing submodule includes: A marking submodule is used to mark the delay when the coverage increases, thereby obtaining the target delay; The second processing submodule is used to add the target delay to a preset seed queue, and after seed selection, to perform mutation processing on the target delay.
4. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to execute the concurrent defect detection method as described in claim 1 or 2.
5. An electronic device, characterized in that, include: The system includes a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the concurrent defect detection method as described in claim 1 or 2.
Citation Information
Patent Citations
Hardware and thread local timing sequence based data competition sampling detection method
CN106227656A
A loophole mining method and device
CN109032927A