mirror of
https://github.com/ansible/awx.git
synced 2026-02-19 20:20:06 -03:30
don't block on log aggregator socket.send() calls
see: https://github.com/ansible/tower/issues/4391
This commit is contained in:
committed by
Elijah DeLee
parent
37c1c33ecd
commit
71cc359ccf
@@ -13,6 +13,10 @@ class RSysLogHandler(logging.handlers.SysLogHandler):
|
|||||||
|
|
||||||
append_nul = False
|
append_nul = False
|
||||||
|
|
||||||
|
def _connect_unixsocket(self, address):
|
||||||
|
super(RSysLogHandler, self)._connect_unixsocket(address)
|
||||||
|
self.socket.setblocking(False)
|
||||||
|
|
||||||
def emit(self, msg):
|
def emit(self, msg):
|
||||||
if not settings.LOG_AGGREGATOR_ENABLED:
|
if not settings.LOG_AGGREGATOR_ENABLED:
|
||||||
return
|
return
|
||||||
@@ -26,6 +30,14 @@ class RSysLogHandler(logging.handlers.SysLogHandler):
|
|||||||
# unfortunately, we can't log that because...rsyslogd is down (and
|
# unfortunately, we can't log that because...rsyslogd is down (and
|
||||||
# would just us back ddown this code path)
|
# would just us back ddown this code path)
|
||||||
pass
|
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
|
ColorHandler = logging.StreamHandler
|
||||||
|
|||||||
Reference in New Issue
Block a user