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

ensure lock is released if exception is raised #42453

Closed
eblossom mannequin opened this issue Oct 6, 2005 · 2 comments
Closed

ensure lock is released if exception is raised #42453

eblossom mannequin opened this issue Oct 6, 2005 · 2 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@eblossom
Copy link
Mannequin

eblossom mannequin commented Oct 6, 2005

BPO 1314396
Nosy @brettcannon
Files
  • python.patch: patch to dist/src/Lib/threading.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 = 'https://github.com/brettcannon'
    closed_at = <Date 2005-11-23.02:22:06.000>
    created_at = <Date 2005-10-06.02:18:54.000>
    labels = ['library']
    title = 'ensure lock is released if exception is raised'
    updated_at = <Date 2005-11-23.02:22:06.000>
    user = 'https://bugs.python.org/eblossom'

    bugs.python.org fields:

    activity = <Date 2005-11-23.02:22:06.000>
    actor = 'brett.cannon'
    assignee = 'brett.cannon'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2005-10-06.02:18:54.000>
    creator = 'eblossom'
    dependencies = []
    files = ['6813']
    hgrepos = []
    issue_num = 1314396
    keywords = ['patch']
    message_count = 2.0
    messages = ['48842', '48843']
    nosy_count = 2.0
    nosy_names = ['brett.cannon', 'eblossom']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1314396'
    versions = []

    @eblossom
    Copy link
    Mannequin Author

    eblossom mannequin commented Oct 6, 2005

    If an exception (typically KeyboardInterrupt) is raised
    in Thread.join, self.__block will be left locked, and
    any later attempt to join will block forever. The bug
    is easy to trigger if you provide a timeout to join.
    This patch ensures that the lock is released.

    @eblossom eblossom mannequin closed this as completed Oct 6, 2005
    @eblossom eblossom mannequin assigned brettcannon Oct 6, 2005
    @eblossom eblossom mannequin added the stdlib Python modules in the Lib dir label Oct 6, 2005
    @eblossom eblossom mannequin closed this as completed Oct 6, 2005
    @eblossom eblossom mannequin assigned brettcannon Oct 6, 2005
    @eblossom eblossom mannequin added the stdlib Python modules in the Lib dir label Oct 6, 2005
    @brettcannon
    Copy link
    Member

    Logged In: YES
    user_id=357491

    rev. 41524 (2.5) and rev. 41525 (2.4) have the fix. I am
    really looking forward to the 'with' statement and having
    all of the locks in 'threading' support it. Then this kind
    of thing will be avoided.

    Also, so it is documented, to trigger this, do the following::

    import threading
    import time
    
    th = threading.Thread(target=lambda: time.sleep(5.0))
    th.start()
    th.join('blah')
    th.join  # Used to hang

    Thanks, Eric (tacked you on to Misc/ACKS).

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 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