Skip to content

[3.13] gh-132942: Fix races in type lookup cache #133114

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
Apr 28, 2025

Conversation

nascheme
Copy link
Member

@nascheme nascheme commented Apr 28, 2025

Two races related to the type lookup cache, when used in the free-threaded build. This caused test_opcache to sometimes fail (as well as other hard to re-produce failures).

@nascheme nascheme added type-crash A hard crash of the interpreter, possibly with a core dump 3.13 bugs and security fixes topic-free-threading labels Apr 28, 2025
@nascheme nascheme requested a review from markshannon as a code owner April 28, 2025 21:43
Two races related to the type lookup cache, when used in the
free-threaded build.  This caused test_opcache to sometimes fail (as
well as other hard to re-produce failures).
@nascheme nascheme force-pushed the gh-132942-tp-lookup-race-3.13 branch from d621626 to c551898 Compare April 28, 2025 21:44
@nascheme nascheme enabled auto-merge (squash) April 28, 2025 21:55
@nascheme nascheme merged commit ca46ec8 into python:3.13 Apr 28, 2025
37 checks passed
@bedevere-bot
Copy link

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

Hi! The buildbot aarch64 Fedora Stable Clang 3.13 (tier-2) has failed when building commit ca46ec8.

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

Failed tests:

  • test_interpreters

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

==

Click to see traceback logs
Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang/build/Lib/threading.py", line 1041, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang/build/Lib/threading.py", line 992, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang/build/Lib/test/test_interpreters/test_stress.py", line 47, in run
    interp = interpreters.create()
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang/build/Lib/test/support/interpreters/__init__.py", line 76, in create
    id = _interpreters.create(reqrefs=True)
interpreters.InterpreterError: interpreter creation failed
k


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang/build/Lib/threading.py", line 1041, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang/build/Lib/threading.py", line 992, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang/build/Lib/test/test_interpreters/test_stress.py", line 30, in task
    interp = interpreters.create()
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.clang/build/Lib/test/support/interpreters/__init__.py", line 76, in create
    id = _interpreters.create(reqrefs=True)
interpreters.InterpreterError: interpreter creation failed
k

@bedevere-bot
Copy link

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

Hi! The buildbot s390x RHEL9 Refleaks 3.13 (tier-3) has failed when building commit ca46ec8.

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

Failed tests:

  • test_descr

Failed subtests:

  • test_type_lookup_mro_reference - test.test_descr.MiscTests.test_type_lookup_mro_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.13.cstratak-rhel9-s390x.refleak/build/Lib/test/test_descr.py", line 5181, in test_type_lookup_mro_reference
    self.assertEqual(X.mykey, 'from Base')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'from Base2' != 'from Base'
- from Base2
?          -
+ from Base

@bedevere-bot
Copy link

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

Hi! The buildbot AMD64 RHEL8 Refleaks 3.13 (tier-1) has failed when building commit ca46ec8.

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

Failed tests:

  • test_descr

Failed subtests:

  • test_type_lookup_mro_reference - test.test_descr.MiscTests.test_type_lookup_mro_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.13.cstratak-RHEL8-x86_64.refleak/build/Lib/test/test_descr.py", line 5181, in test_type_lookup_mro_reference
    self.assertEqual(X.mykey, 'from Base')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'from Base2' != 'from Base'
- from Base2
?          -
+ from Base

@bedevere-bot
Copy link

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

Hi! The buildbot AMD64 FreeBSD Refleaks 3.13 (tier-3) has failed when building commit ca46ec8.

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

Failed tests:

  • test_descr

Failed subtests:

  • test_type_lookup_mro_reference - test.test_descr.MiscTests.test_type_lookup_mro_reference

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

==

Click to see traceback logs
Traceback (most recent call last):
  File "/buildbot/buildarea/3.13.ware-freebsd.refleak/build/Lib/test/test_descr.py", line 5181, in test_type_lookup_mro_reference
    self.assertEqual(X.mykey, 'from Base')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'from Base2' != 'from Base'
- from Base2
?          -
+ from Base

@bedevere-bot
Copy link

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

Hi! The buildbot AMD64 Fedora Stable Refleaks 3.13 (tier-1) has failed when building commit ca46ec8.

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

Failed tests:

  • test_descr

Failed subtests:

  • test_type_lookup_mro_reference - test.test_descr.MiscTests.test_type_lookup_mro_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.13.cstratak-fedora-stable-x86_64.refleak/build/Lib/test/test_descr.py", line 5181, in test_type_lookup_mro_reference
    self.assertEqual(X.mykey, 'from Base')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'from Base2' != 'from Base'
- from Base2
?          -
+ from Base

@bedevere-bot
Copy link

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

Hi! The buildbot aarch64 Fedora Stable Refleaks 3.13 (tier-2) has failed when building commit ca46ec8.

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

Failed tests:

  • test_descr

Failed subtests:

  • test_python_calls_appear_in_the_stack_if_perf_activated - test.test_perf_profiler.TestPerfProfilerWithDwarf.test_python_calls_appear_in_the_stack_if_perf_activated
  • test_type_lookup_mro_reference - test.test_descr.MiscTests.test_type_lookup_mro_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.13.cstratak-fedora-stable-aarch64.refleak/build/Lib/test/test_descr.py", line 5181, in test_type_lookup_mro_reference
    self.assertEqual(X.mykey, 'from Base')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'from Base2' != 'from Base'
- from Base2
?          -
+ from Base


Traceback (most recent call last):
  File "/home/buildbot/buildarea/3.13.cstratak-fedora-stable-aarch64.refleak/build/Lib/test/test_perf_profiler.py", line 367, in test_python_calls_appear_in_the_stack_if_perf_activated
    self.assertEqual(stderr, "")
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^
AssertionError: 'Warning:\nProcessed 714 events and lost 3[34 chars]\n\n' != ''
- Warning:
- Processed 714 events and lost 3 chunks!
- 
- Check IO/CPU overload!
- 

@bedevere-bot
Copy link

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

Hi! The buildbot aarch64 RHEL8 Refleaks 3.13 (tier-2) has failed when building commit ca46ec8.

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

Failed tests:

  • test_descr

Failed subtests:

  • test_type_lookup_mro_reference - test.test_descr.MiscTests.test_type_lookup_mro_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.13.cstratak-RHEL8-aarch64.refleak/build/Lib/test/test_descr.py", line 5181, in test_type_lookup_mro_reference
    self.assertEqual(X.mykey, 'from Base')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'from Base2' != 'from Base'
- from Base2
?          -
+ from Base

@nascheme
Copy link
Member Author

I believe this has revealed a bug in the unit test that the MRO cache bug was hidding. See gh-133122. The quick fix would be to just disable that unit test.

@bedevere-bot
Copy link

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

Hi! The buildbot PPC64LE Fedora Stable Refleaks 3.13 (tier-2) has failed when building commit ca46ec8.

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

Failed tests:

  • test_descr

Failed subtests:

  • test_type_lookup_mro_reference - test.test_descr.MiscTests.test_type_lookup_mro_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.13.cstratak-fedora-stable-ppc64le.refleak/build/Lib/test/test_descr.py", line 5181, in test_type_lookup_mro_reference
    self.assertEqual(X.mykey, 'from Base')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'from Base2' != 'from Base'
- from Base2
?          -
+ from Base

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes topic-free-threading type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants