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

New object.__getstate__() method introduced refleaks #91406

Closed
vstinner opened this issue Apr 7, 2022 · 3 comments
Closed

New object.__getstate__() method introduced refleaks #91406

vstinner opened this issue Apr 7, 2022 · 3 comments
Labels
3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@vstinner
Copy link
Member

vstinner commented Apr 7, 2022

BPO 47250
Nosy @vstinner, @serhiy-storchaka, @corona10, @pablogsal, @brandtbucher, @erlend-aasland
PRs
  • bpo-47250: Fix refleak from object.__getstate__() #32403
  • 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 = None
    closed_at = <Date 2022-04-07.23:27:28.667>
    created_at = <Date 2022-04-07.14:56:51.910>
    labels = ['interpreter-core', '3.11']
    title = 'New object.__getstate__() method introduced refleaks'
    updated_at = <Date 2022-04-07.23:27:29.409>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2022-04-07.23:27:29.409>
    actor = 'corona10'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-04-07.23:27:28.667>
    closer = 'corona10'
    components = ['Interpreter Core']
    creation = <Date 2022-04-07.14:56:51.910>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 47250
    keywords = ['patch']
    message_count = 3.0
    messages = ['416930', '416935', '416949']
    nosy_count = 6.0
    nosy_names = ['vstinner', 'serhiy.storchaka', 'corona10', 'pablogsal', 'brandtbucher', 'erlendaasland']
    pr_nums = ['32403']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue47250'
    versions = ['Python 3.11']

    @vstinner
    Copy link
    Member Author

    vstinner commented Apr 7, 2022

    The following change introduced reference leaks:
    ---
    commit 884eba3
    Author: Serhiy Storchaka <storchaka@gmail.com>
    Date: Wed Apr 6 20:00:14 2022 +0300

    bpo-26579: Add object.__getstate__(). (GH-2821)
    
    Copying and pickling instances of subclasses of builtin types
    bytearray, set, frozenset, collections.OrderedDict, collections.deque,
    weakref.WeakSet, and datetime.tzinfo now copies and pickles instance attributes
    implemented as slots.
    

    ---

    Example of buildbot failure.

    AMD64 RHEL8 Refleaks 3.x:
    https://buildbot.python.org/all/#builders/259/builds/355

    14 tests failed:
    test_bytes test_copy test_datetime test_deque test_descr
    test_distutils test_minidom test_ordered_dict test_pickle test_set
    test_shutil test_tarfile test_typing test_weakset

    Example of leak:

    $ ./python -m test -R 3:3 test_descr -m test_issue24097
    (...)
    beginning 6 repetitions
    123456
    ......
    test_descr leaked [1, 1, 1] references, sum=3
    test_descr failed (reference leak)
    (...)

    @vstinner vstinner added 3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Apr 7, 2022
    @vstinner vstinner changed the title Add object.__getstate__() introduced a refleak Add object.__getstate__() introduced refleaks Apr 7, 2022
    @vstinner vstinner changed the title Add object.__getstate__() introduced a refleak Add object.__getstate__() introduced refleaks Apr 7, 2022
    @brandtbucher
    Copy link
    Member

    Found it. This line should be removed:

    value = PyObject_GetAttr(obj, name);

    @AlexWaygood AlexWaygood changed the title Add object.__getstate__() introduced refleaks New object.__getstate__() method introduced refleaks Apr 7, 2022
    @AlexWaygood AlexWaygood changed the title Add object.__getstate__() introduced refleaks New object.__getstate__() method introduced refleaks Apr 7, 2022
    @corona10
    Copy link
    Member

    corona10 commented Apr 7, 2022

    New changeset e2d78ba by Dong-hee Na in branch 'main':
    bpo-47250: Fix refleak from object.__getstate__() (GH-32403)
    e2d78ba

    @corona10 corona10 closed this as completed Apr 7, 2022
    @corona10 corona10 closed this as completed Apr 7, 2022
    @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.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs)
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants