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

bug: crashes nvim (exit status 134) when trying to animate terminals #23

Closed
3 tasks done
mochaaP opened this issue Jun 15, 2023 · 7 comments · Fixed by #21
Closed
3 tasks done

bug: crashes nvim (exit status 134) when trying to animate terminals #23

mochaaP opened this issue Jun 15, 2023 · 7 comments · Fixed by #21
Labels
bug Something isn't working

Comments

@mochaaP
Copy link

mochaaP commented Jun 15, 2023

Did you check docs and existing issues?

  • I have read all the edgy.nvim docs
  • I have searched the existing issues of edgy.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

v0.10.0-dev+492-gb6d2f49b4

Operating system/version

Fedora release 39 (Rawhide)

Describe the bug

nvim will crash if the plugin attempts to animate the resize of terminals. it's a bit tough for me to isolate the exact steps to repro tho, sometimes it won't animate but sometimes it does

Steps To Reproduce

  1. <C-/> 2<C-/> 3<C-/>
  2. See crash

Expected Behavior

Either not doing the animation or without crashing nvim.

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
    "folke/edgy.nvim",
    opts = {
      bottom = {
        {
          ft = "toggleterm",
          size = { height = 0.4 },
          filter = function(buf, win)
            return vim.api.nvim_win_get_config(win).relative == ""
          end,
        },
      }
    }
  },
  {
    "akinsho/toggleterm.nvim",
    config = function(_, opts)
      require("toggleterm").setup(opts)
    end,
    ---@type ToggleTermConfig
    opts = {
      open_mapping = "<c-/>",
      autochdir = true,
    },
    cmd = "ToggleTerm",
    ---@type LazyKeys{}
    keys = {
      "<c-/>",
    },
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@mochaaP mochaaP added the bug Something isn't working label Jun 15, 2023
@mochaaP
Copy link
Author

mochaaP commented Jun 15, 2023

weirdly enough, this only causes issue on my LazyVim setup…

@folke
Copy link
Owner

folke commented Jun 15, 2023

I can't reproduce this on my setup. Are you using any terminal plugins , or other animation plugins?

@mochaaP
Copy link
Author

mochaaP commented Jun 15, 2023

I think I found the culprit.

Before nvim exits, it prints this shortly: screen_resize failed to update cursor position. After a quick grep shows the message comes from libvterm: https://github.com/neovim/deps/blob/master/src/libvterm/src/screen.c [sourcegraph]

If you interrupt the animation early? (see https://asciinema.org/a/fBTAzF6SwpvaxxAOaM4e9r9hA), it crashes.

I'm not very sure about the root cause.

@mochaaP
Copy link
Author

mochaaP commented Jun 15, 2023

Also, this does not happen when opts.animate.enabled is false.

@folke
Copy link
Owner

folke commented Jun 16, 2023

This seems related: neovim/neovim#21124

@folke
Copy link
Owner

folke commented Jun 16, 2023

I don't get the crashes in my config, but I could indeed reproduce it with the repro and opening multiple terminals next to each other.

(gdb) where
#0  0x00007fdd9e35426c in ?? () from /usr/lib/libc.so.6
#1  0x00007fdd9e304a08 in raise () from /usr/lib/libc.so.6
#2  0x00007fdd9e2ed538 in abort () from /usr/lib/libc.so.6
#3  0x000056384bf3129b in resize_buffer (screen=0x56384eae1b80, bufidx=0, new_rows=22, new_cols=1, active=true, statefields=0x7ffc031a1380)
    at /__w/neovim/neovim/.deps/build/src/libvterm/src/screen.c:665
#4  0x000056384bf319d6 in resize (new_rows=22, new_cols=1, fields=0x7ffc031a1380, user=0x56384eae1b80) at /__w/neovim/neovim/.deps/build/src/libvterm/src/screen.c:763
#5  0x000056384bf38cd1 in on_resize (rows=22, cols=1, user=0x56384eaee480) at /__w/neovim/neovim/.deps/build/src/libvterm/src/state.c:1964
#6  0x000056384bf3a281 in vterm_set_size (vt=0x56384eaedd20, rows=22, cols=1) at /__w/neovim/neovim/.deps/build/src/libvterm/src/vterm.c:125
#7  0x000056384bebb0ed in terminal_check_size (term=0x56384eafa900) at ../src/nvim/terminal.c:407
#8  0x000056384bf0071f in win_set_inner_size (wp=0x56384eb7dcc0, valid_cursor=valid_cursor@entry=true) at ../src/nvim/window.c:6676
#9  0x000056384bf00862 in win_new_width (wp=, width=) at ../src/nvim/window.c:6702
#10 0x000056384beee373 in frame_new_width (topfrp=topfrp@entry=0x56384eab9420, width=width@entry=1, leftfirst=leftfirst@entry=false, wfw=wfw@entry=false) at ../src/nvim/window.c:3675
#11 0x000056384beeef88 in frame_setwidth (curfrp=0x56384eab9420, width=1) at ../src/nvim/window.c:6090
#12 0x000056384bef00ab in win_setwidth_win (width=, wp=0x56384eb7dcc0) at ../src/nvim/window.c:6004
#13 0x000056384bcd72d4 in nvim_win_set_width (window=, width=1, err=0x7ffc031a1530) at ../src/nvim/api/window.c:213
#14 0x000056384bca366a in nlua_api_nvim_win_set_width (lstate=0x7fdd9e5dd380) at src/nvim/auto/lua_api_c_bindings.generated.c:6183
#15 0x000056384bf904d6 in lj_BC_FUNCC ()
#16 0x000056384bf7ca72 in lua_pcall (L=L@entry=0x7fdd9e5dd380, nargs=nargs@entry=1, nresults=nresults@entry=1, errfunc=errfunc@entry=-3) at lj_api.c:1116
#17 0x000056384bdb94b3 in nlua_pcall (lstate=lstate@entry=0x7fdd9e5dd380, nargs=nargs@entry=1, nresults=nresults@entry=1) at ../src/nvim/lua/executor.c:164
#18 0x000056384bdbe23e in nlua_call_ref (ref=, name=, args=..., retval=, err=0x0) at ../src/nvim/lua/executor.c:1587
#19 0x000056384bcdb0e5 in call_autocmd_callback (ac=ac@entry=0x56384e9498f0, apc=apc@entry=0x7ffc031a1ea0) at ../src/nvim/autocmd.c:1999
#20 0x000056384bcdd212 in getnextac (c=, cookie=0x7ffc031a1ea0, indent=, do_concat=) at ../src/nvim/autocmd.c:2056
#21 0x000056384bd6c116 in do_cmdline (cmdline=, fgetline=0x56384bcdd088 , cookie=0x7ffc031a1ea0, flags=7) at ../src/nvim/ex_docmd.c:505
#22 0x000056384bcdbdd3 in apply_autocmds_group (event=EVENT_BUFWINENTER, fname=0x56384ebb7eb0 "term://~/projects/edgy.nvim//692285:/usr/bin/fish;#toggleterm#3", fname_io=, 
    force=, group=group@entry=-3, buf=0x56384eb82eb0, eap=0x0, data=0x0) at ../src/nvim/autocmd.c:1787
#23 0x000056384bcdc4b7 in apply_autocmds (event=, fname=, fname_io=, force=, buf=) at ../src/nvim/autocmd.c:1460
#24 0x000056384bce3f4b in enter_buffer (buf=buf@entry=0x56384eb82eb0) at ../src/nvim/buffer.c:1671
#25 0x000056384bce43ad in set_curbuf (buf=buf@entry=0x56384eb82eb0, action=action@entry=0) at ../src/nvim/buffer.c:1594
#26 0x000056384bce452a in do_buffer (action=0, start=, dir=, count=, forceit=0) at ../src/nvim/buffer.c:1506
#27 0x000056384bcdf8e4 in goto_buffer (eap=0x7ffc031a21b0, start=1, dir=1, count=4) at ../src/nvim/buffer.c:935
#28 0x000056384bd7298c in ex_buffer (eap=0x7ffc031a21b0) at ../src/nvim/ex_docmd.c:4317
#29 0x000056384bd6a32a in execute_cmd0 (retv=retv@entry=0x7ffc031a21a4, eap=eap@entry=0x7ffc031a21b0, errormsg=errormsg@entry=0x7ffc031a21a8, preview=preview@entry=false)
    at ../src/nvim/ex_docmd.c:1634
#30 0x000056384bd6ba6b in do_one_cmd (cmdlinep=cmdlinep@entry=0x7ffc031a23f8, flags=flags@entry=7, cstack=cstack@entry=0x7ffc031a2480, fgetline=fgetline@entry=0x56384be6df4c , 
    cookie=cookie@entry=0x7ffc031a2b30) at ../src/nvim/ex_docmd.c:2293
#31 0x000056384bd6c66a in do_cmdline (cmdline=, fgetline=0x56384be6df4c , cookie=0x7ffc031a2b30, flags=7) at ../src/nvim/ex_docmd.c:592
#32 0x000056384be6e1d1 in source_using_linegetter (cookie=cookie@entry=0x7ffc031a2b30, fgetline=fgetline@entry=0x56384be6df4c , traceback_name=)
    at ../src/nvim/runtime.c:1898
#33 0x000056384be6e247 in do_source_str (cmd=, traceback_name=) at ../src/nvim/runtime.c:1947
#34 0x000056384bcd28d8 in exec_impl (channel_id=9223372036854775809, src=..., opts=opts@entry=0x7ffc031a2c40, err=err@entry=0x7ffc031a2c10) at ../src/nvim/api/vimscript.c:92
#35 0x000056384bcd2a06 in nvim_exec2 (channel_id=, src=..., opts=0x7ffc031a2c40, err=0x7ffc031a2c10) at ../src/nvim/api/vimscript.c:59
#36 0x000056384bca2211 in nlua_api_nvim_exec2 (lstate=0x7fdd9e5dd380) at src/nvim/auto/lua_api_c_bindings.generated.c:5576
#37 0x000056384bf904d6 in lj_BC_FUNCC ()
#38 0x000056384bf7ca72 in lua_pcall (L=L@entry=0x7fdd9e5dd380, nargs=nargs@entry=1, nresults=nresults@entry=0, errfunc=errfunc@entry=-3) at lj_api.c:1116
#39 0x000056384bdb94b3 in nlua_pcall (lstate=lstate@entry=0x7fdd9e5dd380, nargs=1, nresults=0) at ../src/nvim/lua/executor.c:164
#40 0x000056384bdc173e in nlua_do_ucmd (cmd=, eap=, preview=) at ../src/nvim/lua/executor.c:2239
#41 0x000056384beda68f in do_ucmd (eap=0x7ffc031a2fb0, preview=false) at ../src/nvim/usercmd.c:1642
#42 0x000056384bd6a452 in execute_cmd0 (retv=retv@entry=0x7ffc031a2fa4, eap=eap@entry=0x7ffc031a2fb0, errormsg=errormsg@entry=0x7ffc031a2fa8, preview=preview@entry=false)
    at ../src/nvim/ex_docmd.c:1626
#43 0x000056384bd6ba6b in do_one_cmd (cmdlinep=cmdlinep@entry=0x7ffc031a31f8, flags=flags@entry=3, cstack=cstack@entry=0x7ffc031a3280, fgetline=fgetline@entry=0x56384bd9bae5 , 
    cookie=cookie@entry=0x0) at ../src/nvim/ex_docmd.c:2293
#44 0x000056384bd6c66a in do_cmdline (cmdline=, fgetline=0x56384bd9bae5 , cookie=0x0, flags=3) at ../src/nvim/ex_docmd.c:592
#45 0x000056384bd2af2a in ex_execute (eap=0x7ffc031a38c0) at ../src/nvim/eval.c:7862
#46 0x000056384bd6a32a in execute_cmd0 (retv=retv@entry=0x7ffc031a38b4, eap=eap@entry=0x7ffc031a38c0, errormsg=errormsg@entry=0x7ffc031a38b8, preview=preview@entry=false)
    at ../src/nvim/ex_docmd.c:1634
#47 0x000056384bd6ba6b in do_one_cmd (cmdlinep=cmdlinep@entry=0x7ffc031a3b08, flags=flags@entry=0, cstack=cstack@entry=0x7ffc031a3b90, fgetline=fgetline@entry=0x56384bd9bae5 , 
    cookie=cookie@entry=0x0) at ../src/nvim/ex_docmd.c:2293
#48 0x000056384bd6c66a in do_cmdline (cmdline=, fgetline=0x56384bd9bae5 , cookie=0x0, flags=0) at ../src/nvim/ex_docmd.c:592
--Type  for more, q to quit, c to continue without paging--
#49 0x000056384be08f0f in nv_colon (cap=0x7ffc031a41c0) at ../src/nvim/normal.c:3244
#50 0x000056384be07e1d in normal_execute (state=0x7ffc031a4140, key=) at ../src/nvim/normal.c:1202
#51 0x000056384be9e28a in state_enter (s=0x7ffc031a4140) at ../src/nvim/state.c:99
#52 0x000056384be003b0 in normal_enter (cmdwin=, noexmode=) at ../src/nvim/normal.c:501
#53 0x000056384bc946a8 in main (argc=, argv=) at ../src/nvim/main.c:641
(gdb) stack

@folke
Copy link
Owner

folke commented Jun 16, 2023

neovim/neovim#23762

@folke folke closed this as completed in 408d053 Jun 16, 2023
mochaaP added a commit to nvimtools/config that referenced this issue Jul 31, 2023
This reverts commit ceb0f28.

Edgy still could trigger animation and crash when using terminal in some cases.
See: <folke/edgy.nvim#23>
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

Successfully merging a pull request may close this issue.

2 participants