Skip to content

Commit 40cc788

Browse files
committed
analyser: introduce an option for disabling parallel mode
Fuzz Introspector is failed when building reports for Tarantool and other projects, see [1]: During handling of the above exception, another exception occurred: File "/usr/local/lib/python3.10/multiprocessing/managers.py", line 817, in _callmethod conn.send((self._id, methodname, args, kwds)) File "/fuzz-introspector/src/fuzz_introspector/datatypes/fuzzer_profile.py", line 359, in accummulate_profile return_dict[uniq_id] = self AttributeError: 'ForkAwareLocal' object has no attribute 'connection' The issue (theoretically) is related to processing data in parallel mode and cannot be reproduced locally. The patch introduce an option for controlling parallel mode - FUZZ_INTROSPECTOR_PARALLEL. When envronment variable is set to `false` Fuzz Introspector will process data in sequential mode. 1. google/oss-fuzz#13226 Related to #2267 Related to google/oss-fuzz#13226
1 parent 6648cce commit 40cc788

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

src/fuzz_introspector/analysis.py

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,23 +88,31 @@ def load_data_files(self,
8888

8989
logger.info("[+] Accummulating profiles")
9090
logger.info("Accummulating using multiprocessing")
91-
manager = multiprocessing.Manager()
92-
semaphore = multiprocessing.Semaphore(10)
9391

94-
return_dict = manager.dict()
92+
result_dict: Dict[Any, Any] = dict()
93+
if parallelise:
94+
manager = multiprocessing.Manager()
95+
semaphore = multiprocessing.Semaphore(10)
9596

96-
jobs = []
97-
idx = 0
98-
for profile in self.profiles:
99-
p = multiprocessing.Process(
100-
target=fuzzer_profile.FuzzerProfile.accummulate_profile,
101-
args=(profile, self.base_folder, return_dict, f"uniq-{idx}",
102-
semaphore))
103-
jobs.append(p)
104-
idx += 1
105-
p.start()
106-
for proc in jobs:
107-
proc.join()
97+
return_dict = manager.dict()
98+
99+
jobs = []
100+
idx = 0
101+
for profile in self.profiles:
102+
p = multiprocessing.Process(
103+
target=fuzzer_profile.FuzzerProfile.accummulate_profile,
104+
args=(profile, self.base_folder, return_dict, f"uniq-{idx}",
105+
semaphore))
106+
jobs.append(p)
107+
idx += 1
108+
p.start()
109+
for proc in jobs:
110+
proc.join()
111+
result_dict = return_dict.copy()
112+
else:
113+
for profile in self.profiles:
114+
fuzzer_profile.FuzzerProfile.accummulate_profile(
115+
profile, self.base_folder, result_dict, f"uniq-{idx}")
108116

109117
new_profiles = []
110118
for idx in return_dict:

src/fuzz_introspector/commands.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ def analyse_end_to_end(arg_language,
113113
correlation_file = ''
114114

115115
try:
116+
is_parallel = os.getenv('FUZZ_INTROSPECTOR_PARALLEL', "true").lower() == "true"
116117
exit_code, return_values2 = run_analysis_on_dir(
117118
target_folder=out_dir,
118119
coverage_url=coverage_url,
@@ -124,6 +125,7 @@ def analyse_end_to_end(arg_language,
124125
out_dir=out_dir,
125126
dump_files=dump_files,
126127
harness_lists=harness_lists)
128+
parallelise=is_parallel
127129
for k, v in return_values2.items():
128130
return_values[k] = v
129131
except DataLoaderError:

0 commit comments

Comments
 (0)