Author: Med Ismail Bennani Date: 2023-05-22T22:18:35-07:00 New Revision: bed4d7155b81619d403b1f85ece56f33275b30ac
URL: https://github.com/llvm/llvm-project/commit/bed4d7155b81619d403b1f85ece56f33275b30ac DIFF: https://github.com/llvm/llvm-project/commit/bed4d7155b81619d403b1f85ece56f33275b30ac.diff LOG: [lldb] Fix racing issue when loading inlined symbols from crash report Following abba5de72466, some tests started failing on green-dragon: https://green.lab.llvm.org/green/job/lldb-cmake/55460/console Looking at the backtrace, there seems to be a racing issue when deleting the temporary directory containing all the JSON object files: ``` Traceback (most recent call last): File "/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/lib/python3.10/site-packages/lldb/macosx/crashlog.py", line 1115, in __call__ SymbolicateCrashLogs(debugger, shlex.split(command), result) File "/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/lib/python3.10/site-packages/lldb/macosx/crashlog.py", line 1457, in SymbolicateCrashLogs SymbolicateCrashLog(crash_log, options) File "/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/lib/python3.10/site-packages/lldb/macosx/crashlog.py", line 1158, in SymbolicateCrashLog with tempfile.TemporaryDirectory() as obj_dir: File "/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py", line 869, in __exit__ self.cleanup() File "/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py", line 873, in cleanup self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors) File "/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py", line 855, in _rmtree _shutil.rmtree(name, onerror=onerror) File "/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 731, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 729, in rmtree os.rmdir(path) OSError: [Errno 66] Directory not empty: '/var/folders/09/r4vw4v8n5kb67jl66zvlbljw0000gn/T/tmp6qfifxk7' ``` This patch should fix that issue since it won't delete the object file directory until we're sure that the modules adding tasks completed. Signed-off-by: Med Ismail Bennani <ism...@bennani.ma> Added: Modified: lldb/examples/python/crashlog.py Removed: ################################################################################ diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py index 7bfa4021f49d..92e2a6248c94 100755 --- a/lldb/examples/python/crashlog.py +++ b/lldb/examples/python/crashlog.py @@ -1154,8 +1154,8 @@ def SymbolicateCrashLog(crash_log, options): futures = [] loaded_images = [] - with concurrent.futures.ThreadPoolExecutor() as executor: - with tempfile.TemporaryDirectory() as obj_dir: + with tempfile.TemporaryDirectory() as obj_dir: + with concurrent.futures.ThreadPoolExecutor() as executor: def add_module(image, target, obj_dir): return image, image.add_module(target, obj_dir) @@ -1166,12 +1166,12 @@ def add_module(image, target, obj_dir): add_module, image=image, target=target, obj_dir=obj_dir ) ) - for future in concurrent.futures.as_completed(futures): - image, err = future.result() - if err: - print(err) - else: - loaded_images.append(image) + for future in concurrent.futures.as_completed(futures): + image, err = future.result() + if err: + print(err) + else: + loaded_images.append(image) if crash_log.backtraces: for thread in crash_log.backtraces: _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits