Skip to content
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

e2e: Print process IDs for debugging. #11734

Merged
merged 3 commits into from
Dec 8, 2022
Merged

Conversation

prestonvanloon
Copy link
Member

@prestonvanloon prestonvanloon commented Dec 7, 2022

What type of PR is this?

Other

What does this PR do? Why is it needed?

How to attach a debugger to an e2e subprocess. For example, it may be useful to debug and break the beacon chain process.

# Build and execute the endtoend test with -c dbg to compile with debugging symbols and --spawn_strategy=standalone to disable bazel sandboxing.
bazel test //testing/endtoend:go_default_test  --test_output=streamed --test_arg=-test.v --spawn_strategy=standalone -c dbg

When the test runs, you will see a log message like this:

    component_handler_test.go:238: This test PID: 272686 (parent=272671)
        Beacon chain nodes: [274706 274705]
        Validators: [274733 274734]
        ETH1 nodes: [274691]

This log prints the process ID's spawned by this test. A remote debugger, dlv, can attach to process 274706 as such:

dlv --listen=:2345 --headless=true --api-version=2 attach 274706

And then a remote debugger can interact with dlv on port 2345.

Which issues(s) does this PR fix?

Other notes for review

Note: I had to tackle this error message

Could not attach to pid 274706: this could be caused by a kernel security setting, try writing "0" to /proc/sys/kernel/yama/ptrace_scope 

The solution was echo 0 > /proc/sys/kernel/yama/ptrace_scope

My goland config looked like
Screenshot from 2022-12-07 13-15-27

@prestonvanloon prestonvanloon marked this pull request as ready for review December 7, 2022 21:36
@prestonvanloon prestonvanloon requested a review from a team as a code owner December 7, 2022 21:36
Copy link
Member

@nisdas nisdas left a comment

Choose a reason for hiding this comment

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

This will be great for debugging

@prylabs-bulldozer prylabs-bulldozer bot merged commit ca26181 into develop Dec 8, 2022
@delete-merged-branch delete-merged-branch bot deleted the e2e-debugging-info branch December 8, 2022 04:48
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.

2 participants