mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Try to address dict changing during iteration
``` 06:10:57 RuntimeError: dictionary changed size during iteration 06:10:57 Traceback (most recent call last): 06:10:57 File "/usr/lib64/python2.7/multiprocessing/queues.py", line 266, in _feed 06:10:57 send(obj) 06:10:57 RuntimeError: dictionary changed size during iteration ```
This commit is contained in:
parent
c58af57bc0
commit
962b116874
1 changed files with 6 additions and 3 deletions
|
@ -178,7 +178,9 @@ LOGGING_STORE_HANDLER = __StoreLoggingHandler()
|
|||
|
||||
|
||||
class SaltLogQueueHandler(QueueHandler):
|
||||
pass
|
||||
def prepare(self, record):
|
||||
record = QueueHandler.prepare(self, record)
|
||||
return record.__dict__.copy()
|
||||
|
||||
|
||||
class SaltLogRecord(logging.LogRecord):
|
||||
|
@ -1112,12 +1114,13 @@ def __process_multiprocessing_logging_queue(opts, queue):
|
|||
setup_extended_logging(opts)
|
||||
while True:
|
||||
try:
|
||||
record = queue.get()
|
||||
if record is None:
|
||||
record_dict = queue.get()
|
||||
if record_dict is None:
|
||||
# A sentinel to stop processing the queue
|
||||
break
|
||||
# Just log everything, filtering will happen on the main process
|
||||
# logging handlers
|
||||
record = logging.makeLogRecord(record_dict)
|
||||
logger = logging.getLogger(record.name)
|
||||
logger.handle(record)
|
||||
except (EOFError, KeyboardInterrupt, SystemExit):
|
||||
|
|
Loading…
Add table
Reference in a new issue