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

x86 Gentoo Refleaks 3.x: test_sys_setprofile leaked [1, 1, 1] references, sum=3 #78371

Closed
pablogsal opened this issue Jul 22, 2018 · 8 comments
Closed
Labels
3.7 (EOL) end of life 3.8 only security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@pablogsal
Copy link
Member

BPO 34190
Nosy @vstinner, @methane, @serhiy-storchaka, @jdemeyer, @1st1, @pablogsal
PRs
  • bpo-34190: Fix reference leak in call_function() #8413
  • [3.7] bpo-34190: Fix reference leak in call_function() (GH-8413) #8418
  • 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-07-23.21:46:41.392>
    created_at = <Date 2018-07-22.19:22:01.494>
    labels = ['3.7', '3.8', 'type-bug', 'tests']
    title = 'x86 Gentoo Refleaks 3.x: test_sys_setprofile leaked [1, 1, 1] references, sum=3'
    updated_at = <Date 2018-07-23.21:46:41.391>
    user = 'https://github.com/pablogsal'

    bugs.python.org fields:

    activity = <Date 2018-07-23.21:46:41.391>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-07-23.21:46:41.392>
    closer = 'vstinner'
    components = ['Tests']
    creation = <Date 2018-07-22.19:22:01.494>
    creator = 'pablogsal'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34190
    keywords = ['patch']
    message_count = 8.0
    messages = ['322162', '322163', '322196', '322198', '322218', '322232', '322266', '322267']
    nosy_count = 6.0
    nosy_names = ['vstinner', 'methane', 'serhiy.storchaka', 'jdemeyer', 'yselivanov', 'pablogsal']
    pr_nums = ['8413', '8418']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue34190'
    versions = ['Python 3.7', 'Python 3.8']

    @pablogsal
    Copy link
    Member Author

    The x86 Gentoo Refleaks 3.x report that test_sys_setprofile is potentially leaking referenecs:

    https://buildbot.python.org/all/#/builders/1/builds/292

    ----------------------------------------------------------------------
    Ran 21 tests in 0.007s
    OK
    .
    test_sys_setprofile leaked [1, 1, 1] references, sum=3
    1 test failed again:
    test_sys_setprofile
    == Tests result: FAILURE then FAILURE ==
    408 tests OK.
    10 slowest tests:

    • test_asyncio: 28 min 19 sec
    • test_concurrent_futures: 23 min 10 sec
    • test_multiprocessing_spawn: 22 min 1 sec
    • test_multiprocessing_forkserver: 11 min 24 sec
    • test_multiprocessing_fork: 8 min 35 sec
    • test_lib2to3: 6 min 39 sec
    • test_zipfile: 6 min 21 sec
    • test_decimal: 6 min 18 sec
    • test_io: 5 min 44 sec
    • test_gdb: 5 min 39 sec
      1 test failed:
      test_sys_setprofile
      8 tests skipped:
      test_devpoll test_kqueue test_msilib test_startfile
      test_winconsoleio test_winreg test_winsound test_zipfile64
      1 re-run test:
      test_sys_setprofile
      Total duration: 2 hour 10 min
      Tests result: FAILURE then FAILURE

    @pablogsal pablogsal added 3.8 only security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Jul 22, 2018
    @pablogsal
    Copy link
    Member Author

    Same error in the x86 Gentoo Refleaks 3.7 buildbot:

    https://buildbot.python.org/all/#/builders/114/builds/174

    @vstinner
    Copy link
    Member

    I'm able to reproduce the issue on master:

    vstinner@apu$ ./python -m test -R 3:3 test_sys_setprofile -m test.test_sys_setprofile.ProfileSimulatorTestCase.test_unbound_method_invalid_args
    Run tests sequentially
    0:00:00 load avg: 0.82 [1/1] test_sys_setprofile
    beginning 6 repetitions
    123456
    ......
    test_sys_setprofile leaked [1, 1, 1] references, sum=3
    test_sys_setprofile failed

    == Tests result: FAILURE ==

    1 test failed:
    test_sys_setprofile

    Total duration: 113 ms
    Tests result: FAILURE

    The test has been modified recently:

    commit 56868f9
    Author: jdemeyer <jdemeyer@cage.ugent.be>
    Date: Sat Jul 21 10:30:59 2018 +0200

    bpo-34126: Fix crashes while profiling invalid calls. (GH-8300)
    

    @jdemeyer
    Copy link
    Contributor

    Just to avoid duplicate work: I can have a look at this.

    @vstinner
    Copy link
    Member

    Ok, so it's a real bug, a reference leak, which have been introduced by:

    commit 93fac8d
    Author: INADA Naoki <methane@users.noreply.github.com>
    Date: Tue Mar 7 14:24:37 2017 +0900

    bpo-29676: fix lsprof can't profile C method call. ([GH523](https://github.com/python/cpython/pull/523))
    
    When LOAD_METHOD is used for calling C mehtod, PyMethodDescrObject
    was passed to profilefunc from 5566bbb.
    But lsprof traces only PyCFunctionObject. Additionally, there can be
    some third party extension which assumes passed arg is
    PyCFunctionObject without calling PyCFunction_Check().
    
    So make PyCFunctionObject from PyMethodDescrObject when
    tstate->c_profilefunc is set.
    

    @vstinner vstinner added the 3.7 (EOL) end of life label Jul 23, 2018
    @vstinner
    Copy link
    Member

    New changeset 147d955 by Victor Stinner (jdemeyer) in branch 'master':
    bpo-34190: Fix reference leak in call_function() (GH-8413)
    147d955

    @vstinner
    Copy link
    Member

    New changeset 25b87d3 by Victor Stinner (Miss Islington (bot)) in branch '3.7':
    bpo-34190: Fix reference leak in call_function() (GH-8413) (GH-8418)
    25b87d3

    @vstinner
    Copy link
    Member

    Thanks Jeroen Demeyer for the good and quick fix! I applied it to 3.7 and master branches.

    @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 only security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants