Skip to content

Thread interrupt can leave Mutex locked in synchronize #8585

@headius

Description

@headius

After the change in #8404, a new bug was introduced.

If a thread interrupt triggers in the added pollThreadEvents call at the bottom of Mutex#lock, it might cause Mutex#synchronize to exit without releasing the lock.

This is the changed line from #8404:

thread.pollThreadEvents(context);

The lock method is called here in synchronize:

Note that this lock call occurs outside of the try on purpose; if an error is thrown before the lock is successful, we should not attempt to unlock it. But due to the changed line above, an error might occur after the lock is acquired.

The fix would be to immediately unlock if the new pollThreadEvents receives an exception-raising event (from Thread#kill or Thread#raise).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions