From 6bdebef034ab38639af5e9ac9df163c7fa7331a9 Mon Sep 17 00:00:00 2001 From: Oliver Freyermuth Date: Thu, 14 Mar 2024 20:01:15 +0100 Subject: [PATCH] tracereport: also catch gaierror for gethostbyaddr() socket.gethostbyaddr() throws a socket.gaierror exception if the address can not be resolved which was not caught before. Fixes regression introduced by e7d7c6f , after which Pilot yielded stage-in and stage-out errors with backtrace for sites using a non-DNS resolvable PANDA_HOSTNAME (VMs, long-lived containers,...). --- pilot/util/tracereport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pilot/util/tracereport.py b/pilot/util/tracereport.py index 46cb3e11..5b6d8cbc 100644 --- a/pilot/util/tracereport.py +++ b/pilot/util/tracereport.py @@ -115,7 +115,7 @@ def init(self, job): try: self['hostname'] = socket.gethostbyaddr(hostname)[0] - except socket.herror as exc: + except (socket.gaierror, socket.herror) as exc: logger.warning(f'unable to detect hostname by address for trace report: {exc}') self['hostname'] = 'unknown'