Bug 237404

Summary: [Tools] Fix linux_get_crash_log.py error logging with python3
Product: WebKit Reporter: Lauro Moura <lmoura>
Component: New BugsAssignee: Lauro Moura <lmoura>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, ews-watchlist, glenn, Hironori.Fujii, jbedard, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=226658
Attachments:
Description Flags
Patch none

Description Lauro Moura 2022-03-02 20:13:45 PST
[Tools] Fix linux_get_crash_log.py error logging with python3
Comment 1 Lauro Moura 2022-03-02 20:14:50 PST
Created attachment 453692 [details]
Patch
Comment 2 Lauro Moura 2022-03-02 20:16:37 PST
Comment on attachment 453692 [details]
Patch

Sample error from https://build.webkit.org/#/builders/63/builds/4407

TypeError raised: %b requires a bytes-like object, or an object that implements __bytes__, not 'str' (from worker/5)
Traceback (most recent call last):
  File "/app/webkit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py", line 92, in main
    run_details = run(port, options, args, stderr)
  File "/app/webkit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py", line 495, in run
    run_details = manager.run(args)
  File "/app/webkit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py", line 413, in run
    temp_initial_results, temp_retry_results, temp_enabled_pixel_tests_in_retry = self._run_test_subset(test_inputs, device_type=device_type)
  File "/app/webkit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py", line 487, in _run_test_subset
    initial_results = self._run_tests(test_inputs, self._options.repeat_each, self._options.iterations, int(self._options.child_processes), retrying=False, device_type=device_type)
  File "/app/webkit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py", line 566, in _run_tests
    return self._runner.run_tests(self._expectations[device_type], new_test_inputs, num_workers, retrying, device_type)
  File "/app/webkit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py", line 179, in run_tests
    pool.wait()
  File "/app/webkit/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/task_pool.py", line 454, in __exit__
    reraise(*inflight)
  File "/app/webkit/Tools/Scripts/libraries/autoinstalled/python-3-x86_64/six.py", line 703, in reraise
    raise value
  File "/app/webkit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py", line 179, in run_tests
    pool.wait()
  File "/app/webkit/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/task_pool.py", line 426, in wait
    self.queue.receive()(self)
  File "/app/webkit/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/task_pool.py", line 133, in __call__
    reraise(*self.exc_info)
  File "/app/webkit/Tools/Scripts/libraries/autoinstalled/python-3-x86_64/six.py", line 702, in reraise
    raise value.with_traceback(tb)
  File "/app/webkit/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/task_pool.py", line 299, in main
    queue.send(_Result(value=task(None), id=task.id))
  File "/app/webkit/Tools/Scripts/libraries/webkitcorepy/webkitcorepy/task_pool.py", line 56, in __call__
    return self.function(*self.args, **self.kwargs)
  File "/app/webkit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py", line 76, in run_shard
    return Worker.instance.run_tests(shard)
  File "/app/webkit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py", line 318, in run_tests
    Worker.instance.run_test(input, shard.name)
  File "/app/webkit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py", line 346, in run_test
    result = self._run_test_with_or_without_timeout(test_input, test_timeout_sec, stop_when_done)
  File "/app/webkit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py", line 403, in _run_test_with_or_without_timeout
    return self._run_test_in_this_thread(test_input, stop_when_done)
  File "/app/webkit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py", line 489, in _run_test_in_this_thread
    return self._run_single_test(self._driver, test_input, stop_when_done)
  File "/app/webkit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py", line 492, in _run_single_test
    return single_test_runner.run_single_test(
  File "/app/webkit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py", line 48, in run_single_test
    return runner.run()
  File "/app/webkit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py", line 126, in run
    return self._run_compare_test()
  File "/app/webkit/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py", line 129, in _run_compare_test
    driver_output = self._driver.run_test(self._driver_input(), self._stop_when_done)
  File "/app/webkit/Tools/Scripts/webkitpy/port/driver.py", line 843, in run_test
    return self._driver.run_test(driver_input, stop_when_done)
  File "/app/webkit/Tools/Scripts/webkitpy/port/driver.py", line 257, in run_test
    self.error_from_test, crash_log = self._get_crash_log(text, self.error_from_test, newer_than=start_time)
  File "/app/webkit/Tools/Scripts/webkitpy/port/driver.py", line 326, in _get_crash_log
    return self._port._get_crash_log(self._crashed_process_name, self._crashed_pid, stdout, stderr, newer_than, target_host=self._target_host)
  File "/app/webkit/Tools/Scripts/webkitpy/port/gtk.py", line 247, in _get_crash_log
    return GDBCrashLogGenerator(self._executive, name, pid, newer_than,
  File "/app/webkit/Tools/Scripts/webkitpy/port/linux_get_crash_log.py", line 156, in generate_crash_log
    crash_log, errors = self._get_gdb_output(coredump_path)
  File "/app/webkit/Tools/Scripts/webkitpy/port/linux_get_crash_log.py", line 63, in _get_gdb_output
    stdout = (b'ERROR: The gdb process exited with non-zero return code %s\n\n' % str(proc.returncode)) + stdout
TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'str' (from worker/5)
Comment 3 EWS 2022-03-02 22:24:44 PST
Committed r290767 (248011@main): <https://commits.webkit.org/248011@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 453692 [details].
Comment 4 Radar WebKit Bug Importer 2022-03-02 22:25:17 PST
<rdar://problem/89733848>