Skip to content

Commit

Permalink
Merge pull request ansible#4393 from kdelee/backport_dont_block_log_send
Browse files Browse the repository at this point in the history
[3.7.1] don't block on log aggregator socket.send() calls
  • Loading branch information
ryanpetrello authored Jun 9, 2020
2 parents b7ac5f0 + 71cc359 commit 1d7e2a8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions awx/main/utils/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class RSysLogHandler(logging.handlers.SysLogHandler):

append_nul = False

def _connect_unixsocket(self, address):
super(RSysLogHandler, self)._connect_unixsocket(address)
self.socket.setblocking(False)

def emit(self, msg):
if not settings.LOG_AGGREGATOR_ENABLED:
return
Expand All @@ -26,6 +30,14 @@ def emit(self, msg):
# unfortunately, we can't log that because...rsyslogd is down (and
# would just us back ddown this code path)
pass
except BlockingIOError:
# for <some reason>, rsyslogd is no longer reading from the domain socket, and
# we're unable to write any more to it without blocking (we've seen this behavior
# from time to time when logging is totally misconfigured;
# in this scenario, it also makes more sense to just drop the messages,
# because the alternative is blocking the socket.send() in the
# Python process, which we definitely don't want to do)
pass


ColorHandler = logging.StreamHandler
Expand Down

0 comments on commit 1d7e2a8

Please sign in to comment.