symbolization: Handle EOF conditions and avoid hanging if possible Sometimes the symbolizer is just hanging, causing bot timeouts. We should avoid this in a two ways: 1. Handle empty lines coming from llvm-symbolizer (in case the process has died underneath it), so an EOF doesn't loop infinitely 2. Set more aggressive timeouts (used to be 20 minutes) in case something is wrong with symbolization Bug: 571510778 Change-Id: I2e3b781161f86d43bc2e4539ab8eaa70eb9d1517 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8541492 Auto-Submit: Sam Maier <smaier@google.com> Reviewed-by: Andrew Grieve <agrieve@chromium.org> Commit-Queue: Sam Maier <smaier@google.com> Cr-Commit-Position: refs/heads/main@{#1715513} NOKEYCHECK=True GitOrigin-RevId: dda58c5ae38b060520d6a4ac4be059b06a3d3ab7
diff --git a/llvm_symbolizer.py b/llvm_symbolizer.py index 06f79e1..7719dc6 100644 --- a/llvm_symbolizer.py +++ b/llvm_symbolizer.py
@@ -135,11 +135,12 @@ # with the corresponding line number. while True: line = proc.stdout.readline() - if line != '\n': - line_numbers = proc.stdout.readline() - result.append((line[:-1], line_numbers[:-1])) - else: - return result + if not line or line == '\n': + return result or [(_UNKNOWN, lib)] + line_numbers = proc.stdout.readline() + if not line_numbers: + return result or [(_UNKNOWN, lib)] + result.append((line[:-1], line_numbers[:-1])) @staticmethod def IsValidTarget(path):