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

I got the "stack overflow" error when I tried to press <Tab> during my writing of a markdown file. #1347

Closed
2 tasks done
nyngwang opened this issue Dec 12, 2022 · 11 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@nyngwang
Copy link

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Announcement

Minimal reproducible full config

if has('vim_starting')
  set encoding=utf-8
endif
scriptencoding utf-8

if &compatible
  set nocompatible
endif

let s:plug_dir = expand('/tmp/plugged/vim-plug')
if !filereadable(s:plug_dir .. '/plug.vim')
  execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir)
end

execute 'set runtimepath+=' . s:plug_dir
call plug#begin(s:plug_dir)
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/vim-vsnip'
Plug 'neovim/nvim-lspconfig'
call plug#end()
PlugInstall | quit

" Setup global configuration. More on configuration below.
lua << EOF
local cmp = require "cmp"
cmp.setup {
  snippet = {
    expand = function(args)
      vim.fn["vsnip#anonymous"](args.body)
    end,
  },

  mapping = {
    ['<CR>'] = cmp.mapping.confirm({ select = true })
  },

  sources = cmp.config.sources({
    { name = "nvim_lsp" },
    { name = "buffer" },
  }),
}
EOF

lua << EOF
local capabilities = require('cmp_nvim_lsp').default_capabilities()

require'lspconfig'.cssls.setup {
  capabilities = capabilities,
}
EOF

Description

I got the "stack overflow" error when I tried to press <Tab> during my writing of a markdown file.

The full message:

E5108: Error executing lua: stack overflow
stack traceback:
        [C]: in function 'nvim_get_mode'
        ...im/site/pack/packer/start/nvim-cmp/lua/cmp/utils/api.lua:7: in function 'get_mode'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/core.lua:110: in function 'on_keymap'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/core.lua:145: in function 'callback'
        ...site/pack/packer/start/nvim-cmp/lua/cmp/utils/keymap.lua:133: in function 'callback'
        ...site/pack/packer/start/nvim-cmp/lua/cmp/utils/keymap.lua:159: in function 'callback'
        ...m/site/pack/packer/start/nvim-cmp/lua/cmp/utils/misc.lua:13: in function 'fallback'
        ...te/pack/packer/start/nvim-cmp/lua/cmp/config/mapping.lua:160: in function 'on_keymap'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/core.lua:145: in function 'callback'
        ...site/pack/packer/start/nvim-cmp/lua/cmp/utils/keymap.lua:133: in function 'callback'
        ...site/pack/packer/start/nvim-cmp/lua/cmp/utils/keymap.lua:159: in function 'callback'
        ...
        ...site/pack/packer/start/nvim-cmp/lua/cmp/utils/keymap.lua:159: in function 'callback'
        ...m/site/pack/packer/start/nvim-cmp/lua/cmp/utils/misc.lua:13: in function 'fallback'
        ...te/pack/packer/start/nvim-cmp/lua/cmp/config/mapping.lua:160: in function 'on_keymap'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/core.lua:145: in function 'callback'
        ...site/pack/packer/start/nvim-cmp/lua/cmp/utils/keymap.lua:133: in function 'callback'
        ...site/pack/packer/start/nvim-cmp/lua/cmp/utils/keymap.lua:159: in function 'callback'
        ...m/site/pack/packer/start/nvim-cmp/lua/cmp/utils/misc.lua:13: in function 'fallback'
        ...te/pack/packer/start/nvim-cmp/lua/cmp/config/mapping.lua:160: in function 'on_keymap'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/core.lua:145: in function 'callback'
        ...site/pack/packer/start/nvim-cmp/lua/cmp/utils/keymap.lua:133: in function <...site/pack/packer/start/nvim-cmp/lua/cmp/utils/keymap.lua:127>
Press ENTER or type command to continue

Steps to reproduce

Create a markdown file with the following content, and try to press <Tab> at the next line of - [ ] check3:

## Manual

- sentence 1.  (quote `code`)
  - point 1.
  - point 2.
  - point 3.
- sentence 2:
  - point 1. (quote)
  - point 2.
  - point 3.
    - point 3-1.  
      point 3-2.
  - point 4.
- Addons:
  - [x] check 1.
  - [ ] check 2. (quote)
  - [ ] check3:

Expected behavior

No error on pressing tab.

Actual behavior

E5108: Error executing lua: stack overflow

Additional context

No response

@nyngwang nyngwang added the bug Something isn't working label Dec 12, 2022
@hrsh7th
Copy link
Owner

hrsh7th commented Dec 27, 2022

@nyngwang Do you reproduce the problem with your provided minimal configuration? I can't.

@hrsh7th hrsh7th closed this as completed Dec 27, 2022
@grantzvolsky
Copy link

@hrsh7th I just encountered the same issue. It occurred after editing a cuelang file over a >12-hour period. The errors are triggered by pressing <Enter> in insert mode at some locations. There is no specific configuration for *.cue files, so their editing is akin to editing a text file. The buffer got into a state in which <Enter> triggers any of the following errors, or no error, depending on the location of the cursor:

E5108: Error executing lua: stack overflow
stack traceback:
        [C]: in function 'nvim_get_mode'

E5108: Error executing lua: stack overflow
stack traceback:
        [C]: at 0x562fbded5e00
        [C]: in function 'gsub'
E5108: Error executing lua: stack overflow
stack traceback:
        [C]: in function 'format'
        vim/shared.lua: in function 'tbl_keys'

Deleting the buffer using either bd or bw didn't help. The errors stopped after restarting neovim despite editing the same file using the same configuration.

Versions:
NVIM v0.8.1
nvim-cmp 8bbaeda

@datner
Copy link

datner commented Jan 6, 2023

Please don't let this fall through, this has been plaguing me for years

@ArenM
Copy link

ArenM commented Jan 9, 2023

Is there anything I can do to help debug this? I can't reproduce it reliably until I've been working on a project for a couple days without closing neovim. Once it starts it happens every time I press the enter key in insert mode (which is mapped to cmp.mapping.confirm({select = true}) in my config).

As a workaround, I've found that using :mksession and restarting nvim will make this go away for a while. Unfortunately this makes it hard to reproduce.

@datner
Copy link

datner commented Jan 12, 2023

then maybe there is some infinite (but very slow) recursion that never resolves?
like as a result of some linked-list-like structure, where the chain gets longer forever traversal is recursive. Meaning that running long enough will result in a stack overflow?

I'm literally just guesstimating, but still

@cjayross
Copy link

cjayross commented Jun 20, 2023

@hrsh7th Why was this issue closed? It isn't a configuration issue, this is an issue with deeply nested callbacks. Reproducing this error seems to require a buffer to be written to for long periods of time.

@hrsh7th
Copy link
Owner

hrsh7th commented Jun 20, 2023

Because no one provides a reproducible configuration.

@cjayross
Copy link

Let me see if I can get one together. In the future, don't close issues for this reason. Label them as "needs reproduction" or something. Github issues are helpful for users to see what the status of problems they have are. By closing the issue you are essentially saying that the problem has been solved which isn't true in this case.

@cjayross
Copy link

I wasn't able to reproduce the problem on the latest branch.

@hrsh7th
Copy link
Owner

hrsh7th commented Jun 21, 2023

No, I will close next too.

Please read the pinned issue...

#432

@erikbloodshed
Copy link

abno ang puta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants