How do I debug MacVim crashing?
Steps to reproduce
I will be using macvim and maybe once every 2 days it will crash after hours and hours of use. Because of this time lag it's very difficult to run it in --clean mode, or to systematically eliminate plugins as sources of error.
Is there a crash log somewhere?
I looked in ~/Logs/... diagnostic reports (cant remember exact path) and there is nothing there
Expected behaviour
No crashing
Version of Vim and architecture
Latest MacVim
Environment
Latest iTerm, latest OSX, latest macvim, M2 CPU macbook pro
How MacVim was installed
brew install macvim
Logs and stack traces
Trying to learn how to even get this
Vim configuration where issue is reproducable
No response
Issue has been tested with given configuration
- [ ] by running MacVim.app from GUI macOS interface
- [ ] by running vim/gvim/etc installed by MacVim
- [ ] by running other versions of vim (e.g. /usr/bin/vim)
Issue has been tested with no configuration
- [ ] by running
mvim --clean(orgvim, supplied by MacVim distribution) - [ ] by running
vim --clean(in terminal, supplied by MacVim distribution) - [ ] by running
vim --clean(in terminal, other suppliers, e.g. /usr/bin/vim)
Other conditions
- [ ] The both Homebrew packages "vim" and "macvim" are installed
Just to clarify, is individual Vim windows crashing, or the entire MacVim app? For individual Vim, you will see the Vim window suddenly closing, but MacVim would remain open. For MacVim app crashing you should see the entire app crash.
I have really wanted to add better crash detection and throw up a dialog box informing you that Vim has crashed but never got around to doing that. Right now, when a particular Vim window has crashed, we just close it which leads to a rather jarring result unfortunately.
The logs should be located at ~/Library/Logs/DiagnosticReports. You can also use Console.app and then navigate to "Crash Reports" and then filter by "macvim".
Let me know if that works.
Its the entire macvim app. Essentially I will open mvim from iterm by pressing v which I use to load the current folder, using this bash script.
~/.zsh/bin/v
#!/bin/bash
exec mvim "$@" > /dev/null 2>&1
exit $?
This has worked perfectly for almost 10 years, but it just started crashing within the last few months, probably within 3 months, so some update in macvim started it.
When it crashes, the entire mvim window will 100% disappear. When I re-open the entire macvim app. Then go through the swp file restore process.
Heres whats in DiagnosticReports. Theres no other files except these siri ones
When I open Console.app, I went through this before and there's nothing here:
Any other ideas? :/
I don't know if it helps but im like... 70% sure its when i activate FZF with control+P. I type so fast and on autopilot i always forget the exact thing that i did to trigger it. obviously you couldnt debug from that small piece of info but i was thinking maybe crash logs for that might be stored in a different place or something
When you say you are running "latest MacVim" in the issue, which version exactly do you mean? It's always useful to provide more info than less if you think there's a regression. There are different ways to install MacVim, after all (binary release vs Homebrew vs building from source), and you can opt in to pre-release builds. You can tell by going to MacVim -> About MacVim.
Sorry, I didn't give as much info because I didnt actually have any useful other debugging information to add to my ticket so I figured it was mostly a wash (mostly was trying to figure out where to even find that 'other info'). Here is some info to help:
- Macbook pro, M2 Max, macOS 13.4 (22F66)
- Vim 9.0.1276 (MacVim r176)
- iterm 3
Build 3.5.0beta10 - Homebrew 4.0.20
I installed it via homebrew brew install macvim
mvim --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Feb 07 2023 11:35:56)
macOS version - arm64
Included patches: 1-1276
Compiled by Homebrew
Huge version with MacVim GUI. Features included (+) or not (-):
+acl +find_in_path +mouse_xterm +tcl
+arabic +float +multi_byte +termguicolors
+autocmd +folding +multi_lang +terminal
+autochdir -footer -mzscheme +terminfo
-autoservername +fork() +netbeans_intg +termresponse
+balloon_eval +fullscreen +num64 +textobjects
+balloon_eval_term +gettext +odbeditor +textprop
+browse -hangul_input +packages +timers
++builtin_terms +iconv +path_extra +title
+byte_offset +insert_expand +perl +toolbar
+channel +ipv6 +persistent_undo +transparency
+cindent +job +popupwin +user_commands
+clientserver +jumplist +postscript +vartabs
+clipboard +keymap +printer +vertsplit
+cmdline_compl +lambda +profile +vim9script
+cmdline_hist +langmap -python +viminfo
+cmdline_info +libcall +python3 +virtualedit
+comments +linebreak +quickfix +visual
+conceal +lispindent +reltime +visualextra
+cryptv +listcmds +rightleft +vreplace
+cscope +localmap +ruby +wildignore
+cursorbind +lua +scrollbind +wildmenu
+cursorshape +menu +signs +windows
+dialog_con_gui +mksession +smartindent +writebackup
+diff +modify_fname +sodium -X11
+digraphs +mouse +sound -xfontset
+dnd +mouseshape +spell +xim
-ebcdic +mouse_dec +startuptime -xpm
+emacs_tags -mouse_gpm +statusline -xsmp
+eval -mouse_jsbterm -sun_workshop -xterm_clipboard
+ex_extra +mouse_netterm +syntax -xterm_save
+extra_search +mouse_sgr +tag_binary
-farsi -mouse_sysmouse -tag_old_static
+file_in_path +mouse_urxvt -tag_any_white
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
defaults file: "$VIMRUNTIME/defaults.vim"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X -DMACOS_X_DARWIN -g -O2 -arch arm64 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang -arch arm64 -L/opt/homebrew/lib -o Vim -lm -lncurses /opt/homebrew/lib/libsodium.a -liconv /opt/homebrew/lib/libintl.a -framework AppKit -L/opt/homebrew/opt/lua/lib -llua5.4 -L/System/Library/Perl/5.30/darwin-thread-multi-2level/CORE -lperl -L/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/lib/python3.11/config-3.11-darwin -lpython3.11 -framework CoreFoundation -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -lruby.3.2 -L/opt/homebrew/Cellar/ruby/3.2.1/lib
Hmm, did you have a crash recently? If there was a crash recently it's supposed to show up in the locations I pointed out but I think they do get cleared after a while. It's also a little suspicious that your "Crash Reports" in Console.app is completely empty. Are you filtering that list or something?
Otherwise you can just go to Console.app and go to the main tab (under Devices), and then hit record, then trigger the crash (if it's reproducible).
Did you also update FZF or Ctrl-P? ARe there more info on when the crash would occur? I do know Vim could crash under some circumstances in the current build (fixed in source but not released yet) but you should still get a crash log.
Yes I believe it crashed today. Let me look again, but I am sure I'm not filtering it. I also clicked around there for some time because I thought it was odd it was blank. The search box is empty. everything on that entire area is grayed out because theres no results. if i click in search box at top right... type, enter, hit escape, it simply doesnt do anything as there are no results.
Next time it crashes I'll try to open it immediately and see if it shows up.
I wish it were easily reproduceable as I could definitely have more info. I tried for a good 30 minutes to make it happen and could not. It does happen mostly once per day or every other day, so thats really my only course of action.
Hmmm... so FZF is up to date, and i regularly update plugins with :plug Upgrade, :plug Update
I wish I had more information... I suppose my best bet is for it to happen again and quick check crash reports.