Skip to content

gh-120158: Fix inconsistent monitoring state when setting events too frequently - #141845

Merged
colesbury merged 1 commit into
python:mainfrom
colesbury:gh-120158-fix-assertion
Nov 23, 2025
Merged

colesbury merged 1 commit into
python:mainfrom
colesbury:gh-120158-fix-assertion

Conversation

@colesbury

@colesbury colesbury commented Nov 22, 2025 •

Copy link
Copy Markdown
Contributor

If we overflowed the global version counter (i.e., after 2*24 calls to _PyMonitoring_SetEvents), we bailed out after setting global monitoring events but before instrumenting code objects, which led to assertion errors later on.

Also add a time.sleep() to test_free_threading.test_monitoring to avoid overflowing the global version counter.

If we overflowed the global version counter (i.e., after 2*24 calls to
_PyMonitoring_SetEvents), we bailed out after setting global monitoring
events but before insturmenting code objects, which led to assertion
errors later on.

Also add a time.sleep() to test_free_threading.test_monitoring to avoid
overflowing the global version counter.
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @colesbury for commit 9a7360f 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F141845%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Nov 22, 2025
@colesbury
colesbury merged commit e457d60 into python:main Nov 23, 2025
@miss-islington-app

Copy link
Copy Markdown

Thanks @colesbury for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@colesbury
colesbury deleted the gh-120158-fix-assertion branch November 23, 2025 15:07
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 23, 2025
…s too frequently (pythongh-141845)

If we overflowed the global version counter (i.e., after 2*24 calls to
`_PyMonitoring_SetEvents`), we bailed out after setting global monitoring
events but before instrumenting code objects, which led to assertion errors
later on.

Also add a `time.sleep()` to `test_free_threading.test_monitoring` to avoid
overflowing the global version counter.
(cherry picked from commit e457d60)

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

bedevere-app Bot commented Nov 23, 2025

Copy link
Copy Markdown

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

@miss-islington-app

Copy link
Copy Markdown

Sorry, @colesbury, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker e457d60daafe66534283e0f79c81517634408e57 3.13
@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Nov 23, 2025
colesbury added a commit to colesbury/cpython that referenced this pull request Nov 23, 2025
…g events too frequently (pythongh-141845)

If we overflowed the global version counter (i.e., after 2*24 calls to
`_PyMonitoring_SetEvents`), we bailed out after setting global monitoring
events but before instrumenting code objects, which led to assertion errors
later on.

Also add a `time.sleep()` to `test_free_threading.test_monitoring` to avoid
overflowing the global version counter.
(cherry picked from commit e457d60)

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

bedevere-app Bot commented Nov 23, 2025

Copy link
Copy Markdown

GH-141880 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Nov 23, 2025
colesbury added a commit that referenced this pull request Nov 23, 2025
…ts too frequently (gh-141845) (gh-141880)

If we overflowed the global version counter (i.e., after 2*24 calls to
`_PyMonitoring_SetEvents`), we bailed out after setting global monitoring
events but before instrumenting code objects, which led to assertion errors
later on.

Also add a `time.sleep()` to `test_free_threading.test_monitoring` to avoid
overflowing the global version counter.
(cherry picked from commit e457d60)
colesbury added a commit that referenced this pull request Nov 23, 2025
…ts too frequently (gh-141845) (gh-141879)

If we overflowed the global version counter (i.e., after 2*24 calls to
`_PyMonitoring_SetEvents`), we bailed out after setting global monitoring
events but before instrumenting code objects, which led to assertion errors
later on.

Also add a `time.sleep()` to `test_free_threading.test_monitoring` to avoid
overflowing the global version counter.
(cherry picked from commit e457d60)

Co-authored-by: Sam Gross <colesbury@gmail.com>
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
…s too frequently (pythongh-141845)

If we overflowed the global version counter (i.e., after 2*24 calls to
`_PyMonitoring_SetEvents`), we bailed out after setting global monitoring
events but before instrumenting code objects, which led to assertion errors
later on.

Also add a `time.sleep()` to `test_free_threading.test_monitoring` to avoid
overflowing the global version counter.
ashm-dev pushed a commit to ashm-dev/cpython that referenced this pull request Dec 8, 2025
…s too frequently (pythongh-141845)

If we overflowed the global version counter (i.e., after 2*24 calls to
`_PyMonitoring_SetEvents`), we bailed out after setting global monitoring
events but before instrumenting code objects, which led to assertion errors
later on.

Also add a `time.sleep()` to `test_free_threading.test_monitoring` to avoid
overflowing the global version counter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants