1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-27 00:55:06 +03:00

don't block on log aggregator socket.send() calls

see: https://github.com/ansible/tower/issues/4391
This commit is contained in:
Ryan Petrello 2020-06-08 18:07:33 -04:00
parent 951f13c066
commit 7164049062
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777

View File

@ -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
@ -26,6 +30,14 @@ class RSysLogHandler(logging.handlers.SysLogHandler):
# 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