Skip to content

multiprocessing logger deadlocks if used with logging.handlers.QueueHandler #90321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
iamdbychkov mannequin opened this issue Dec 23, 2021 · 2 comments
Closed

multiprocessing logger deadlocks if used with logging.handlers.QueueHandler #90321

iamdbychkov mannequin opened this issue Dec 23, 2021 · 2 comments
Labels
3.9 only security fixes topic-multiprocessing

Comments

@iamdbychkov
Copy link
Mannequin

iamdbychkov mannequin commented Dec 23, 2021

BPO 46163
Nosy @iamdbychkov
Files
  • logger_deadlock.py
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2021-12-23.13:12:46.077>
    labels = ['3.9']
    title = 'multiprocessing logger deadlocks if used with logging.handlers.QueueHandler'
    updated_at = <Date 2021-12-23.13:12:46.077>
    user = 'https://github.com/iamdbychkov'

    bugs.python.org fields:

    activity = <Date 2021-12-23.13:12:46.077>
    actor = 'iamdbychkov'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = []
    creation = <Date 2021-12-23.13:12:46.077>
    creator = 'iamdbychkov'
    dependencies = []
    files = ['50513']
    hgrepos = []
    issue_num = 46163
    keywords = []
    message_count = 1.0
    messages = ['409088']
    nosy_count = 1.0
    nosy_names = ['iamdbychkov']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue46163'
    versions = ['Python 3.9']

    @iamdbychkov
    Copy link
    Mannequin Author

    iamdbychkov mannequin commented Dec 23, 2021

    Hello!
    If you use multiprocessing logger with logging.handlers.QueueHandler it will deadlock on first attempt at logging.

    First attempt will initialize queue's background thread, which uses multiprocessing logger itself which will result in something what looks like deadlock :)

    There are workarounds and I'm not sure if it can be classified as a bug, prehaps a little note in documentation about this behaviour will do?

    I've attached example script.

    @vsajip
    Copy link
    Member

    vsajip commented May 12, 2025

    Should now be fixed along with #91555 via #131812.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes topic-multiprocessing
    Projects
    Development

    No branches or pull requests

    2 participants