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

various refleaks when calling the __init__() method of an object more than once #75968

Closed
orenmn mannequin opened this issue Oct 14, 2017 · 9 comments
Closed

various refleaks when calling the __init__() method of an object more than once #75968

orenmn mannequin opened this issue Oct 14, 2017 · 9 comments
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life extension-modules C modules in the Modules dir performance Performance or resource usage

Comments

@orenmn
Copy link
Mannequin

orenmn mannequin commented Oct 14, 2017

BPO 31787
Nosy @rhettinger, @vstinner, @methane, @orenmn, @csabella, @miss-islington
PRs
  • bpo-31787: Prevent refleaks when calling __init__() more than once #3995
  • [3.7] bpo-31787: Prevent refleaks when calling __init__() more than once (GH-3995) #5657
  • [3.6] bpo-31787: Prevent refleaks when calling __init__() more than once (GH-3995) #5659
  • bpo-31787: Skip refleak check when _hashlib is not available #5660
  • [3.7] bpo-31787: Skip refleak check when _hashlib is not available (GH-5660) #5661
  • [3.6] bpo-31787: Skip refleak check when _hashlib is not available (GH-5660) #5662
  • 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 2018-02-13.13:15:49.506>
    created_at = <Date 2017-10-14.09:16:28.394>
    labels = ['extension-modules', '3.7', '3.8', 'performance']
    title = 'various refleaks when calling the __init__() method of an object more than once'
    updated_at = <Date 2018-06-20.16:00:04.996>
    user = 'https://github.com/orenmn'

    bugs.python.org fields:

    activity = <Date 2018-06-20.16:00:04.996>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-02-13.13:15:49.506>
    closer = 'methane'
    components = ['Extension Modules']
    creation = <Date 2017-10-14.09:16:28.394>
    creator = 'Oren Milman'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31787
    keywords = ['patch']
    message_count = 9.0
    messages = ['304389', '310387', '312113', '312116', '312118', '312124', '312126', '312128', '320088']
    nosy_count = 6.0
    nosy_names = ['rhettinger', 'vstinner', 'methane', 'Oren Milman', 'cheryl.sabella', 'miss-islington']
    pr_nums = ['3995', '5657', '5659', '5660', '5661', '5662']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'resource usage'
    url = 'https://bugs.python.org/issue31787'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    @orenmn
    Copy link
    Mannequin Author

    orenmn mannequin commented Oct 14, 2017

    Various init() methods don't decref (if needed) before assigning to fields
    of the object's struct (i.e. assigning to self->some_field):

    For example, _asyncio_Task___init___impl() does self->task_coro = coro;
    instead of Py_XSETREF(self->task_coro, coro);.
    Thus, the following code would result in at least one refleak:
    import _asyncio
    task = _asyncio.Task('foo')
    task.init('foo')

    I would open a PR to fix this soon.

    @orenmn orenmn mannequin added 3.7 (EOL) end of life extension-modules C modules in the Modules dir performance Performance or resource usage labels Oct 14, 2017
    @csabella
    Copy link
    Contributor

    Raymond,

    You approved this PR pending some test cases. Would you have the chance to take another look?

    Thanks!

    Oren, it looks like you'll need to rebase before this could be merged.

    @methane
    Copy link
    Member

    methane commented Feb 13, 2018

    New changeset d019bc8 by INADA Naoki (Oren Milman) in branch 'master':
    bpo-31787: Prevent refleaks when calling __init__() more than once (GH-3995)
    d019bc8

    @miss-islington
    Copy link
    Contributor

    New changeset ef20abe by Miss Islington (bot) in branch '3.7':
    bpo-31787: Prevent refleaks when calling __init__() more than once (GH-3995)
    ef20abe

    @methane
    Copy link
    Member

    methane commented Feb 13, 2018

    New changeset 4731634 by INADA Naoki in branch '3.6':
    bpo-31787: Prevent refleaks when calling __init__() more than once (GH-3995)
    4731634

    @methane methane added the 3.8 (EOL) end of life label Feb 13, 2018
    @methane methane closed this as completed Feb 13, 2018
    @methane
    Copy link
    Member

    methane commented Feb 13, 2018

    New changeset f0bc645 by INADA Naoki in branch 'master':
    bpo-31787: Skip refleak check when _hashlib is not available (GH-5660)
    f0bc645

    @miss-islington
    Copy link
    Contributor

    New changeset e81a6c8 by Miss Islington (bot) in branch '3.7':
    bpo-31787: Skip refleak check when _hashlib is not available (GH-5660)
    e81a6c8

    @miss-islington
    Copy link
    Contributor

    New changeset 5d0d0ea by Miss Islington (bot) in branch '3.6':
    bpo-31787: Skip refleak check when _hashlib is not available (GH-5660)
    5d0d0ea

    @vstinner
    Copy link
    Member

    It seems like the lzma fix is incomplete: bpo-33916, "test_lzma: test_refleaks_in_decompressor___init__() leaks 100 handles on Windows".

    @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 extension-modules C modules in the Modules dir performance Performance or resource usage
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants