Skip to content

gh-120289: Add external timer in traverse of _lsprof.Profiler #121998

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

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

gaogaotiantian
Copy link
Member

@gaogaotiantian gaogaotiantian commented Jul 19, 2024

It turned out that we did not include the external timer in tp_traverse, and the external timer could be a container that causes a ref cycle - this could lead to ref leak.

Confirmed that ./python -m test -R3:3 test_cprofile passed after the change.

@gaogaotiantian
Copy link
Member Author

@colesbury maybe you could take a quick look at this?

@gaogaotiantian
Copy link
Member Author

Thanks!

@gaogaotiantian gaogaotiantian merged commit eaf094c into python:main Jul 19, 2024
40 checks passed
@miss-islington-app
Copy link

Thanks @gaogaotiantian for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

@gaogaotiantian gaogaotiantian deleted the fix-lsprof-refleak branch July 19, 2024 03:46
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 19, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 19, 2024
@bedevere-app
Copy link

bedevere-app bot commented Jul 19, 2024

GH-122000 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jul 19, 2024
@bedevere-app
Copy link

bedevere-app bot commented Jul 19, 2024

GH-122001 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Jul 19, 2024
gaogaotiantian added a commit that referenced this pull request Jul 19, 2024
…H-121998) (#122001)

gh-120289: Add external timer in traverse of _lsprof.Profiler (GH-121998)
(cherry picked from commit eaf094c)

Co-authored-by: Tian Gao <[email protected]>
gaogaotiantian added a commit that referenced this pull request Jul 19, 2024
…H-121998) (#122000)

gh-120289: Add external timer in traverse of _lsprof.Profiler (GH-121998)
(cherry picked from commit eaf094c)

Co-authored-by: Tian Gao <[email protected]>
@bedevere-bot
Copy link

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot s390x Fedora 3.13 has failed when building commit e992cc3.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#builders/1403/builds/215) and take a look at the build logs.
  4. Check if the failure is related to this commit (e992cc3) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#builders/1403/builds/215

Failed tests:

  • test_pyrepl

Failed subtests:

  • test_inspect_keeps_globals_from_inspected_module - test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_module

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/home/dje/cpython-buildarea/3.13.edelsohn-fedora-z/build/Lib/test/test_pyrepl/test_pyrepl.py", line 995, in _run_repl_globals_test
    self.fail(f"{var}= not found in output")
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: __package__= not found in output


Traceback (most recent call last):
  File "/home/dje/cpython-buildarea/3.13.edelsohn-fedora-z/build/Lib/test/test_pyrepl/test_pyrepl.py", line 995, in _run_repl_globals_test
    self.fail(f"{var}= not found in output")
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: FOO= not found in output


Traceback (most recent call last):
  File "/home/dje/cpython-buildarea/3.13.edelsohn-fedora-z/build/Lib/test/test_pyrepl/test_pyrepl.py", line 995, in _run_repl_globals_test
    self.fail(f"{var}= not found in output")
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: __name__= not found in output


Traceback (most recent call last):
  File "/home/dje/cpython-buildarea/3.13.edelsohn-fedora-z/build/Lib/test/test_pyrepl/test_pyrepl.py", line 995, in _run_repl_globals_test
    self.fail(f"{var}= not found in output")
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: __file__= not found in output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants