Skip to content

Commit

Permalink
Improved exception handling for socket related errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Nilsson committed Dec 2, 2024
1 parent dfaaa07 commit e35fcaa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pilot/util/tracereport.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def init(self, job):

try:
hostname = os.environ.get('PANDA_HOSTNAME', socket.gethostname())
except socket.herror as exc:
except (socket.gaierror, socket.herror) as exc:
logger.warning(f'unable to detect hostname for trace report: {exc}')
hostname = os.environ.get('PANDA_HOSTNAME', 'unknown')

Expand All @@ -126,7 +126,7 @@ def init(self, job):

try:
self['ip'] = socket.gethostbyname(hostname)
except socket.herror as exc:
except (socket.gaierror, socket.herror) as exc:
logger.debug(f"unable to detect host IP for trace report: {exc}")
self['ip'] = '0.0.0.0'

Expand Down

0 comments on commit e35fcaa

Please sign in to comment.