Skip to content

gh-134679: Fix assertion failure in QSBR #134811

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
May 27, 2025

Conversation

colesbury
Copy link
Contributor

@colesbury colesbury commented May 27, 2025

This is the same underlying bug as gh-130519. The destructor may call arbitrary code, changing the tstate->qsbr pointer and invalidating the old _qsbr_thread_state.

This is the same underlying bug as pythongh-130519. The destructor may call
arbitrary code, changing the tstate->qsbr pointer and invalidating the
old _qsbr_thread_state.
@colesbury colesbury requested a review from mpage May 27, 2025 19:00
@colesbury colesbury marked this pull request as ready for review May 27, 2025 19:00
@colesbury
Copy link
Contributor Author

Tested by running ./python -m test test_free_threading.test_dict in a loop with TSan enabled. TSan seems to help reproduce the bug, probably because it slows a lot of things down.

@colesbury colesbury merged commit a4d37f8 into python:main May 27, 2025
49 checks passed
@colesbury colesbury deleted the gh-134679-qsbr-poll branch May 27, 2025 20:21
@miss-islington-app
Copy link

Thanks @colesbury for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 27, 2025
This is the same underlying bug as pythongh-130519. The destructor may call
arbitrary code, changing the `tstate->qsbr pointer` and invalidating the
old `struct _qsbr_thread_state`.
(cherry picked from commit a4d37f8)

Co-authored-by: Sam Gross <colesbury@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented May 27, 2025

GH-134814 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label May 27, 2025
colesbury added a commit that referenced this pull request May 27, 2025
This is the same underlying bug as gh-130519. The destructor may call
arbitrary code, changing the `tstate->qsbr pointer` and invalidating the
old `struct _qsbr_thread_state`.
(cherry picked from commit a4d37f8)

Co-authored-by: Sam Gross <colesbury@gmail.com>
@bedevere-bot
Copy link

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

Hi! The buildbot AMD64 CentOS9 NoGIL Refleaks 3.x (tier-1) has failed when building commit a4d37f8.

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/1610/builds/1486) and take a look at the build logs.
  4. Check if the failure is related to this commit (a4d37f8) 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/1610/builds/1486

Failed tests:

  • test.test_concurrent_futures.test_thread_pool

Failed subtests:

  • test_free_reference - test.test_concurrent_futures.test_thread_pool.ThreadPoolExecutorTest.test_free_reference

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

==

Click to see traceback logs
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.x.itamaro-centos-aws.refleak.nogil/build/Lib/test/test_concurrent_futures/executor.py", line 220, in test_free_reference
    for _ in support.sleeping_retry(support.SHORT_TIMEOUT):
             ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.itamaro-centos-aws.refleak.nogil/build/Lib/test/support/__init__.py", line 2590, in sleeping_retry
    for _ in busy_retry(timeout, err_msg, error=error):
             ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.x.itamaro-centos-aws.refleak.nogil/build/Lib/test/support/__init__.py", line 2560, in busy_retry
    raise AssertionError(msg)
AssertionError: timeout (68.3 seconds)

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