davidhalter / jedi-vim

Using the jedi autocompletion library for VIM.
MIT License
5.27k stars 370 forks source link

jedi-vim crashes vim when scratch buffer is closed #1103

Closed FriendlyTroll closed 1 year ago

FriendlyTroll commented 1 year ago

Issue

jedi-vim crashes vim on second autocomplete with dot, when scratch buffer is closed

Steps to reproduce

Example on new user account with jedi vim installed only, no other plugins. Open python file and enter

import requests

requests. <- pop up completion opens, now navigate to a method that has a doc string, select it it works, but this seems to open a scratch buffer which when visited closes and then trying the autocompletion with dot again like this

requests.

crashes vim with segfault.

Output of “:verbose JediDebugInfo”

Jedi-vim debug information

jedi-vim version
Global Python

Using Python version 3 to access Jedi.

Jedi
Jedi environment: <Environment: 3.8.10 in /home/test/venv>
Known environments
Settings
  omnifunc=jedi#completions
    Last set from ~/.vim/plugged/jedi-vim/autoload/jedi.vim line 723
  completeopt=menuone,longest,popup
    Last set from ~/.vim/plugged/jedi-vim/plugin/jedi.vim line 38

:version


VIM - Vi IMproved 8.1 (2018 May 18, compiled Jan 11 2023 23:54:11)
Included patches: 1-2269, 3612, 3625, 3669, 3741
Modified by team+vim@tracker.debian.org
Compiled by team+vim@tracker.debian.org
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               +cmdline_info      -farsi             +libcall           -mouse_sysmouse    +python3           -tag_any_white     +visualextra
+arabic            +comments          +file_in_path      +linebreak         +mouse_urxvt       +quickfix          +tcl               +viminfo
+autocmd           +conceal           +find_in_path      +lispindent        +mouse_xterm       +reltime           +termguicolors     +vreplace
+autochdir         +cryptv            +float             +listcmds          +multi_byte        +rightleft         +terminal          +wildignore
-autoservername    +cscope            +folding           +localmap          +multi_lang        -ruby              +terminfo          +wildmenu
+balloon_eval      +cursorbind        -footer            +lua               -mzscheme          +scrollbind        +termresponse      +windows
+balloon_eval_term +cursorshape       +fork()            +menu              +netbeans_intg     +signs             +textobjects       +writebackup
+browse            +dialog_con_gui    +gettext           +mksession         +num64             +smartindent       +textprop          +X11
++builtin_terms    +diff              -hangul_input      +modify_fname      +packages          +sound             +timers            -xfontset
+byte_offset       +digraphs          +iconv             +mouse             +path_extra        +spell             +title             +xim
+channel           +dnd               +insert_expand     +mouseshape        +perl              +startuptime       +toolbar           +xpm
+cindent           -ebcdic            +job               +mouse_dec         +persistent_undo   +statusline        +user_commands     +xsmp_interact
+clientserver      +emacs_tags        +jumplist          +mouse_gpm         +postscript        -sun_workshop      +vartabs           +xterm_clipboard
+clipboard         +eval              +keymap            -mouse_jsbterm     +printer           +syntax            +vertsplit         -xterm_save
+cmdline_compl     +ex_extra          +lambda            +mouse_netterm     +profile           +tag_binary        +virtualedit       
+cmdline_hist      +extra_search      +langmap           +mouse_sgr         -python            -tag_old_static    +visual            
   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: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wdate-time  -g -O2 -fdebug-prefix-map=/build/vim-Bxmteu/vim-8.1.2269=. -fstack-protector-strong -Wformat -Werror=format-security -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -Wl,-E  -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl  -lselinux  -lcanberra -lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.2 -Wl,-E  -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.30/CORE -lperl -ldl -lm -lpthread -lcrypt  -L/usr/lib/python3.8/config-3.8-x86_64-linux-gnu -lpython3.8 -lcrypt -lpthread -ldl -lutil -lm -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm     

:messages

Messages maintainer: Bram Moolenaar <Bram@vim.org>
:scriptnames ``` 1: /usr/share/vim/vimrc 2: /usr/share/vim/vim81/debian.vim 3: /usr/share/vim/vim81/syntax/syntax.vim 4: /usr/share/vim/vim81/syntax/synload.vim 5: /usr/share/vim/vim81/syntax/syncolor.vim 6: /usr/share/vim/vim81/filetype.vim 7: ~/.vimrc 8: ~/.vim/autoload/plug.vim 9: /usr/share/vim/vim81/ftoff.vim 10: ~/.vim/plugged/vim-fugitive/ftdetect/fugitive.vim 11: ~/.vim/plugged/vim-jinja/ftdetect/jinja.vim 12: ~/.vim/plugged/vim-javascript/ftdetect/flow.vim 13: ~/.vim/plugged/vim-javascript/ftdetect/javascript.vim 14: ~/.vim/plugged/ultisnips/ftdetect/snippets.vim 15: /usr/share/vim/vim81/ftplugin.vim 16: /usr/share/vim/vim81/indent.vim 17: /usr/share/vim/vim81/syntax/nosyntax.vim 18: ~/.vim/plugged/onedark.vim/colors/onedark.vim 19: ~/.vim/plugged/onedark.vim/autoload/onedark.vim 20: ~/.vim/plugged/vim-sensible/plugin/sensible.vim 21: /usr/share/vim/vim81/macros/matchit.vim 22: /usr/share/vim/vim81/pack/dist/opt/matchit/plugin/matchit.vim 23: /usr/share/vim/vim81/ftplugin/man.vim 24: ~/.vim/plugged/vim-fugitive/plugin/fugitive.vim 25: ~/.vim/plugged/vim-commentary/plugin/commentary.vim 26: ~/.vim/plugged/lightline.vim/plugin/lightline.vim 27: ~/.vim/plugged/vim-buftabline/plugin/buftabline.vim 28: ~/.vim/plugged/vim-gitgutter/plugin/gitgutter.vim 29: ~/.vim/plugged/vim-gitgutter/autoload/gitgutter/utility.vim 30: ~/.vim/plugged/vim-gitgutter/autoload/gitgutter/highlight.vim 31: ~/.vim/plugged/nerdtree/plugin/NERD_tree.vim 32: ~/.vim/plugged/nerdtree/autoload/nerdtree.vim 33: ~/.vim/plugged/nerdtree/lib/nerdtree/path.vim 34: ~/.vim/plugged/nerdtree/lib/nerdtree/menu_controller.vim 35: ~/.vim/plugged/nerdtree/lib/nerdtree/menu_item.vim 36: ~/.vim/plugged/nerdtree/lib/nerdtree/key_map.vim 37: ~/.vim/plugged/nerdtree/lib/nerdtree/bookmark.vim 38: ~/.vim/plugged/nerdtree/lib/nerdtree/tree_file_node.vim 39: ~/.vim/plugged/nerdtree/lib/nerdtree/tree_dir_node.vim 40: ~/.vim/plugged/nerdtree/lib/nerdtree/opener.vim 41: ~/.vim/plugged/nerdtree/lib/nerdtree/creator.vim 42: ~/.vim/plugged/nerdtree/lib/nerdtree/flag_set.vim 43: ~/.vim/plugged/nerdtree/lib/nerdtree/nerdtree.vim 44: ~/.vim/plugged/nerdtree/lib/nerdtree/ui.vim 45: ~/.vim/plugged/nerdtree/lib/nerdtree/event.vim 46: ~/.vim/plugged/nerdtree/lib/nerdtree/notifier.vim 47: ~/.vim/plugged/nerdtree/autoload/nerdtree/ui_glue.vim 48: ~/.vim/plugged/nerdtree/nerdtree_plugin/exec_menuitem.vim 49: ~/.vim/plugged/nerdtree/nerdtree_plugin/fs_menu.vim 50: ~/.vim/plugged/nerdtree/nerdtree_plugin/vcs.vim 51: ~/.vim/plugged/nerdtree-git-plugin/nerdtree_plugin/git_status.vim 52: ~/.vim/plugged/nerdtree-git-plugin/autoload/gitstatus.vim 53: ~/.vim/plugged/nerdtree-git-plugin/autoload/gitstatus/log.vim 54: ~/.vim/plugged/nerdtree-git-plugin/autoload/gitstatus/listener.vim 55: ~/.vim/plugged/ale/plugin/ale.vim 56: ~/.vim/plugged/ale/autoload/ale/events.vim 57: ~/.vim/plugged/tagbar/plugin/tagbar.vim 58: ~/.vim/plugged/vim-closetag/plugin/closetag.vim 59: ~/.vim/plugged/fzf/plugin/fzf.vim 60: ~/.vim/plugged/fzf.vim/plugin/fzf.vim 61: ~/.vim/plugged/vim-fubitive/plugin/fubitive.vim 62: ~/.vim/plugged/ultisnips/plugin/UltiSnips.vim 63: ~/.vim/plugged/ultisnips/autoload/UltiSnips/map_keys.vim 64: ~/.vim/plugged/vim-snippets/plugin/vimsnippets.vim 65: ~/.vim/plugged/jedi-vim/plugin/jedi.vim 66: /usr/share/vim/vim81/plugin/getscriptPlugin.vim 67: /usr/share/vim/vim81/plugin/gzip.vim 68: /usr/share/vim/vim81/plugin/logiPat.vim 69: /usr/share/vim/vim81/plugin/manpager.vim 70: /usr/share/vim/vim81/plugin/matchparen.vim 71: /usr/share/vim/vim81/plugin/netrwPlugin.vim 72: /usr/share/vim/vim81/plugin/rrhelper.vim 73: /usr/share/vim/vim81/plugin/spellfile.vim 74: /usr/share/vim/vim81/plugin/tarPlugin.vim 75: /usr/share/vim/vim81/plugin/tohtml.vim 76: /usr/share/vim/vim81/plugin/vimballPlugin.vim 77: /usr/share/vim/vim81/plugin/zipPlugin.vim 78: ~/.vim/plugged/ultisnips/after/plugin/UltiSnips_after.vim 79: ~/.vim/plugged/ale/autoload/ale.vim 80: ~/.vim/plugged/lightline.vim/autoload/lightline.vim 81: ~/.vim/plugged/vim-fugitive/autoload/fugitive.vim 82: ~/.vim/plugged/lightline.vim/autoload/lightline/tab.vim 83: ~/.vim/plugged/onedark.vim/autoload/lightline/colorscheme/onedark.vim 84: ~/.vim/plugged/lightline.vim/autoload/lightline/colorscheme.vim 85: ~/.vim/plugged/vim-gitgutter/autoload/gitgutter.vim 86: ~/.vim/plugged/nerdtree/syntax/nerdtree.vim 87: ~/.vim/plugged/nerdtree-git-plugin/after/syntax/nerdtree.vim 88: ~/.vim/plugged/nerdtree-git-plugin/autoload/gitstatus/util.vim 89: ~/.vim/plugged/nerdtree-git-plugin/autoload/gitstatus/job.vim 90: ~/.vim/plugged/jedi-vim/ftplugin/python/jedi.vim 91: ~/.vim/plugged/jedi-vim/autoload/jedi.vim 92: /usr/share/vim/vim81/ftplugin/python.vim 93: ~/.vim/plugged/jedi-vim/after/ftplugin/python/jedi.vim 94: ~/.vim/plugged/indentpython.vim/indent/python.vim 95: /usr/share/vim/vim81/indent/python.vim 96: /usr/share/vim/vim81/syntax/python.vim 97: ~/.vim/plugged/jedi-vim/after/syntax/python.vim 98: ~/.vim/plugged/vim-gitgutter/autoload/gitgutter/async.vim 99: ~/.vim/plugged/vim-gitgutter/autoload/gitgutter/debug.vim 100: ~/.vim/plugged/ale/autoload/ale/util.vim 101: ~/.vim/plugged/ale/autoload/ale/linter.vim 102: ~/.vim/plugged/ale/ale_linters/python/bandit.vim 103: ~/.vim/plugged/ale/ale_linters/python/cspell.vim 104: ~/.vim/plugged/ale/autoload/ale/handlers/cspell.vim 105: ~/.vim/plugged/ale/ale_linters/python/flake8.vim 106: ~/.vim/plugged/ale/ale_linters/python/flakehell.vim 107: ~/.vim/plugged/ale/ale_linters/python/jedils.vim 108: ~/.vim/plugged/ale/ale_linters/python/mypy.vim 109: ~/.vim/plugged/ale/ale_linters/python/prospector.vim 110: ~/.vim/plugged/ale/ale_linters/python/pycln.vim 111: ~/.vim/plugged/ale/ale_linters/python/pycodestyle.vim 112: ~/.vim/plugged/ale/ale_linters/python/pydocstyle.vim 113: ~/.vim/plugged/ale/ale_linters/python/pyflakes.vim 114: ~/.vim/plugged/ale/ale_linters/python/pylama.vim 115: ~/.vim/plugged/ale/ale_linters/python/pylint.vim 116: ~/.vim/plugged/ale/ale_linters/python/pylsp.vim 117: ~/.vim/plugged/ale/ale_linters/python/pyre.vim 118: ~/.vim/plugged/ale/ale_linters/python/pyright.vim 119: ~/.vim/plugged/ale/ale_linters/python/refurb.vim 120: ~/.vim/plugged/ale/ale_linters/python/ruff.vim 121: ~/.vim/plugged/ale/autoload/ale/fix/registry.vim 122: ~/.vim/plugged/ale/ale_linters/python/unimport.vim 123: ~/.vim/plugged/ale/ale_linters/python/vulture.vim 124: ~/.vim/plugged/ale/autoload/ale/engine.vim 125: ~/.vim/plugged/ale/autoload/ale/semver.vim 126: ~/.vim/plugged/ale/autoload/ale/command.vim 127: ~/.vim/plugged/ale/autoload/ale/job.vim 128: ~/.vim/plugged/ale/autoload/ale/history.vim 129: ~/.vim/plugged/ale/autoload/ale/cursor.vim 130: ~/.vim/plugged/ale/autoload/ale/python.vim 131: ~/.vim/plugged/ale/autoload/ale/path.vim 132: ~/.vim/plugged/ale/autoload/ale/lsp_linter.vim 133: ~/.vim/plugged/vim-gitgutter/autoload/gitgutter/diff.vim 134: ~/.vim/plugged/vim-gitgutter/autoload/gitgutter/hunk.vim 135: ~/.vim/plugged/vim-gitgutter/autoload/gitgutter/sign.vim 136: ~/.vim/plugged/ale/autoload/ale/sign.vim 137: ~/.vim/plugged/ale/autoload/ale/list.vim 138: ~/.vim/plugged/ale/autoload/ale/highlight.vim ```
davidhalter commented 1 year ago

crashes vim with segfault.

Sorry, but this is by definition not a jedi-vim issue. VIM should never crash with a segfault when using plugins. I feel like you should probably reinstall VIM somehow? Also where do you have VIM from? It feels a bit weird that it's compiled in 2023, but the version is from 2018.

Closing, because this is not an issue here, but I'm happy to help if you want to continue the discussion here.

FriendlyTroll commented 1 year ago

Firstly, thank you very much for your help and an awesome plugin!

I'm using Ubuntu 20.04 and vim is just installed from the standard repos. Tried reinstalling but it didn't work.

Do you know maybe how could I not show this hidden scratch buffer in buffer list? It seems this causes a problem in my situation.

This scratch buffer holds the documentation (from the popup window) as far as I can see. Is there a way to disable this doc window? I tried with g:jedi#auto_close_doc = 1 but I guess that doesn't do what I think it does?

davidhalter commented 1 year ago

Ironically I have the exact same VIM, also on Ubuntu 20.04. I feel like there might be something wrong with your Python installation in that case. Did you play around a lot with your packages?

I'm not sure how I can help you work around these issues, because this is clearly an issue only on your system (there are for sure 100-1000's of users where this works without problems on Ubuntu 20.04.

FriendlyTroll commented 1 year ago

Yes, its definitely an issue with my system as I have just tried it on fresh VM and works as expected. I'm not sure what could be wrong with my system, I did install some python packages with pip, but mostly I work in virtual environments.

If I manage to find what's wrong, I'll write it here.

Thanks again for your time David!