Skip to content

gh-157660: Refresh cached TLBC arrays after growth - #157732

Open
liuzhijie-0614 wants to merge 3 commits into
python:mainfrom
liuzhijie-0614:codex/gh-157660-refresh-tlbc-cache
Open

liuzhijie-0614 wants to merge 3 commits into
python:mainfrom
liuzhijie-0614:codex/gh-157660-refresh-tlbc-cache

Conversation

@liuzhijie-0614

@liuzhijie-0614 liuzhijie-0614 commented Sep 18, 2026

Copy link
Copy Markdown

Fix persistent Invalid tlbc_index errors when an existing thread grows a code object's TLBC array without changing tlbc_generation (#157660).

When an index exceeds the cached capacity, refresh that entry once using direct remote reads, then retain the existing bounds checks and fallback. Ordinary cache loads continue to use paged reads.

The regression test uses RemoteUnwinder.get_stack_trace() with all worker threads created before sampling. It verifies recovery with the same unwinder, correct line numbers, and both frame-cache settings.

Validated on upstream main (e2ff498), Linux x86-64, with a free-threaded debug build:

  • ./python -m test test_external_inspection --timeout=180: passed; 41 tests, 2 skipped.
  • The original issue reproducer: no bounds or other errors before growth, after growth, or with a fresh unwinder.

@python-cla-bot

python-cla-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@liuzhijie-0614

Copy link
Copy Markdown
Author

This is ready for review. The TLBC regression test passes locally, including repeated runs with frame caching enabled and disabled. The two failing CI jobs appear unrelated to this change, as noted above.

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.

1 participant