Skip to content

gh-109371: Fix monitoring with instruction events set - #109385

Merged
corona10 merged 3 commits into
python:mainfrom
gaogaotiantian:monitoring-instruction-fix
Sep 18, 2023
Merged

gh-109371: Fix monitoring with instruction events set#109385
corona10 merged 3 commits into
python:mainfrom
gaogaotiantian:monitoring-instruction-fix

Conversation

@gaogaotiantian

@gaogaotiantiangaogaotiantian commented Sep 13, 2023

Copy link
Copy Markdown
Member

Two things were fixed:

  1. In initialize_tools, we need to deopt INSTRUMENTED_INSTRUCTION to get the opcode to check for event. Unfortunately as whether the current opcode is instrumented is needed in the context later, we can't do _Py_GetBaseOpcode here to reduce the seemingly redundant logic.
  2. In instrument, assertion that after deinstrumenting INSTRUMENTED_LINE and INSTRUMENTED_INSTRUCTION, the opcode would be NOT instrumented is invalid - it could still be instrumented for events like PY_RETURN.

Test cases were added for both scenarios.

@corona10corona10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with my little knowlege.

@corona10
corona10 merged commit 412f5e8 into python:mainSep 18, 2023
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @gaogaotiantian for the PR, and @corona10 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 18, 2023
…-109385)
(cherry picked from commit 412f5e8)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
@bedevere-app

Copy link
Copy Markdown

GH-109542 is a backport of this pull request to the 3.12 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.12 only security fixes label Sep 18, 2023
@bedevere-bot

Copy link
Copy Markdown

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

Hi! The buildbot s390x SLES 3.x has failed when building commit 412f5e8.

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/all/#builders/540/builds/6561) and take a look at the build logs.
  4. Check if the failure is related to this commit (412f5e8) 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/all/#builders/540/builds/6561

Failed tests:

  • test.test_asyncio.test_subprocess

Failed subtests:

  • test_subprocess_consistent_callbacks - test.test_asyncio.test_subprocess.SubprocessThreadedWatcherTests.test_subprocess_consistent_callbacks

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

==

Click to see traceback logs
Traceback (most recent call last):
File "/home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/Lib/test/test_asyncio/test_subprocess.py", line 788, in test_subprocess_consistent_callbacksself.loop.run_until_complete(main())
File "/home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/Lib/asyncio/base_events.py", line 664, in run_until_completereturn future.result()
^^^^^^^^^^^^^^^
File "/home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/Lib/test/test_asyncio/test_subprocess.py", line 780, in mainself.assertEqual(events, [
AssertionError: Lists differ: [('pi[29 chars]t'), 'pipe_connection_lost', ('pipe_data_recei[57 chars]ted'] != [('pi[29 chars]t'), ('pipe_data_received', 2, b'stderr'), 'pi[57 chars]ted']

Yhg1s pushed a commit that referenced this pull request Sep 18, 2023
…) (#109542)
gh-109371: Fix monitoring with instruction events set (gh-109385)
(cherry picked from commit 412f5e8)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
@gaogaotiantian
gaogaotiantian deleted the monitoring-instruction-fix branch September 18, 2023 17:54
csm10495 pushed a commit to csm10495/cpython that referenced this pull request Sep 28, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@gaogaotiantian@miss-islington@bedevere-bot@corona10@Yhg1s