Skip to content

Commit ef29265

Browse files
committed
[lldb] Fix racing issue when loading inlined symbols from crash report
Following abba5de, 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/[email protected]/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py", line 869, in __exit__ self.cleanup() File "/usr/local/opt/[email protected]/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/[email protected]/Frameworks/Python.framework/Versions/3.10/lib/python3.10/tempfile.py", line 855, in _rmtree _shutil.rmtree(name, onerror=onerror) File "/usr/local/opt/[email protected]/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/[email protected]/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 <[email protected]>
1 parent 465fdb8 commit ef29265

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lldb/examples/python/crashlog.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,8 +1243,8 @@ def SymbolicateCrashLog(crash_log, options):
12431243

12441244
futures = []
12451245
loaded_images = []
1246-
with concurrent.futures.ThreadPoolExecutor() as executor:
1247-
with tempfile.TemporaryDirectory() as obj_dir:
1246+
with tempfile.TemporaryDirectory() as obj_dir:
1247+
with concurrent.futures.ThreadPoolExecutor() as executor:
12481248

12491249
def add_module(image, target, obj_dir):
12501250
return image, image.add_module(target, obj_dir)
@@ -1255,12 +1255,12 @@ def add_module(image, target, obj_dir):
12551255
add_module, image=image, target=target, obj_dir=obj_dir
12561256
)
12571257
)
1258-
for future in concurrent.futures.as_completed(futures):
1259-
image, err = future.result()
1260-
if err:
1261-
print(err)
1262-
else:
1263-
loaded_images.append(image)
1258+
for future in concurrent.futures.as_completed(futures):
1259+
image, err = future.result()
1260+
if err:
1261+
print(err)
1262+
else:
1263+
loaded_images.append(image)
12641264

12651265
if crash_log.backtraces:
12661266
for thread in crash_log.backtraces:

0 commit comments

Comments
 (0)