mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix exception when shutting down logging listener
`shutdown_multiprocessing_logging_listener()` shuts down the logging process which closes the multiprocessing queue used to shuttle logging data. Before shutting down the logging process, prevent this process from trying to write to the logging queue to prevent an exception from occurring when trying to write to a multiprocessing queue that has been closed by the other side. Signed-off-by: Sergey Kizunov <sergey.kizunov@ni.com>
This commit is contained in:
parent
454ed23f62
commit
3da9b8dd33
2 changed files with 8 additions and 0 deletions
|
@ -946,6 +946,12 @@ def shutdown_multiprocessing_logging_listener(daemonizing=False):
|
|||
# We're in the MainProcess and we're not daemonizing, return!
|
||||
# No multiprocessing logging listener shutdown shall happen
|
||||
return
|
||||
|
||||
if not daemonizing:
|
||||
# Need to remove the queue handler so that it doesn't try to send
|
||||
# data over a queue that was shut down on the listener end.
|
||||
shutdown_multiprocessing_logging()
|
||||
|
||||
if __MP_LOGGING_QUEUE_PROCESS is None:
|
||||
return
|
||||
if __MP_LOGGING_QUEUE_PROCESS.is_alive():
|
||||
|
|
|
@ -261,6 +261,8 @@ class OptionParser(optparse.OptionParser, object):
|
|||
)
|
||||
)
|
||||
if self._setup_mp_logging_listener_ is True:
|
||||
# Stop logging through the queue
|
||||
log.shutdown_multiprocessing_logging()
|
||||
# Stop the logging queue listener process
|
||||
log.shutdown_multiprocessing_logging_listener(daemonizing=True)
|
||||
if isinstance(msg, six.string_types) and msg and msg[-1] != '\n':
|
||||
|
|
Loading…
Add table
Reference in a new issue