Skip to content

Commit

Permalink
Fix recent FuzzBench cloud experiment failures (google#2023)
Browse files Browse the repository at this point in the history
1. Fix `TypeError: expected str, bytes or os.PathLike object, not
NoneType` in
[`2024-08-10-test`](google#2020 (comment)).
```python
Traceback (most recent call last):
  File "/src/experiment/runner.py", line 468, in experiment_main
    runner.conduct_trial()
  File "/src/experiment/runner.py", line 290, in conduct_trial
    self.set_up_corpus_directories()
  File "/src/experiment/runner.py", line 275, in set_up_corpus_directories
    _unpack_clusterfuzz_seed_corpus(target_binary, input_corpus)
  File "/src/experiment/runner.py", line 144, in _unpack_clusterfuzz_seed_corpus
    seed_corpus_archive_path = get_clusterfuzz_seed_corpus_path(
  File "/src/experiment/runner.py", line 98, in get_clusterfuzz_seed_corpus_path
    fuzz_target_without_extension = os.path.splitext(fuzz_target_path)[0]
  File "/usr/local/lib/python3.10/posixpath.py", line 118, in splitext
    p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
```
This happens on [many
benchmarks+fuzzers](https://pantheon.corp.google.com/logs/query;query=%222024-08-10-test%22%0Aseverity%3E%3DERROR%0A--Hide%20similar%20entries%0A-%2528jsonPayload.message%3D~%22Error%20watching%20metadata:%20context%20canceled%22%2529%0A--End%20of%20hide%20similar%20entries;cursorTimestamp=2024-08-10T11:04:34.735815901Z;duration=P7D?project=fuzzbench&mods=logs_tg_prod).
To be investigated later:
1. Why `fuzz_target_path` is `None`.
2. Why this did not happen in other recent experiments.
3. I thought I had seen this a long ago, Déjà vu?

2. Fixing `No such file or directory:
'/work/measurement-folders/<benchmark>-<fuzzer>/merged.json`:
```python
Traceback (most recent call last):
  File "/work/src/experiment/measurer/coverage_utils.py", line 74, in generate_coverage_report
    coverage_reporter.generate_coverage_summary_json()
  File "/work/src/experiment/measurer/coverage_utils.py", line 141, in generate_coverage_summary_json
    result = generate_json_summary(coverage_binary,
  File "/work/src/experiment/measurer/coverage_utils.py", line 269, in generate_json_summary
    with open(output_file, 'w', encoding='utf-8') as dst_file:
FileNotFoundError: [Errno 2] No such file or directory: '/work/measurement-folders/lcms_cms_transform_fuzzer-centipede/merged.json'
```

3. Remove incompatible benchmarks: `openh264_decoder_fuzzer`,
`stb_stbi_read_fuzzer`
  • Loading branch information
DonggeLiu authored and Ardi Madadi committed Nov 25, 2024
1 parent 7f03d10 commit 5e79b72
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions experiment/measurer/coverage_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ def generate_json_summary(coverage_binary,

if summary_only:
command.append('-summary-only')
# Ensure the directory exists, creating it if necessary
os.makedirs(os.path.dirname(output_file), exist_ok=True)

with open(output_file, 'w', encoding='utf-8') as dst_file:
result = new_process.execute(command,
Expand Down
2 changes: 2 additions & 0 deletions experiment/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def _clean_seed_corpus(seed_corpus_dir):
def get_clusterfuzz_seed_corpus_path(fuzz_target_path):
"""Returns the path of the clusterfuzz seed corpus archive if one exists.
Otherwise returns None."""
if not fuzz_target_path:
return None
fuzz_target_without_extension = os.path.splitext(fuzz_target_path)[0]
seed_corpus_path = (fuzz_target_without_extension +
SEED_CORPUS_ARCHIVE_SUFFIX)
Expand Down

0 comments on commit 5e79b72

Please sign in to comment.