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

Windows: PyThread_release_lock always fails #77497

Closed
native-api mannequin opened this issue Apr 20, 2018 · 7 comments
Closed

Windows: PyThread_release_lock always fails #77497

native-api mannequin opened this issue Apr 20, 2018 · 7 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows type-bug An unexpected behavior, bug, or error

Comments

@native-api
Copy link
Mannequin

native-api mannequin commented Apr 20, 2018

BPO 33316
Nosy @pfmoore, @tjguk, @zware, @zooba, @native-api, @miss-islington
PRs
  • bpo-33316: PyThread_release_lock always fails #6541
  • [3.7] bpo-33316: PyThread_release_lock always fails (GH-6541) #11737
  • [3.7] bpo-33316: PyThread_release_lock always fails (GH-6541) #11737
  • [3.7] bpo-33316: PyThread_release_lock always fails (GH-6541) #11737
  • 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/zooba'
    closed_at = <Date 2019-02-02.17:15:27.774>
    created_at = <Date 2018-04-20.00:18:55.782>
    labels = ['interpreter-core', '3.8', 'type-bug', '3.7', 'OS-windows']
    title = 'Windows: PyThread_release_lock always fails'
    updated_at = <Date 2019-02-02.17:15:27.774>
    user = 'https://github.com/native-api'

    bugs.python.org fields:

    activity = <Date 2019-02-02.17:15:27.774>
    actor = 'steve.dower'
    assignee = 'steve.dower'
    closed = True
    closed_date = <Date 2019-02-02.17:15:27.774>
    closer = 'steve.dower'
    components = ['Interpreter Core', 'Windows']
    creation = <Date 2018-04-20.00:18:55.782>
    creator = 'Ivan.Pozdeev'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33316
    keywords = ['patch']
    message_count = 7.0
    messages = ['315497', '315670', '315714', '316661', '317259', '334751', '334754']
    nosy_count = 6.0
    nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'steve.dower', 'Ivan.Pozdeev', 'miss-islington']
    pr_nums = ['6541', '11737', '11737', '11737']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue33316'
    versions = ['Python 3.7', 'Python 3.8']

    @native-api
    Copy link
    Mannequin Author

    native-api mannequin commented Apr 20, 2018

    In win7 x64 debug mode with thread_debug=1, every PyThread_release_lock() is accompanied with a message on stderr:

    Could not PyThread_release_lock(<id>) error: 0

    @native-api native-api mannequin added 3.7 (EOL) end of life 3.8 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows type-bug An unexpected behavior, bug, or error labels Apr 20, 2018
    @zooba
    Copy link
    Member

    zooba commented Apr 23, 2018

    Looks okay, but I wonder whether the implementation of PyMUTEX_UNLOCK should return something other than zero? What is it meant to return?

    @native-api
    Copy link
    Mannequin Author

    native-api mannequin commented Apr 24, 2018

    In all PyMUTEX_* and most PyCOND_* functions, all the underlying APIs are void. So there's no point for the functions to return anything other than as convention.

    A comment at the start of condvar.h says: "APIs generally return 0 on success and non-zero on error".
    In Python\ceval_gil.h:57, there are boilerplace checker macros for them
    (which will never fire).

    So I guess this is done for uniformity.
    Regardless, PyMUTEX_UNLOCK and PyMUTEX_LOCK at least are called both with and without checking the return value.

    So I would drop the pretense and make these fns void.

    ---

    That said, the reported error still persists after the fix.
    The code confusing about which value LeaveNonRecursiveMutex should return on success. Pushed another commit, confirmed to work now.

    @vstinner vstinner changed the title PyThread_release_lock always fails Windows: PyThread_release_lock always fails May 2, 2018
    @native-api
    Copy link
    Mannequin Author

    native-api mannequin commented May 15, 2018

    So I would drop the pretense and make these fns void.

    Scratch that. In POSIX, they are #define'd as pthread fns which do return an error code.

    So, nothing more to do here.

    @native-api
    Copy link
    Mannequin Author

    native-api mannequin commented May 22, 2018

    So, nothing more to do here.

    In case that was cryptic, it means: the PR can be acted upon, no other changes are needed.

    @zooba
    Copy link
    Member

    zooba commented Feb 2, 2019

    New changeset 05e9221 by Steve Dower (native-api) in branch 'master':
    bpo-33316: PyThread_release_lock always fails (GH-6541)
    05e9221

    @miss-islington
    Copy link
    Contributor

    New changeset c851dfc by Miss Islington (bot) in branch '3.7':
    bpo-33316: PyThread_release_lock always fails (GH-6541)
    c851dfc

    @zooba zooba closed this as completed Feb 2, 2019
    @zooba zooba self-assigned this Feb 2, 2019
    @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
    3.7 (EOL) end of life 3.8 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-windows type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants