Skip to content
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

fix for a deadlock in the logging module #41661

Closed
sprause mannequin opened this issue Mar 7, 2005 · 3 comments
Closed

fix for a deadlock in the logging module #41661

sprause mannequin opened this issue Mar 7, 2005 · 3 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@sprause
Copy link
Mannequin

sprause mannequin commented Mar 7, 2005

BPO 1158052
Nosy @vsajip
Files
  • logging_deadlock.patch
  • 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 = 'https://github.com/vsajip'
    closed_at = <Date 2005-03-13.09:59:26.000>
    created_at = <Date 2005-03-07.03:28:50.000>
    labels = ['library']
    title = 'fix for a deadlock in the logging module'
    updated_at = <Date 2005-03-13.09:59:26.000>
    user = 'https://bugs.python.org/sprause'

    bugs.python.org fields:

    activity = <Date 2005-03-13.09:59:26.000>
    actor = 'vinay.sajip'
    assignee = 'vinay.sajip'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2005-03-07.03:28:50.000>
    creator = 'sprause'
    dependencies = []
    files = ['6525']
    hgrepos = []
    issue_num = 1158052
    keywords = ['patch']
    message_count = 3.0
    messages = ['47883', '47884', '47885']
    nosy_count = 2.0
    nosy_names = ['vinay.sajip', 'sprause']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1158052'
    versions = []

    @sprause
    Copy link
    Mannequin Author

    sprause mannequin commented Mar 7, 2005

    there is a deadlock in the logging package, that can be
    triggered with a custom class importer:

    (1) create a custom class importer and put it in
    sys.meta_path (this importer must log a message via the
    logging package)
    (2) raise an exception somewhere and log it
    (3) when the formatter tries to format the exception,
    it imports the traceback module (in the formatException
    method)
    (4) this import will be redirected to the above
    installed class importer
    (5) the class importer tries to log a message
    (6) trying to acquire the lock for the new log message
    in Handler.acquire results in a deadlock

    the fix is to move the traceback import from the method
    to the module, so it gets imported when no lock is
    held. the attached patch does this

    @sprause sprause mannequin closed this as completed Mar 7, 2005
    @sprause sprause mannequin assigned vsajip Mar 7, 2005
    @sprause sprause mannequin added the stdlib Python modules in the Lib dir label Mar 7, 2005
    @sprause sprause mannequin closed this as completed Mar 7, 2005
    @sprause sprause mannequin assigned vsajip Mar 7, 2005
    @sprause sprause mannequin added the stdlib Python modules in the Lib dir label Mar 7, 2005
    @sprause
    Copy link
    Mannequin Author

    sprause mannequin commented Mar 7, 2005

    Logged In: YES
    user_id=925608

    SMTPHandler and HTTPHandler have the same problem, as they
    import modules in the emit() method...

    @vsajip
    Copy link
    Member

    vsajip commented Mar 13, 2005

    Logged In: YES
    user_id=308438

    Fix checked into CVS, thanks.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant