Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

multiprocessing.Pool in spawn mode breaks logging.handlers.QueueHandler configuration #121723

Closed
Assignees
picnixz
Labels
type-bugAn unexpected behavior, bug, or error
@noreentry

Description

@noreentry

Bug report

Bug description:

multiprocessing.Pool withspawn method breaks logging.handlers.QueueHandler configuration

importloggingimportlogging.configimportmultiprocessingimporttimedef_init(q):logging.config.dictConfig({'version':1,'disable_existing_loggers':True,'handlers': {'log_to_parent': {'class':'logging.handlers.QueueHandler','queue':q}},'root': {'handlers': ['log_to_parent'],'level':'DEBUG'}    })logging.getLogger().info('log from child')if__name__=='__main__':multiprocessing.set_start_method('spawn')withmultiprocessing.Manager()asmanager:# q = manager.Queue()q=multiprocessing.Queue()# listen for log messages from child processes# ...withmultiprocessing.Pool(processes=1,maxtasksperchild=1,initializer=_init,initargs=(q,))aspool:time.sleep(1)

got exception (when q = manager.Queue() or q = multiprocessing.Queue())

Process SpawnPoolWorker-2:Traceback (most recent call last):  File "/home/foo/miniconda3/envs/py312forge/lib/python3.12/logging/config.py", line 581, in configure    handler = self.configure_handler(handlers[name])              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  File "/home/foo/miniconda3/envs/py312forge/lib/python3.12/logging/config.py", line 792, in configure_handler    proxy_queue = MM().Queue()                  ^^^^  File "/home/foo/miniconda3/envs/py312forge/lib/python3.12/multiprocessing/context.py", line 57, in Manager    m.start()  File "/home/foo/miniconda3/envs/py312forge/lib/python3.12/multiprocessing/managers.py", line 562, in start    self._process.start()  File "/home/foo/miniconda3/envs/py312forge/lib/python3.12/multiprocessing/process.py", line 118, in start    assert not _current_process._config.get('daemon'), \           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError: daemonic processes are not allowed to have childrenThe above exception was the direct cause of the following exception:...

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

Labels

type-bugAn unexpected behavior, bug, or error

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp