[compiler-rt] 831cf15 - [compiler-rt] Handle None value when polling addr2line pipe

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Mon May 10 01:46:15 PDT 2021


Author: David Spickett
Date: 2021-05-10T09:46:06+01:00
New Revision: 831cf15ca6892e2044447f8dc516d76b8a827f1e

URL: https://github.com/llvm/llvm-project/commit/831cf15ca6892e2044447f8dc516d76b8a827f1e
DIFF: https://github.com/llvm/llvm-project/commit/831cf15ca6892e2044447f8dc516d76b8a827f1e.diff

LOG: [compiler-rt] Handle None value when polling addr2line pipe

According to:
https://docs.python.org/3/library/subprocess.html#subprocess.Popen.poll

poll can return None if the process hasn't terminated.

I'm not quite sure how addr2line could end up closing the pipe without
terminating but we did see this happen on one of our bots:
```
<...>scripts/asan_symbolize.py",
line 211, in symbolize
    logging.debug("addr2line exited early (broken pipe), returncode=%d"
% self.pipe.poll())
TypeError: %d format: a number is required, not NoneType
```

Handle None by printing a message that we couldn't get the return
code.

Reviewed By: delcypher

Differential Revision: https://reviews.llvm.org/D101891

Added: 
    

Modified: 
    compiler-rt/lib/asan/scripts/asan_symbolize.py

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/scripts/asan_symbolize.py b/compiler-rt/lib/asan/scripts/asan_symbolize.py
index 5c4001acf8c65..ab04b1c67e5a8 100755
--- a/compiler-rt/lib/asan/scripts/asan_symbolize.py
+++ b/compiler-rt/lib/asan/scripts/asan_symbolize.py
@@ -208,7 +208,7 @@ def symbolize(self, addr, binary, offset):
       # EPIPE happens if addr2line exits early (which some implementations do
       # if an invalid file is passed).
       if e.errno == errno.EPIPE:
-        logging.debug("addr2line exited early (broken pipe), returncode=%d" % self.pipe.poll())
+        logging.debug(f"addr2line exited early (broken pipe) returncode={self.pipe.poll()}")
       else:
         logging.debug("unexpected I/O exception communicating with addr2line", exc_info=e)
       lines.append(('??', '??:0'))


        


More information about the llvm-commits mailing list