Skip to content

Commit

Permalink
tracereport: also catch gaierror for gethostbyaddr()
Browse files Browse the repository at this point in the history
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,...).
  • Loading branch information
olifre committed Mar 14, 2024
1 parent 93d2524 commit 6bdebef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pilot/util/tracereport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down

0 comments on commit 6bdebef

Please sign in to comment.