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

[3.13] gh-131988: Fix a multithreaded scaling regression #131989

Merged
merged 1 commit into from
Apr 7, 2025

Conversation

colesbury
Copy link
Contributor

@colesbury colesbury commented Apr 1, 2025

The 3.13 free threaded build immortalizes certain objects to avoid reference count contention. In gh-127114 the condition was unintentionally changed to happen when the first thread was created instead of the first non-main thread. The interp->gc.immortalize field is then cleared again during _PyGC_Init().

Change the condition so that we check if we should immortalize objects using deferred reference counting whenever a non-main thread is created.

The 3.13 free threaded build immortalizes certain objects to avoid
reference count contention. In pythongh-127114 the condition was
unintentionally changed to happen when the first thread was created
instead of the first non-main thread. The `interp->gc.immortalize` field
is then cleared again during `_PyGC_Init()`.

Change the condition so that we check if we should immortalize objects
using deferred reference counting whenever a non-main thread is created.
@colesbury colesbury requested a review from Yhg1s April 1, 2025 19:42
@colesbury colesbury added the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Apr 1, 2025
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @colesbury for commit 22349fd 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F131989%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Apr 1, 2025
@colesbury colesbury changed the title gh-131988: Fix a multithreaded scaling regression [3.13] gh-131988: Fix a multithreaded scaling regression Apr 1, 2025
@python-cla-bot
Copy link

python-cla-bot bot commented Apr 6, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@Yhg1s Yhg1s merged commit 1fcf409 into python:3.13 Apr 7, 2025
54 checks passed
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.

3 participants