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

test_sys.SysModuleTest.get_allocated_blocks test precondition intermittently fails on iOS #130384

Open
freakboy3742 opened this issue Feb 20, 2025 · 0 comments
Labels
3.14 new features, bugs and security fixes OS-ios tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@freakboy3742
Copy link
Contributor

freakboy3742 commented Feb 20, 2025

Bug report

Bug description:

#130007 introduced a change to the handling of C stack limits. This change intermittently causes the test_sys.SysModuleTest.get_allocated_blocks() test to fail:

======================================================================
FAIL: test_getallocatedblocks (test.test_sys.SysModuleTest.test_getallocatedblocks)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/buildbot/Library/Developer/XCTestDevices/AFB8404B-0B3C-4CD4-862A-BBCE48F86959/data/Containers/Bundle/Application/91D9D3A2-F680-47B8-AC8F-A68603BDDACC/iOSTestbed.app/python/lib/python3.14/test/test_sys.py", line 1104, in test_getallocatedblocks
    self.assertLess(a, sys.gettotalrefcount())
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 548518 not less than 476363
----------------------------------------------------------------------

The exact values vary, but they're usually within ~500 or so.

On the test re-run, the values are different:

AssertionError: 592958 not less than 518066

(again, varying between test runs by ~500 or so).

@markshannon commented on the original PR:

sys.gettotalrefcount() is the total refcount per interpreter, but sys.getallocatedblocks() seems to be the total number of allocated blocks per process. If multiple interpreters were involved, I could see this test failing. Otherwise, it is puzzling.

This PR does no refcounting, allocation or deallocation. My guess is that this PR is exposing an already existing miscounting of references when a recursion error occurs. Just a guess though.

The problem doesn't appear to be an issue with running the test suite as a single process - Android isn't affected in CI, I can't reproduce the issue on my own macOS machine running a single-process run locally.

However, I also can't reliably reproduce the problem locally on iOS. Running the fully test suite locally, this test passes reliably.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Other

Linked PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.14 new features, bugs and security fixes OS-ios tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants