Skip to content

Unit test test_incremental_gc_handles_fast_cycle_creation sometimes fails #133532

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

Open
nascheme opened this issue May 6, 2025 · 2 comments
Open
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@nascheme
Copy link
Member

nascheme commented May 6, 2025

Bug report

Bug description:

On a debug build on Linux AMD64, this fails for me:

./python -m test -uall test___all__ test_atexit test_audit test_ast test_argparse test_gc
[...]
test test_gc failed -- Traceback (most recent call last):
  File "/home/nas/src/cpython/Lib/contextlib.py", line 85, in inner
    return func(*args, **kwds)
  File "/home/nas/src/cpython/Lib/test/test_gc.py", line 1184, in test_incremental_gc_handles_fast_cycle_creation
    self.assertLess(new_objects, 27_000, f"Heap growing. Reached limit after {i} iterations")
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 27013 not less than 27000 : Heap growing. Reached limit after 6579 iterations

The exact set of tests required before test_gc seems to depend on other factors. More reliable command might be:

./python -m test -uall test___all__ test_buffer test_atexit test_audit test_bigaddrspace test_bdb test_abc test_bufio test_ast test_base64 test_annotationlib test_baseexception test__colorize test__interpreters test_asyncgen test_augassign test_bigmem test_binascii test_bz2 test_abstract_numbers test__osx_support test_c_locale_coercion test_bool test_argparse test_gc

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

@nascheme nascheme added the type-bug An unexpected behavior, bug, or error label May 6, 2025
nascheme added a commit to nascheme/cpython that referenced this issue May 6, 2025
@nascheme
Copy link
Member Author

nascheme commented May 6, 2025

There seems to be some non-linear behavior happening. Creating a few thousand extra container objects (I used empty lists) before running the test results in the following.

Initial objects Max new
23,576 17,199
33,452 22,407
43,452 26,418
63,452 32,592
103,452 39,606
183,452 46,998
343,452 53,235

A log curve seems to fit the data pretty closely.

Image

@ZeroIntensity ZeroIntensity added the tests Tests in the Lib/test dir label May 7, 2025
@markshannon
Copy link
Member

The larger the heap, the longer it takes to scan it, so there's more lag in collecting cycles. That's my guess.

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

No branches or pull requests

3 participants