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

Vim/NVim freeze with GoDebugStop with Telepresence V2 #3432

Open
Hoomanfr opened this issue Jul 20, 2022 · 11 comments
Open

Vim/NVim freeze with GoDebugStop with Telepresence V2 #3432

Hoomanfr opened this issue Jul 20, 2022 · 11 comments

Comments

@Hoomanfr
Copy link

Hoomanfr commented Jul 20, 2022

What did you do? (required: The issue will be closed when not provided)

I used telepresence to route proxy to my local for sake of local debugging a service hosted in k8. everything's fine till I call GoDebugStop then the entire vim/neovim freeze and I have to reopen the vim/neovim again. I'm using vim(8.1.3741) and neovim(0.4.3).
the error log is:

Error detected while processing function go#debug#Stop:
15332 line    3:
15333 E184: No such user-defined command: Last

If possible, please provide clear steps for reproducing the problem.

- Telepresence intercept <tp-srv-name> --service <k8-srv-name> --port <routing-port> --env-file=<env-file-name>
- :source <env-file-name> | GoDebugStart
- Curl a simple get endpoint in terminal
- The vim-go captures debug breakpoint successfully
- :GoDebugContinue will successfully continue and will receive result in terminal
- :GoDebugStop -> the editor will freeze!

What did you expect to happen?

  • Stop the debugger

What happened instead?

  • vim/nvim freeze

Configuration (MUST fill this out):

let g:go_snippet_case_type = 'camelcase'
let g:go_auto_type_info = 1
let g:go_debug_mappings = {
      \ '(go-debug-continue)': {'key': 'c', 'arguments': '<nowait>'},
      \ '(go-debug-next)': {'key': 'n', 'arguments': '<nowait>'},
      \ '(go-debug-step)': {'key': 's'},
      \ '(go-debug-print)': {'key': 'p'},
\}

" \ 'goroutines': 'botright 10new',
let g:go_debug_windows = {
      \ 'vars':       'leftabove 30vnew',
      \ 'stack':      'leftabove 20new',
      \ 'out':        'botright 5new',
\ }
filetype plugin indent on
map <leader>ds :GoDebugStart<cr>
map <leader>dt :GoDebugStop<cr>
map <leader>db :GoDebugBreakpoint<cr>

vim-go version:

1.26

vimrc you used to reproduce:

call plug#begin()
Plug 'morhetz/gruvbox'
Plug 'preservim/nerdtree'
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
Plug 'ctrlpvim/ctrlp.vim'
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'elzr/vim-json'
Plug 'brooth/far.vim'
Plug 'preservim/nerdcommenter'
Plug 'Xuyuanp/nerdtree-git-plugin'
"""Autocomplete Plug start
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
"""Autocomplete Plug end
Plug 'SirVer/ultisnips'
call plug#end()
set hidden
set nu
set hlsearch
"""Autocomplete start
let g:deoplete#enable_at_startup = 1
call deoplete#custom#option('omni_patterns', { 'go': '[^. *\t]\.\w*' })
"""Autocomplete end

"""Ctrlp Start
let g:ctrlp_working_path_mode = 'ra' "r: the nearest ancestor that contains one of these directories or files: .git .hg .svn .bzr - a: like c, but only if the current working directory outside of CtrlP is not a direct ancestor of the directory of the current file.
set wildignore+=*/tmp/*,*.so,*.swp,*.zip     " MacOSX/Linux
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = {
  \ 'dir':  '\v[\/]\.(git|hg|svn)$',
  \ 'file': '\v\.(exe|so|dll)$',
  \ 'link': 'some_bad_symbolic_links',
  \ }
let g:ctrlp_user_command = 'find %s -type f'        " MacOSX/Linux
let g:ctrlp_reuse_window  = 'startify'
let g:ctrlp_working_path_mode = ''
"""Ctrlp End

"""vim-go start
let g:go_snippet_case_type = 'camelcase'
let g:go_auto_type_info = 1
let g:go_debug_mappings = {
      \ '(go-debug-continue)': {'key': 'c', 'arguments': '<nowait>'},
      \ '(go-debug-next)': {'key': 'n', 'arguments': '<nowait>'},
      \ '(go-debug-step)': {'key': 's'},
      \ '(go-debug-print)': {'key': 'p'},
\}

" \ 'goroutines': 'botright 10new',
let g:go_debug_windows = {
      \ 'vars':       'leftabove 30vnew',
      \ 'stack':      'leftabove 20new',
      \ 'out':        'botright 5new',
\ }
filetype plugin indent on
map <leader>ds :GoDebugStart<cr>
map <leader>dt :GoDebugStop<cr>
map <leader>db :GoDebugBreakpoint<cr>
"""vim-go end

Vim version (first three lines from :version):

VIM - Vi IMproved 8.1 (2018 May 18, compiled Feb 01 2022 09:16:32)
Included patches: 1-2269, 3612, 3625, 3669, 3741
Modified by team+vim@tracker.debian.org

Nvim version (first three lines from :version):

NVIM v0.4.3
Build type: Release
LuaJIT 2.1.0-beta3

Go version (go version):

1.18

gopls version

v0.9.1

@bhcleek
Copy link
Collaborator

bhcleek commented Jul 20, 2022

I have two questions for you to help me better understand the situation.

  1. Should 15333 E184: No such user-defined command: Last read 15333 E184: No such user-defined command: LastModified?
  2. Did you modify the file in your editor during the debugging session?

@Hoomanfr
Copy link
Author

Hoomanfr commented Jul 20, 2022

No the log doesn't indicate LastModified, it states Last. I didn't modify any file during debugging session, I took exactly same steps explained in my report.

@bhcleek
Copy link
Collaborator

bhcleek commented Jul 20, 2022

That's odd. The only command that vim-go sends to delve that has Last in it at all is

call s:call_jsonrpc(function('s:handle_staleness_check_response', [fnamemodify(a:filename, ':p')]), 'RPCServer.LastModified')
.

Do you know what version of delve you have installed in the service you're connecting to with telepresence?

@Hoomanfr
Copy link
Author

Hoomanfr commented Jul 20, 2022

So basically what Telepresence is doing it to route traffic going to k8 to your local machine. no need to setup delve in k8 pods. all you need is to run your service locally(in my example it's localhost:8090) and run telepresence to intercept calls from k8 and route them to your local port(in my example it routes to port 8090). therefore the delve is on my local machine not in k8 and my local delve version is the following:

Delve Debugger
Version: 1.8.3

@bhcleek
Copy link
Collaborator

bhcleek commented Jul 20, 2022

I'm not quite sure what to make of this. I suspect it's related to the difficulties working with external processes in Neovim. Do you see the same problem with Vim?

@Hoomanfr
Copy link
Author

Same error with same log happens in Vim too.

@bhcleek
Copy link
Collaborator

bhcleek commented Jul 21, 2022

Do you see the problem only when telepresence is involved? I'm not able to duplicate what you're describing in a simple reproduction attempt, and I'm wondering if you could reduce the reproduction down to a simple case that that involves neither kubernetes nor telepresence and using a simple process.

@Hoomanfr
Copy link
Author

Hoomanfr commented Jul 21, 2022

Is it possible that it might caused by deoplete.nvim because it's more nvim based than vim based and vim-go is vim based more than nvim. not sure.

@bhcleek
Copy link
Collaborator

bhcleek commented Jul 21, 2022

Doubtful, but if we're going to get to the bottom of this, then simplifying to a simple reproduction will be helpful.

@Hoomanfr
Copy link
Author

Ok sounds it's related to telepresence when I debug some simple code it works and I can stop debugging.

@bhcleek
Copy link
Collaborator

bhcleek commented Jul 22, 2022

Interesting. I suspect there's a race or message buffer handling error some place in vim-go's debug.vim. 🤔

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

No branches or pull requests

2 participants