Skip to content

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

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

Merged
merged 3 commits into from
Sep 18, 2023

Conversation

gaogaotiantian
Copy link
Member

@gaogaotiantian gaogaotiantian commented Sep 13, 2023

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.

Copy link
Member

@corona10 corona10 left a comment

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:main Sep 18, 2023
@miss-islington
Copy link
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
@bedevere-app
Copy link

bedevere-app bot commented Sep 18, 2023

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

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Sep 18, 2023
@bedevere-bot
Copy link

⚠️⚠️⚠️ 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_callbacks
    self.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_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/Lib/test/test_asyncio/test_subprocess.py", line 780, in main
    self.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 <[email protected]>
@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 free to 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