Skip to content

dlv dap: stop debug do not close app session #2445

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

Closed
zzjin opened this issue Apr 21, 2021 · 8 comments
Closed

dlv dap: stop debug do not close app session #2445

zzjin opened this issue Apr 21, 2021 · 8 comments

Comments

@zzjin
Copy link

zzjin commented Apr 21, 2021

dlv-dap version

Delve Debugger
Version: 1.6.0
Build: $Id: 8cc9751909843dd55a46e8ea2a561544f70db34d $

go version

go version go1.16.3 linux/amd64

When change vscode to use dlv-dap start debugging one web project works fine,but click stop button dlv-dap stopped but web app session do not killed at all.

prevs dlv works fine.

PS: Its'a simple gin web api service.

@aarzilli
Copy link
Member

cc @polinasok @hyangah @suzmue I think this is because of asynchronous requests.

@polinasok
Copy link
Collaborator

polinasok commented Apr 25, 2021

@zzjin Thank you for giving dlv-dap a try! Please keep your feedback coming and stay tuned as we work on improving it!
We have some info on what is currently missing here and reporting issues here.

There are could be a couple of reasons why your app might outlive your debug session.

  1. You attached to the process for debugging. Then when you stop the session, the target does not get killed.
    Vscode is about to release a new feature, where you can toggle this behavior with an ALT key.

  2. Your stop request is made while the session is running.
    This is a temporary limitation of dlv-dap, and we are currently working on fixing this (service/dap: support running requests asynchronously #2423). In short, at this point dlv-dap is unable to respond to any requests (pause, set breakpoint, disconnect, restart) while the session is running (after continue, step, call, etc). If you want clean shutdown, you need to request it when the session is stopped. Otherwise, vscode will issue a request to dlv-dap, but then time out waiting for it to shut itself down. At that point, the go extension is supposed to force-kill dlv-dap. If that works as intended, it should take down any launched target as well (but not attached). A recent version of the extension should log information about killing dlv-dap to Go Debug channel. You can also check if this did not work with "pgrep dlv-dap". Please note that this only applies if dlv-dap was started by the extension and not externally by you.

It always helps to make sure that you have the most recent version of the Go extension (we release as often as once a week). You can even check Go Nightly to try out the latest features.

If you want a more detailed analysis of your issue, please also include the following in your report:

  • go version -m /path/to/dlv-dap - this gives us a timestamp of your dlv-dap build as your extension is supposed to be prompting you to keep updating it to the head of the delve tree (as opposed to the stable release of dlv used otherwise)
  • version of your Go extension
  • your launch.json configuration, so we know how you launched your session (via launch, attach or connecting to host/port)
  • steps to reproduce (so we know if the behavior was observed while running or at a stop, etc)
  • logs obtained with "logOutput":"debugger,dap" to give us even more detailed info of what exactly happened in your session

@zzjin
Copy link
Author

zzjin commented Apr 26, 2021

Hi, thanks for point this,update version info here:

go version -m /path/to/dlv-dap

/home/workspace/go/bin/dlv-dap: go1.16.3
        path    github.com/go-delve/delve/cmd/dlv
        mod     github.com/go-delve/delve       v1.6.1-0.20210423131738-ee5729e107e6    h1:sZp63xpPs04BXKeFuIQKIBcS9SB8WCGlH/q/MEeijGM=
        dep     github.com/cosiner/argv v0.1.0  h1:BVDiEL32lwHukgJKP87btEPenzrrHUjajs/8yzaqcXg=
        dep     github.com/cpuguy83/go-md2man   v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=
        dep     github.com/google/go-dap        v0.4.0  h1:bWSjcM9zp/jEFD4YbWERcHSed8vHbEdk0rmTvqgXDAs=
        dep     github.com/hashicorp/golang-lru v0.5.4  h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
        dep     github.com/mattn/go-isatty      v0.0.3  h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI=
        dep     github.com/peterh/liner v0.0.0-20170317030525-88609521dc4b      h1:8uaXtUkxiy+T/zdLWuxa/PG4so0TPZDZfafFNNSaptE=
        dep     github.com/russross/blackfriday v1.5.2  h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
        dep     github.com/sirupsen/logrus      v1.6.0  h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
        dep     github.com/spf13/cobra  v0.0.0-20170417170307-b6cb39589372      h1:eRfW1vRS4th8IX2iQeyqQ8cOUNOySvAYJ0IUvTXGoYA=
        dep     github.com/spf13/pflag  v0.0.0-20170417173400-9e4c21054fa1      h1:7bozMfSdo41n2NOc0GsVTTVUiA+Ncaj6pXNpm4UHKys=
        dep     go.starlark.net v0.0.0-20200821142938-949cc6f4b097      h1:YiRMXXgG+Pg26t1fjq+iAjaauKWMC9cmGFrtOEuwDDg=
        dep     golang.org/x/arch       v0.0.0-20190927153633-4e8777c89be4      h1:QlVATYS7JBoZMVaf+cNjb90WD/beKVHnIxFKT4QaHVI=
        dep     golang.org/x/sys        v0.0.0-20200625212154-ddb9806d33ae      h1:Ih9Yo4hSPImZOpfGuA4bR/ORKTAbhZo2AbWNRCnevdo=
        dep     gopkg.in/yaml.v2        v2.2.1  h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=

vscode & vscode go extension version

Version: 1.56.0-insider (user setup)
Commit: 0310f02dc5d834bb3a7cc421ea5374aec8d011f1
Date: 2021-04-23T05:13:46.805Z
Electron: 12.0.4
Chrome: 89.0.4389.114
Node.js: 14.16.0
V8: 8.9.255.24-electron.0
OS: Windows_NT x64 10.0.21364

go 0.24.2

note: I do not attach process but always let dlv-dap start it, here is lanch.json contents:

{
	"version": "0.2.0",
	"configurations": [
		{
			"name": "DebugGin",
			"type": "go",
			"request": "launch",
			"mode": "auto",
			"program": "${workspaceFolder}",
			"env": {
				"CGO_CFLAGS_ALLOW": "-Xpreprocessor"
			},
			"buildFlags": "-tags='jsoniter nomsgpack'",
			"showLog": true,
			"logOutput": "dap",
		}
	]
}

steps to reproduce

  1. click Start Debugging to start debug. (fine)
Running: /home/wordspace/go/bin/dlv-dap dap --listen=127.0.0.1:45585 --log=true --log-output=dap
DAP server listening at: 127.0.0.1:45585
2021-04-26T11:36:49+08:00 debug layer=dap DAP server pid = 13534
2021-04-26T11:36:49+08:00 debug layer=dap [<- from client]{"seq":1,"type":"request","command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code - Insiders","adapterID":"go","locale":"en-us","linesStartAt1":true,"columnsStartAt1":true,"pathFormat":"path","supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"supportsProgressReporting":true}}
2021-04-26T11:36:49+08:00 debug layer=dap [-> to client]{"seq":0,"type":"response","request_seq":1,"success":true,"command":"initialize","body":{"supportsConfigurationDoneRequest":true,"supportsConditionalBreakpoints":true,"supportTerminateDebuggee":true,"supportsDelayedStackTraceLoading":true}}
2021-04-26T11:36:49+08:00 debug layer=dap [<- from client]{"seq":2,"type":"request","command":"launch","arguments":{"__configurationTarget":5,"__sessionId":"39beab07-6a28-44ce-a2eb-b91606c009f1","apiVersion":2,"buildFlags":"-tags='jsoniter nomsgpack'","debugAdapter":"dlv-dap","dlvLoadConfig":{"followPointers":true,"maxArrayValues":64,"maxStringLen":512,"maxStructFields":-1,"maxVariableRecurse":1},"dlvToolPath":"/home/wordspace/go/bin/dlv-dap","env":{"APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL":"true","CGO_CFLAGS_ALLOW":"-Xpreprocessor","DISPLAY":":0","GEM_HOME":"/home/wordspace/.rvm/gems/ruby-3.0.0","GEM_PATH":"/home/wordspace/.rvm/gems/ruby-3.0.0:/home/wordspace/.rvm/gems/ruby-3.0.0@global","GOMODCACHE":"/home/wordspace/go/pkg/mod","GOPATH":"/home/wordspace/go","GOPROXY":"https://goproxy.cn,direct","HOME":"/home/wordspace","HOSTTYPE":"x86_64","IRBRC":"/home/wordspace/.rvm/rubies/ruby-3.0.0/.irbrc","LANG":"C.UTF-8","LESS":"-R","LOGNAME":"wordspace","LSCOLORS":"Gxfxcxdxbxegedabagacad","LS_COLORS":"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:","MY_RUBY_HOME":"/home/wordspace/.rvm/rubies/ruby-3.0.0","NAME":"DESKTOP-K952R7T","NVM_BIN":"/home/wordspace/.nvm/versions/node/v15.10.0/bin","NVM_CD_FLAGS":"-q","NVM_DIR":"/home/wordspace/.nvm","NVM_INC":"/home/wordspace/.nvm/versions/node/v15.10.0/include/node","OLDPWD":"/mnt/c/Users/wordspace/AppData/Local/Programs/Microsoft VS Code Insiders","PAGER":"less","PATH":"/home/wordspace/.vscode-server-insiders/bin/0310f02dc5d834bb3a7cc421ea5374aec8d011f1/bin:/home/wordspace/.rvm/gems/ruby-3.0.0/bin:/home/wordspace/.rvm/gems/ruby-3.0.0@global/bin:/home/wordspace/.rvm/rubies/ruby-3.0.0/bin:/home/wordspace/.nvm/versions/node/v15.10.0/bin:/home/wordspace/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit/:/mnt/c/Users/wordspace/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/wordspace/AppData/Local/Programs/Microsoft VS Code Insiders/bin:/mnt/c/Users/wordspace/libs/ffmpeg/bin:/mnt/c/Users/wordspace/libs/vips/bin:/usr/local/go/bin:/home/wordspace/go/bin:/home/wordspace/.rvm/bin","PULSE_SERVER":"/mnt/wslg/PulseServer","PWD":"/mnt/c/Users/wordspace/AppData/Local/Programs/Microsoft VS Code Insiders","RUBY_VERSION":"ruby-3.0.0","RUSTUP_DIST_SERVER":"https://mirrors.tuna.tsinghua.edu.cn/rustup","SHELL":"/usr/bin/zsh","SHLVL":"0","TERM":"xterm-256color","USER":"wordspace","VSCODE_AGENT_FOLDER":"/home/wordspace/.vscode-server-insiders","VSCODE_AMD_ENTRYPOINT":"vs/server/remoteExtensionHostProcess","VSCODE_CWD":"/mnt/c/Users/wordspace/AppData/Local/Programs/Microsoft VS Code Insiders","VSCODE_EXTHOST_WILL_SEND_SOCKET":"true","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_INJECT_NODE_MODULE_LOOKUP_PATH":"/home/wordspace/.vscode-server-insiders/bin/0310f02dc5d834bb3a7cc421ea5374aec8d011f1/remote/node_modules","VSCODE_IPC_HOOK_CLI":"/mnt/wslg/runtime-dir/vscode-ipc-a29052d8-e81e-4135-9c8b-dfc140cec939.sock","VSCODE_LOG_NATIVE":"false","VSCODE_LOG_STACK":"false","VSCODE_NLS_CONFIG":"{\"locale\":\"en\",\"availableLanguages\":{}}","VSCODE_PIPE_LOGGING":"true","VSCODE_VERBOSE_LOGGING":"true","VSCODE_WSL_EXT_LOCATION":"/mnt/c/Users/wordspace/.vscode-insiders/extensions/ms-vscode-remote.remote-wsl-0.56.1","WAYLAND_DISPLAY":"wayland-0","WSLENV":"VSCODE_WSL_EXT_LOCATION/up","WSL_DISTRO_NAME":"Ubuntu-20.04","WSL_INTEROP":"/run/WSL/11_interop","XDG_RUNTIME_DIR":"/mnt/wslg/runtime-dir","ZSH":"/home/wordspace/.oh-my-zsh","_":"/home/wordspace/.vscode-server-insiders/bin/0310f02dc5d834bb3a7cc421ea5374aec8d011f1/node","rvm_bin_path":"/home/wordspace/.rvm/bin","rvm_loaded_flag":"1","rvm_path":"/home/wordspace/.rvm","rvm_prefix":"/home/wordspace","rvm_stored_umask":"022","rvm_user_install_flag":"1","rvm_version":"1.29.12 (latest)"},"logOutput":"dap","mode":"debug","name":"DebugGin","packagePathToGoModPathMap":{"/home/wordspace/Projects/goweb":"/home/wordspace/Projects/goweb"},"program":"/home/wordspace/Projects/goweb","request":"launch","showGlobalVariables":false,"showLog":true,"type":"go"}}

... code output here ...
  1. stop debug. (dlv-dap stopped but gin process keeps running)
    nothing output to log show

@polinasok
Copy link
Collaborator

Thank you for additional details.
There are a number of initialization requests missing from the log (launch response, setting breakpoints, configurationDone, ), which is odd. There might also be additional interesting logging coming from the debugger backend, which you can enable using "debugger,dap", instead of just "dap".

How do you know that dlv-dap stopped? Does pgrep no longer show such a process?
Has any logging showed up under OUTPUT tab (next to DEBUG CONSOLE) + Go Debug dropdown?

@zzjin
Copy link
Author

zzjin commented Apr 26, 2021

after add debugger,dap,outputs is:

Running: /home/wordspace/go/bin/dlv-dap dap --listen=127.0.0.1:34473 --log=true --log-output=debugger,dap
DAP server listening at: 127.0.0.1:34473
2021-04-26T20:17:11+08:00 debug layer=dap DAP server pid = 12849
2021-04-26T20:17:11+08:00 debug layer=dap [<- from client]{"seq":1,"type":"request","command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code - Insiders","adapterID":"go","locale":"en-us","linesStartAt1":true,"columnsStartAt1":true,"pathFormat":"path","supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"supportsProgressReporting":true}}
2021-04-26T20:17:11+08:00 debug layer=dap [-> to client]{"seq":0,"type":"response","request_seq":1,"success":true,"command":"initialize","body":{"supportsConfigurationDoneRequest":true,"supportsConditionalBreakpoints":true,"supportTerminateDebuggee":true,"supportsDelayedStackTraceLoading":true}}
2021-04-26T20:17:11+08:00 debug layer=dap [<- from client]{"seq":2,"type":"request","command":"launch","arguments":{"__configurationTarget":5,"__sessionId":"91e94e2b-1f08-47b2-8fdb-d39ee4e194f6","apiVersion":2,"buildFlags":"-tags='jsoniter nomsgpack'","debugAdapter":"dlv-dap","dlvLoadConfig":{"followPointers":true,"maxArrayValues":64,"maxStringLen":512,"maxStructFields":-1,"maxVariableRecurse":1},"dlvToolPath":"/home/wordspace/go/bin/dlv-dap","env":{"APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL":"true","CGO_CFLAGS_ALLOW":"-Xpreprocessor","DISPLAY":":0","GEM_HOME":"/home/wordspace/.rvm/gems/ruby-3.0.0","GEM_PATH":"/home/wordspace/.rvm/gems/ruby-3.0.0:/home/wordspace/.rvm/gems/ruby-3.0.0@global","GOMODCACHE":"/home/wordspace/go/pkg/mod","GOPATH":"/home/wordspace/go","GOPROXY":"https://goproxy.cn,direct","HOME":"/home/workspace","HOSTTYPE":"x86_64","IRBRC":"/home/wordspace/.rvm/rubies/ruby-3.0.0/.irbrc","LANG":"C.UTF-8","LESS":"-R","LOGNAME":"workspace","LSCOLORS":"Gxfxcxdxbxegedabagacad","LS_COLORS":"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:","MY_RUBY_HOME":"/home/wordspace/.rvm/rubies/ruby-3.0.0","NAME":"DESKTOP-K952R7T","NVM_BIN":"/home/wordspace/.nvm/versions/node/v15.10.0/bin","NVM_CD_FLAGS":"-q","NVM_DIR":"/home/wordspace/.nvm","NVM_INC":"/home/wordspace/.nvm/versions/node/v15.10.0/include/node","OLDPWD":"/mnt/c/Users/workspace/AppData/Local/Programs/Microsoft VS Code Insiders","PAGER":"less","PATH":"/home/wordspace/.vscode-server-insiders/bin/633562da380f9161ea2fd783e561eed508cfbbea/bin:/home/wordspace/.rvm/gems/ruby-3.0.0/bin:/home/wordspace/.rvm/gems/ruby-3.0.0@global/bin:/home/wordspace/.rvm/rubies/ruby-3.0.0/bin:/home/wordspace/.nvm/versions/node/v15.10.0/bin:/home/wordspace/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit/:/mnt/c/Users/workspace/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/workspace/AppData/Local/Programs/Microsoft VS Code Insiders/bin:/mnt/c/Users/workspace/libs/ffmpeg/bin:/mnt/c/Users/workspace/libs/vips/bin:/usr/local/go/bin:/home/wordspace/go/bin:/home/wordspace/.rvm/bin","PULSE_SERVER":"/mnt/wslg/PulseServer","PWD":"/mnt/c/Users/workspace/AppData/Local/Programs/Microsoft VS Code Insiders","RUBY_VERSION":"ruby-3.0.0","RUSTUP_DIST_SERVER":"https://mirrors.tuna.tsinghua.edu.cn/rustup","SHELL":"/usr/bin/zsh","SHLVL":"0","TERM":"xterm-256color","USER":"workspace","VSCODE_AGENT_FOLDER":"/home/wordspace/.vscode-server-insiders","VSCODE_AMD_ENTRYPOINT":"vs/server/remoteExtensionHostProcess","VSCODE_CWD":"/mnt/c/Users/workspace/AppData/Local/Programs/Microsoft VS Code Insiders","VSCODE_EXTHOST_WILL_SEND_SOCKET":"true","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_INJECT_NODE_MODULE_LOOKUP_PATH":"/home/wordspace/.vscode-server-insiders/bin/633562da380f9161ea2fd783e561eed508cfbbea/remote/node_modules","VSCODE_IPC_HOOK_CLI":"/mnt/wslg/runtime-dir/vscode-ipc-b2bcfb01-6444-470e-9313-3f5d0ffd9a35.sock","VSCODE_LOG_NATIVE":"false","VSCODE_LOG_STACK":"false","VSCODE_NLS_CONFIG":"{\"locale\":\"en\",\"availableLanguages\":{}}","VSCODE_PIPE_LOGGING":"true","VSCODE_VERBOSE_LOGGING":"true","VSCODE_WSL_EXT_LOCATION":"/mnt/c/Users/workspace/.vscode-insiders/extensions/ms-vscode-remote.remote-wsl-0.56.1","WAYLAND_DISPLAY":"wayland-0","WSLENV":"VSCODE_WSL_EXT_LOCATION/up","WSL_DISTRO_NAME":"Ubuntu-20.04","WSL_INTEROP":"/run/WSL/11_interop","XDG_RUNTIME_DIR":"/mnt/wslg/runtime-dir","ZSH":"/home/wordspace/.oh-my-zsh","_":"/home/wordspace/.vscode-server-insiders/bin/633562da380f9161ea2fd783e561eed508cfbbea/node","rvm_bin_path":"/home/wordspace/.rvm/bin","rvm_loaded_flag":"1","rvm_path":"/home/wordspace/.rvm","rvm_prefix":"/home/workspace","rvm_stored_umask":"022","rvm_user_install_flag":"1","rvm_version":"1.29.12 (latest)"},"logOutput":"debugger,dap","mode":"debug","name":"DebugGin","packagePathToGoModPathMap":{"/home/wordspace/Projects/pro/goweb":"/home/wordspace/Projects/pro/goweb","/home/wordspace/Projects/pro/goweb/admin/middleware":"/home/wordspace/Projects/pro/goweb","/home/wordspace/Projects/pro/goweb/api/controllers/tag":"/home/wordspace/Projects/pro/goweb","/home/wordspace/Projects/pro/goweb/api/middleware":"/home/wordspace/Projects/pro/goweb","/home/wordspace/Projects/pro/goweb/api/response":"/home/wordspace/Projects/pro/goweb","/home/wordspace/Projects/pro/goweb/migrate/dbtrans":"/home/wordspace/Projects/pro/goweb","/home/wordspace/Projects/pro/goweb/models/db":"/home/wordspace/Projects/pro/goweb","/home/wordspace/Projects/pro/goweb/models/enums":"/home/wordspace/Projects/pro/goweb"},"program":"/home/wordspace/Projects/pro/goweb","request":"launch","showGlobalVariables":false,"showLog":true,"type":"go"}}

How do you know that dlv-dap stopped? Does pgrep no longer show such a process?

Click Stop red button and use ps aux | grep dlv to see there is no more debug process, but ps aux | grep debug_bin process keep running.

Has any logging showed up under OUTPUT tab (next to DEBUG CONSOLE) + Go Debug dropdown?

no more logs eleswhere.output dropdown have no filter shows Go Debug

select Go| Go Test | gopls (server) | gopls show none log text nor any info about debug.

@polinasok
Copy link
Collaborator

polinasok commented Apr 28, 2021

I was under a false impression that logging changes (that would write to OUTPUT) were already in the Nightly, but looks like they are not because we haven't refreshed Nightly for a while. Sorry about the false instructions.

@hyangah has more experience with the code in the extension that kills dlv when it is unresponsive. We discussed a some point that when dlv is force-killed, the target (that its child) becomes he child of another process (extension? init?) and survives, so that's probably what you are observing. With some of the ongoing work, we will soon be able to shut things down gracefully in your particular use case, so this should stop happening. I will update this issue once the delve changes are in.

But for other cases where we still need to shut things down forcefully, we need a better approach. I am not sure what exact interrupt gets sent now, but the server should shut things down cleanly when killed with Ctrl-C (SIGINT). @hyangah Can we trigger that from the extension instead?

gopherbot pushed a commit to golang/vscode-go that referenced this issue Apr 30, 2021
dlv handles SIGINT better than SIGTERM.

And, stop using treekill. Treekill sends signal to dlv and its children
(debugee and their children, and debugserver). It doesn't look like
the debugserver on the mac doesn't seem to finish cleaning up the
target before exiting as a response of SIGINT. The target becomes a
child of the launchd and remains a zombie. Even when debugserver
could handle this gracefully, sending signals to all the children
processes may interfere with debug target's attempt to gracefully
terminate and doesn't seem like a good idea. Trust dlv's termination
handling logic instead.

Testing this beyond manual testing is hard. Instead, just check
whether the temporary binary is removed that is an indirect sign
that delve responded to the signal.

Changed DelveDAPOutputAdapter's dispose to take an optional timeout
parameter - to use it in testing.
And this CL fixes some places in goDebugFactory where null logger object
can cause to crash.

For go-delve/delve#2445
Updates #120

Change-Id: I72de903b27b12ed51079d1c21be89c41d8189d8b
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/315151
Trust: Hyang-Ah Hana Kim <[email protected]>
Trust: Suzy Mueller <[email protected]>
Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
TryBot-Result: kokoro <[email protected]>
Reviewed-by: Suzy Mueller <[email protected]>
@hyangah
Copy link
Contributor

hyangah commented May 3, 2021

The latest Nightly version contains the change that sends SIGINT instead of SIGTERM. Please try if that helps while we are waiting for the PR2423 to be merged.

FYI, the client side tracing mentioned in #2445 (comment) is available in Nightly (golang.go-nightly, not golang.go) and requires "trace": "verbose" attribute in launch.json to provide useful info.

lggomez pushed a commit to lggomez/vscode-go-1 that referenced this issue May 6, 2021
dlv handles SIGINT better than SIGTERM.

And, stop using treekill. Treekill sends signal to dlv and its children
(debugee and their children, and debugserver). It doesn't look like
the debugserver on the mac doesn't seem to finish cleaning up the
target before exiting as a response of SIGINT. The target becomes a
child of the launchd and remains a zombie. Even when debugserver
could handle this gracefully, sending signals to all the children
processes may interfere with debug target's attempt to gracefully
terminate and doesn't seem like a good idea. Trust dlv's termination
handling logic instead.

Testing this beyond manual testing is hard. Instead, just check
whether the temporary binary is removed that is an indirect sign
that delve responded to the signal.

Changed DelveDAPOutputAdapter's dispose to take an optional timeout
parameter - to use it in testing.
And this CL fixes some places in goDebugFactory where null logger object
can cause to crash.

For go-delve/delve#2445
Updates golang#120

Change-Id: I72de903b27b12ed51079d1c21be89c41d8189d8b
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/315151
Trust: Hyang-Ah Hana Kim <[email protected]>
Trust: Suzy Mueller <[email protected]>
Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
TryBot-Result: kokoro <[email protected]>
Reviewed-by: Suzy Mueller <[email protected]>
@zzjin
Copy link
Author

zzjin commented May 6, 2021

Latest Nightly version do the close properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants