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

[Help wanted] Vscode debugging can't mount source code #8394

Closed
zonghaishang opened this issue Sep 26, 2019 · 6 comments
Closed

[Help wanted] Vscode debugging can't mount source code #8394

zonghaishang opened this issue Sep 26, 2019 · 6 comments
Labels
question Questions that are neither investigations, bugs, nor enhancements

Comments

@zonghaishang
Copy link

zonghaishang commented Sep 26, 2019

WARNING: If you want to report crashes, leaking of sensitive information,
and/or other security issues, please consider
reporting them using appropriate channels.

Issue Template

Title: One line description

Description:
How to view the code in vscode debugging?

Compile everything in my mac,bazel build -c dbg --copt=-fno-limit-debug-info //source/exe:envoy-static

Here is my git repo: https://github.com/zonghaishang/envoy.git branch:local_develop

Here is my debug config(lanch.json):

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(lldb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/bazel-bin/source/exe/envoy-static",
            "args": ["-c", "/Users/yiji/opensource/envoy/bazel-bin/source/exe/basic-front-proxy.yaml"],
            "stopAtEntry": true,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "lldb"
        },
    ]
}

image

➜  envoy git:(local_develop) clang --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

[optional Relevant Links:]

Any extra documentation required to understand the issue.

Bug Template

Title: One line description

Description:

What issue is being seen? Describe what should be happening instead of
the bug, for example: Envoy should not crash, the expected value isn't
returned, etc.

Repro steps:

Include sample requests, environment, etc. All data and inputs
required to reproduce the bug.

Note: The Envoy_collect tool
gathers a tarball with debug logs, config and the following admin
endpoints: /stats, /clusters and /server_info. Please note if there are
privacy concerns, sanitize the data prior to sharing the tarball/pasting.

Admin and Stats Output:

Include the admin output for the following endpoints: /stats,
/clusters, /routes, /server_info. For more information, refer to the
admin endpoint documentation.

Note: If there are privacy concerns, sanitize the data prior to
sharing.

Config:

Include the config used to configure Envoy.

Logs:

Include the access logs and the Envoy logs.

Note: If there are privacy concerns, sanitize the data prior to
sharing.

Call Stack:

If the Envoy binary is crashing, a call stack is required.
Please refer to the Bazel Stack trace documentation.

@alyssawilk alyssawilk added the question Questions that are neither investigations, bugs, nor enhancements label Sep 26, 2019
@zonghaishang
Copy link
Author

basic-front-proxy.yaml file can be found in envoy/examples

@zonghaishang
Copy link
Author

@mattklein123 @alyssawilk please take a look.

@zonghaishang
Copy link
Author

zonghaishang commented Sep 27, 2019

After the failure in mac, I also encountered an error in compiling the ubuntu virtual machine(16.04.6) -:(

bazel build --verbose_failures --sandbox_debug //source/exe:envoy-static

ERROR: /home/yiji/opensource/envoy/source/exe/BUILD:120:1: C++ compilation of rule '//source/exe:terminate_handler_lib' failed (Killed): linux-sandbox failed: error executing command 
  (cd /home/yiji/.cache/bazel/_bazel_yiji/4cd4e6760b0f6e857d75e4bbc0366d2f/sandbox/linux-sandbox/85/execroot/envoy && \
  exec env - \
    PATH=/usr/local/go/bin:/home/yiji/bin:/home/yiji/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin \
    PWD=/proc/self/cwd \
    TMPDIR=/tmp \
  /home/yiji/.cache/bazel/_bazel_yiji/install/fef77c6620e2df6601c65716543927b5/_embedded_binaries/linux-sandbox -t 15 -w /home/yiji/.cache/bazel/_bazel_yiji/4cd4e6760b0f6e857d75e4bbc0366d2f/sandbox/linux-sandbox/85/execroot/envoy -w /tmp -w /dev/shm -D -- /home/yiji/.cache/bazel/_bazel_yiji/4cd4e6760b0f6e857d75e4bbc0366d2f/external/local_config_cc/extra_tools/envoy_cc_wrapper -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g '-std=c++0x' -MD -MF bazel-out/k8-dbg/bin/source/exe/_objs/terminate_handler_lib/terminate_handler.pic.d '-frandom-seed=bazel-out/k8-dbg/bin/source/exe/_objs/terminate_handler_lib/terminate_handler.pic.o' -fPIC -D__CLANG_SUPPORT_DYN_ANNOTATION__ -DFMT_HEADER_ONLY -DSPDLOG_FMT_EXTERNAL -iquote . -iquote bazel-out/k8-dbg/bin -iquote external/com_google_absl -iquote bazel-out/k8-dbg/bin/external/com_google_absl -iquote external/com_github_gabime_spdlog -iquote bazel-out/k8-dbg/bin/external/com_github_gabime_spdlog -iquote external/com_github_fmtlib_fmt -iquote bazel-out/k8-dbg/bin/external/com_github_fmtlib_fmt -Ibazel-out/k8-dbg/bin/source/exe/_virtual_includes/terminate_handler_lib -Ibazel-out/k8-dbg/bin/source/common/common/_virtual_includes/minimal_logger_lib -Ibazel-out/k8-dbg/bin/source/common/common/_virtual_includes/lock_guard_lib -Ibazel-out/k8-dbg/bin/source/common/common/_virtual_includes/thread_annotations -Ibazel-out/k8-dbg/bin/include/envoy/common/_virtual_includes/base_includes -Ibazel-out/k8-dbg/bin/source/common/common/_virtual_includes/fmt_lib -Ibazel-out/k8-dbg/bin/include/envoy/thread/_virtual_includes/thread_interface -Ibazel-out/k8-dbg/bin/source/common/common/_virtual_includes/macros -Ibazel-out/k8-dbg/bin/source/common/common/_virtual_includes/non_copyable -Ibazel-out/k8-dbg/bin/source/server/_virtual_includes/backtrace_lib -isystem external/com_github_gabime_spdlog/include -isystem bazel-out/k8-dbg/bin/external/com_github_gabime_spdlog/include -isystem external/com_github_fmtlib_fmt/include -isystem bazel-out/k8-dbg/bin/external/com_github_fmtlib_fmt/include -Wall -Wextra -Werror -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast -Wvla '-std=c++14' -ggdb3 -DTCMALLOC -DENVOY_HANDLE_SIGNALS -DENVOY_OBJECT_TRACE_ON_DUMP -DENVOY_HOT_RESTART -DENVOY_GOOGLE_GRPC -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c source/exe/terminate_handler.cc -o bazel-out/k8-dbg/bin/source/exe/_objs/terminate_handler_lib/terminate_handler.pic.o) linux-sandbox failed: error executing command 
  (cd /home/yiji/.cache/bazel/_bazel_yiji/4cd4e6760b0f6e857d75e4bbc0366d2f/sandbox/linux-sandbox/85/execroot/envoy && \
  exec env - \
    PATH=/usr/local/go/bin:/home/yiji/bin:/home/yiji/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin \
    PWD=/proc/self/cwd \
    TMPDIR=/tmp \
  /home/yiji/.cache/bazel/_bazel_yiji/install/fef77c6620e2df6601c65716543927b5/_embedded_binaries/linux-sandbox -t 15 -w /home/yiji/.cache/bazel/_bazel_yiji/4cd4e6760b0f6e857d75e4bbc0366d2f/sandbox/linux-sandbox/85/execroot/envoy -w /tmp -w /dev/shm -D -- /home/yiji/.cache/bazel/_bazel_yiji/4cd4e6760b0f6e857d75e4bbc0366d2f/external/local_config_cc/extra_tools/envoy_cc_wrapper -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g '-std=c++0x' -MD -MF bazel-out/k8-dbg/bin/source/exe/_objs/terminate_handler_lib/terminate_handler.pic.d '-frandom-seed=bazel-out/k8-dbg/bin/source/exe/_objs/terminate_handler_lib/terminate_handler.pic.o' -fPIC -D__CLANG_SUPPORT_DYN_ANNOTATION__ -DFMT_HEADER_ONLY -DSPDLOG_FMT_EXTERNAL -iquote . -iquote bazel-out/k8-dbg/bin -iquote external/com_google_absl -iquote bazel-out/k8-dbg/bin/external/com_google_absl -iquote external/com_github_gabime_spdlog -iquote bazel-out/k8-dbg/bin/external/com_github_gabime_spdlog -iquote external/com_github_fmtlib_fmt -iquote bazel-out/k8-dbg/bin/external/com_github_fmtlib_fmt -Ibazel-out/k8-dbg/bin/source/exe/_virtual_includes/terminate_handler_lib -Ibazel-out/k8-dbg/bin/source/common/common/_virtual_includes/minimal_logger_lib -Ibazel-out/k8-dbg/bin/source/common/common/_virtual_includes/lock_guard_lib -Ibazel-out/k8-dbg/bin/source/common/common/_virtual_includes/thread_annotations -Ibazel-out/k8-dbg/bin/include/envoy/common/_virtual_includes/base_includes -Ibazel-out/k8-dbg/bin/source/common/common/_virtual_includes/fmt_lib -Ibazel-out/k8-dbg/bin/include/envoy/thread/_virtual_includes/thread_interface -Ibazel-out/k8-dbg/bin/source/common/common/_virtual_includes/macros -Ibazel-out/k8-dbg/bin/source/common/common/_virtual_includes/non_copyable -Ibazel-out/k8-dbg/bin/source/server/_virtual_includes/backtrace_lib -isystem external/com_github_gabime_spdlog/include -isystem bazel-out/k8-dbg/bin/external/com_github_gabime_spdlog/include -isystem external/com_github_fmtlib_fmt/include -isystem bazel-out/k8-dbg/bin/external/com_github_fmtlib_fmt/include -Wall -Wextra -Werror -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast -Wvla '-std=c++14' -ggdb3 -DTCMALLOC -DENVOY_HANDLE_SIGNALS -DENVOY_OBJECT_TRACE_ON_DUMP -DENVOY_HOT_RESTART -DENVOY_GOOGLE_GRPC -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c source/exe/terminate_handler.cc -o bazel-out/k8-dbg/bin/source/exe/_objs/terminate_handler_lib/terminate_handler.pic.o)
src/main/tools/linux-sandbox.cc:154: linux-sandbox-pid1 has PID 3633
src/main/tools/linux-sandbox-pid1.cc:175: working dir: /home/yiji/.cache/bazel/_bazel_yiji/4cd4e6760b0f6e857d75e4bbc0366d2f/sandbox/linux-sandbox/85/execroot/envoy
src/main/tools/linux-sandbox-pid1.cc:194: writable: /home/yiji/.cache/bazel/_bazel_yiji/4cd4e6760b0f6e857d75e4bbc0366d2f/sandbox/linux-sandbox/85/execroot/envoy
src/main/tools/linux-sandbox-pid1.cc:194: writable: /tmp
src/main/tools/linux-sandbox-pid1.cc:194: writable: /dev/shm
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /dev
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /dev/pts
src/main/tools/linux-sandbox-pid1.cc:265: remount rw: /dev/shm
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /dev/hugepages
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /dev/mqueue
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /run
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /run/lock
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /run/user/1000
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /run/user/1000/gvfs
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /run/vmblock-fuse
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/kernel/security
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/fs/cgroup
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/fs/cgroup/systemd
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/fs/cgroup/net_cls,net_prio
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/fs/cgroup/freezer
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/fs/cgroup/cpu,cpuacct
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/fs/cgroup/perf_event
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/fs/cgroup/rdma
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/fs/cgroup/pids
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/fs/cgroup/memory
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/fs/cgroup/hugetlb
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/fs/cgroup/blkio
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/fs/cgroup/devices
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/fs/cgroup/cpuset
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/fs/pstore
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/kernel/debug
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/kernel/config
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /sys/fs/fuse/connections
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /proc
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /proc/sys/fs/binfmt_misc
src/main/tools/linux-sandbox-pid1.cc:265: remount ro: /proc/sys/fs/binfmt_misc
src/main/tools/linux-sandbox-pid1.cc:265: remount rw: /home/yiji/.cache/bazel/_bazel_yiji/4cd4e6760b0f6e857d75e4bbc0366d2f/sandbox/linux-sandbox/85/execroot/envoy
src/main/tools/linux-sandbox-pid1.cc:265: remount rw: /home/yiji/.cache/bazel/_bazel_yiji/4cd4e6760b0f6e857d75e4bbc0366d2f/sandbox/linux-sandbox/85/execroot/envoy
src/main/tools/linux-sandbox-pid1.cc:265: remount rw: /tmp
src/main/tools/linux-sandbox-pid1.cc:265: remount rw: /dev/shm
src/main/tools/process-tools.cc:118: sigaction(32, &sa, nullptr) failed
src/main/tools/process-tools.cc:118: sigaction(33, &sa, nullptr) failed
Target //source/exe:envoy-static failed to build
INFO: Elapsed time: 62.108s, Critical Path: 14.68s
INFO: 86 processes: 86 linux-sandbox.
FAILED: Build did NOT complete successfully

g++ version:

yiji@yiji:~/opensource/envoy$ g++ --version
g++ (Ubuntu 7.4.0-1ubuntu1~16.04~ppa1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@zuercher
Copy link
Member

Debugging bazel-compiled binaries on MacOS has never worked reliably: bazelbuild/bazel#6327. This problem is not exclusive to Envoy.

For the Ubuntu build failure, C++ compilation of rule '//source/exe:terminate_handler_lib' failed (Killed) implies to me that something external to bazel killed the process. I can reliably build Envoy in an Ubuntu 16.04 VM with 8 GB of RAM. Less memory, particularly if the VM is configured for 4 or more CPU cores often results in memory allocation failures. Bazel's error messages are often cryptic in this case.

@zonghaishang
Copy link
Author

zonghaishang commented Sep 29, 2019

@zuercher
thank you for your reply.

In order to speed up the compilation, I did allocate 6 core CPUs to the virtual machine. At present, I have solved the debugging problem in the mac, as a beginner of envoy, thank you again.

I am closing this issue now.

@konste
Copy link

konste commented Jun 3, 2020

@zonghaishang How have you solved the debugging problem in the Mac?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions that are neither investigations, bugs, nor enhancements
Projects
None yet
Development

No branches or pull requests

4 participants