Skip to content

Free threading locking issues in listobject.c #127536

Description

@colesbury

Bug report

In #127524, @mpage suggested adding an assert to check that the list object is locked when calling ensure_shared_on_resize. This uncovers a few more locking issues.

Additionally, we may return out of the critical section without unlocking here:

Py_BEGIN_CRITICAL_SECTION(a);
Py_ssize_t n = PyList_GET_SIZE(a);
PyObject *copy = list_slice_lock_held(a, 0, n);
if (copy == NULL) {
return -1;
}
ret = list_ass_slice_lock_held(a, ilow, ihigh, copy);
Py_DECREF(copy);
Py_END_CRITICAL_SECTION();

Linked PRs

Activity

  1. changed the title [-]Locking issues in `listobject.c`[/-] [+]Free threading locking issues in `listobject.c`[/+] on Dec 2, 2024
  2. added
    3.13only security fixes
    3.14bugs and security fixes
    on Dec 2, 2024
  3. corona10 commented on Dec 3, 2024

    @corona10
    Member

    Ah.. it's my fault, I will take a look at it

  4. self-assigned this
    on Dec 3, 2024
  5. colesbury commented on Dec 3, 2024

    @colesbury
    ContributorAuthor

    Thanks @corona10. I started some work on this (but didn't finish) yesterday. Here's what I had in case it's helpful:

    colesbury@49268ba

  6. corona10 commented on Dec 3, 2024

    @corona10
    Member

    Ah in that case please go ahead

  7. added 4 commits that reference this issue on Dec 3, 2024
  8. picnixz commented on Dec 5, 2024

    @picnixz
    Member

    @colesbury Are the build bot failures possibly related to that one or not? if not, I think we can close this one.

  9. colesbury commented on Dec 5, 2024

    @colesbury
    ContributorAuthor

    I think the buildbot failures are unrelated. The other s390x 3.13 buildbots are passing. https://buildbot.python.org/#/builders/1469 is passing, but the runs slowed down (including on test_site) around the same time, but on the following commit, which makes me think some sort of network issue or problem with the machine.

  10. added a commit that references this issue on Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

3.13only security fixes3.14bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)topic-free-threadingtype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions