Skip to content

Commit

Permalink
Added additional exception handling to execute(), to handle "Poll: ba…
Browse files Browse the repository at this point in the history
…d file descriptor reading from request pipe" in stderr (harmless)
  • Loading branch information
PalNilsson committed Oct 17, 2024
1 parent 43998c7 commit a3c8f52
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion PILOTVERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.9.1.12
3.9.1.13
2 changes: 1 addition & 1 deletion pilot/util/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
RELEASE = '3' # released number should be fixed at 3 for Pilot 3
VERSION = '9' # version number is '1' for first release, '0' until then, increased for bigger updates
REVISION = '1' # revision number should be reset to '0' for every new version release, increased for small updates
BUILD = '12' # build number should be reset to '1' for every new development cycle
BUILD = '13' # build number should be reset to '1' for every new development cycle

SUCCESS = 0
FAILURE = 1
Expand Down
14 changes: 12 additions & 2 deletions pilot/util/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

"""Functions for executing commands."""

import errno
import os
import subprocess
import logging
Expand Down Expand Up @@ -118,6 +119,12 @@ def read_output(stream, queue):
except (AttributeError, ValueError):
# Handle the case where stream is None (AttributeError) or closed (ValueError)
break
except OSError as e:
if e.errno == errno.EBADF:
# Handle the case where the file descriptor is bad
break
else:
raise

queue.put(line)

Expand Down Expand Up @@ -145,8 +152,11 @@ def read_output(stream, queue):
exit_code = process.poll()

# Wait for the threads to finish reading
stdout_thread.join()
stderr_thread.join()
try:
stdout_thread.join()
stderr_thread.join()
except Exception as e:
logger.warning(f'exception caught in execute: {e}')

# Read the remaining output from the queues
while not stdout_queue.empty():
Expand Down

0 comments on commit a3c8f52

Please sign in to comment.