diff options
author | ignat <ignat@yandex-team.com> | 2022-12-14 09:58:59 +0300 |
---|---|---|
committer | ignat <ignat@yandex-team.com> | 2022-12-14 09:58:59 +0300 |
commit | 47490f2785d458995a29c75f5dd92f68f492a065 (patch) | |
tree | 0a46e255ceded2daba369c4d41d4c329bd8442d3 /library/python/cores/__init__.py | |
parent | b6d47f34c4d85dd5f038a13eab9ef958cf3b095e (diff) | |
download | ydb-47490f2785d458995a29c75f5dd92f68f492a065.tar.gz |
fix case of disappered core file in recover_core_dump_file
Diffstat (limited to 'library/python/cores/__init__.py')
-rw-r--r-- | library/python/cores/__init__.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/library/python/cores/__init__.py b/library/python/cores/__init__.py index 36ff5851bc..f8c54b8fd3 100644 --- a/library/python/cores/__init__.py +++ b/library/python/cores/__init__.py @@ -109,8 +109,14 @@ def recover_core_dump_file(binary_path, cwd, pid, core_pattern=None): if len(cores) == 1: return cores[0] elif len(cores) > 1: - stat = [(filename, os.stat(filename).st_mtime) for filename in cores] - entry = sorted(stat, key=lambda x: x[1])[-1] + core_stats = [] + for filename in cores: + try: + mtime = os.stat(filename).st_mtime + except OSError: + continue + core_stats.append((filename, mtime)) + entry = sorted(core_stats, key=lambda x: x[1])[-1] logger.debug("Latest core dump file: '%s' with %d mtime", entry[0], entry[1]) return entry[0] else: |