Skip to content

gh-127599: Fix _Py_RefcntAdd missing calls to _Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC #127717

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 3 commits into from
Dec 15, 2024

Conversation

EdNutting
Copy link
Contributor

@EdNutting EdNutting commented Dec 7, 2024

Fixes #127599 - _Py_RefcntAdd doesn't increment ref count stats

@ghost
Copy link

ghost commented Dec 7, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Dec 7, 2024

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@picnixz picnixz requested a review from Eclips4 December 7, 2024 16:12
Copy link
Member

@Eclips4 Eclips4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks correct, thank you!
If @picnixz agrees with wording (comment on pystats.h and NEWS entry), I'll merge it.

@EdNutting
Copy link
Contributor Author

@Eclips4 Looks like this is ready to merge - thank you both!

@Eclips4 Eclips4 added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Dec 15, 2024
@Eclips4 Eclips4 merged commit ab05beb into python:main Dec 15, 2024
49 checks passed
@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 15, 2024
…NC/_Py_INCREF_IMMORTAL_STAT_INC (pythonGH-127717)

Previously, `_Py_RefcntAdd` hasn't called
`_Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC` which is incorrect.

Now it has been fixed.
(cherry picked from commit ab05beb)

Co-authored-by: Ed Nutting <[email protected]>
@miss-islington-app
Copy link

Sorry, @EdNutting and @Eclips4, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker ab05beb8cea62636bd86f6f7cf1a82d7efca7162 3.12

@bedevere-app
Copy link

bedevere-app bot commented Dec 15, 2024

GH-127963 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 Dec 15, 2024
@Eclips4
Copy link
Member

Eclips4 commented Dec 15, 2024

3.12 does not have a _Py_INCREF_IMMORTAL_STAT_INC. I do not think it is worth the effort to make it work on 3.12, so let's just backport it to a 3.13 branch.

@Eclips4 Eclips4 removed the needs backport to 3.12 only security fixes label Dec 15, 2024
@Eclips4
Copy link
Member

Eclips4 commented Dec 15, 2024

Ah, unfortunately, the same applies to branch 3.13. Though we can omit the use of _Py_INCREF_IMMORTAL_STAT_INC in 3.12 and 3.13, but honestly, I don't think it's worth the effort. I think we should treat this as a feature and only implement it in the main branch (3.14). What do you think, @picnixz, @EdNutting?

@picnixz
Copy link
Member

picnixz commented Dec 15, 2024

If the backports are not hard to do, let's backport it. I see it as a bug fix personally. But if the backports are really hard to do and prone to introducing bugs, then let's not do it and treat it as a feature.

@EdNutting
Copy link
Contributor Author

My view is this is a bug fix not a feature. I don't hold a strong view on whether that means it should be backported or not.

Given that metrics are the core of performance analysis, anyone attempting to analyse 3.12/3.13 in their deployments might end up slightly off the mark without this fix.

My team and I are working with 3.12 internally, so I'll end up developing an internal patch over the New Year anyway. I'll see how much work it is to turn that into a proper backport patch for 3.12/3.13 and let you know.

@Eclips4
Copy link
Member

Eclips4 commented Dec 15, 2024

Thank you both for sharing your thoughts.
Though, the problem with 3.12 and 3.13 is that they don't have _Py_INCREF_IMMORTAL_STAT_INC, so we need to use only _Py_INCREF_STAT_INC. If you are ok with that - please submit a backport PR's to 3.12 && 3.13. I would be happy to merge it.

srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Jan 8, 2025
…NC/_Py_INCREF_IMMORTAL_STAT_INC (python#127717)

Previously, `_Py_RefcntAdd` hasn't called 
`_Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC` which is incorrect. 

Now it has been fixed.
EdNutting added a commit to EdNutting/cpython that referenced this pull request Jan 10, 2025
…_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC (pythonGH-127717)

Previously, `_Py_RefcntAdd` hasn't called
`_Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC` which is incorrect.

Now it has been fixed.
(cherry picked from commit ab05beb)

Co-authored-by: Ed Nutting <[email protected]>
EdNutting added a commit to EdNutting/cpython that referenced this pull request Jan 10, 2025
…_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC (pythonGH-127717)

Previously, `_Py_RefcntAdd` hasn't called
`_Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC` which is incorrect.

Now it has been fixed.
(cherry picked from commit ab05beb)

Co-authored-by: Ed Nutting <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jan 10, 2025

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

EdNutting added a commit to EdNutting/cpython that referenced this pull request Jan 10, 2025
…_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC (pythonGH-127717)

Previously, `_Py_RefcntAdd` hasn't called
`_Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC` which is incorrect.

Now it has been fixed.
(cherry picked from commit ab05beb)

Co-authored-by: Ed Nutting <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jan 10, 2025

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

@EdNutting EdNutting deleted the fix-issue-127599 branch January 10, 2025 15:59
Eclips4 pushed a commit that referenced this pull request Jan 18, 2025
…INC/_Py_INCREF_IMMORTAL_STAT_INC (GH-127717) (#128712)

Previously, `_Py_RefcntAdd` hasn't called
`_Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC` which is incorrect.

Now it has been fixed.
(cherry picked from commit ab05beb)
Eclips4 pushed a commit that referenced this pull request Jan 18, 2025
…INC/_Py_INCREF_IMMORTAL_STAT_INC (GH-127717) (#128713)

Previously, `_Py_RefcntAdd` hasn't called
`_Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC` which is incorrect.

Now it has been fixed.
(cherry picked from commit ab05beb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

_Py_RefcntAdd doesn't increment ref count stats
3 participants