logging fail to recover on rsyslog restart
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oslo.log |
Incomplete
|
Medium
|
Tom Hancock |
Bug Description
If syslog logging is enabled, then if rsyslog is restarted, is possible to break logging
such that it will continually issue tracebacks and not log.
This seems to happen in applications which use eventlet, and has been reproduced in
glance and in swift.
The problem seems to be this code in /usr/lib/
in SyslogHander:emit()
try:
if self.unixsocket:
elif self.socktype == socket.SOCK_DGRAM:
else:
except (KeyboardInterrupt, SystemExit):
raise
except Exception, e:
When rsyslog restarts, socket.send() raises a RuntimeError which falls into
the outer loop and doesn't reconnect to rsyslog
Here's a reproducer program (not meant to be pretty, or the smallest possible code)
import logging
import logging.config
import logging.handlers
import eventlet
from eventlet.green import socket, ssl
import eventlet.greenio
def _setup_
log_root = logging.
facility = logging.
syslog = logging.
log_
log_
def func(num1,num2):
thelogger=
while 1:
for i in range(0,30):
_setup_
eventlet.
pool = eventlet.
nums = []
for i in range(0,30):
nums.
while 1:
for job in pool.starmap(
pass
Run this in one window and restart rsyslog in another window and you'll see repeated exceptions.
Traceback (most recent call last):
File "/usr/lib/
self.
File "/usr/lib/
timeout_
File "/usr/lib/
listener = hub.add(hub.WRITE, fileno, current.switch)
File "/usr/lib/
listener = BaseHub.add(self, evtype, fileno, cb)
File "/usr/lib/
evtype, fileno, evtype))
RuntimeError: Second simultaneous write on fileno 5 detected. Unless you really know what you're doing, make sure that only one greenthread can write any particular socket. Consider using a pools.Pool. If you do know what you're doing and want to disable this error, call eventlet.
.....
I'm not sure what the upstream means to address should be, but overriding SysLogHandler.
with a change to catch RuntimeError looks like it could be a workaround?
affects: | openstack-common → oslo |
Changed in oslo: | |
importance: | Undecided → Medium |
assignee: | nobody → Tom Hancock (tom-hancock) |
affects: | oslo-incubator → oslo.log |
If there was a workaround patch to add to oslo, we could consider that but otherwise it sounds like a python bug to me and should be addressed there