Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Invalid free on Vim exit #154

Open
swgillespie opened this issue Jun 3, 2017 · 10 comments
Open

Invalid free on Vim exit #154

swgillespie opened this issue Jun 3, 2017 · 10 comments

Comments

@swgillespie
Copy link

Here's the valgrind error I get off of a fresh install of vim (ubuntu 17.04) and color_coded (repro by starting and immediately exiting vim)

swgillespie@ubuntu:~$ valgrind vim                                                                       
==25408== Memcheck, a memory error detector
==25408== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==25408== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==25408== Command: vim
==25408==
--25408-- WARNING: unhandled amd64-linux syscall: 324
--25408-- You may be able to write your own handler.
--25408-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--25408-- Nevertheless we consider this a bug.  Please report
--25408-- it at http://valgrind.org/support/bug_reports.html.
==25408== Invalid free() / delete / delete[] / realloc()
==25408==    at 0x4C2F25B: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25408==    by 0x9B4C26F: __run_exit_handlers (exit.c:83)
==25408==    by 0x9B4C2C9: exit (exit.c:105)
==25408==    by 0x26D5BA: mch_exit (in /usr/bin/vim.gtk3)
==25408==    by 0x34680E: getout (in /usr/bin/vim.gtk3)
==25408==    by 0x1CBA32: ??? (in /usr/bin/vim.gtk3)
==25408==    by 0x1D24EE: do_cmdline (in /usr/bin/vim.gtk3)
==25408==    by 0x244244: ??? (in /usr/bin/vim.gtk3)
==25408==    by 0x24DC94: normal_cmd (in /usr/bin/vim.gtk3)
==25408==    by 0x347604: main_loop (in /usr/bin/vim.gtk3)
==25408==    by 0x34877F: vim_main2 (in /usr/bin/vim.gtk3)
==25408==    by 0x16B420: main (in /usr/bin/vim.gtk3)
==25408==  Address 0x14391be8 is 24 bytes inside a block of size 27 alloc'd
==25408==    at 0x4C2E19F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==25408==    by 0x10D34138: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22)
==25408==    by 0x10D34256: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22)
==25408==    by 0x10D36055: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22)
==25408==    by 0x15731923: _GLOBAL__sub_I_path.cpp (in /home/swgillespie/.vim/bundle/color_coded/color_coded.so)
==25408==    by 0x4010819: call_init.part.0 (dl-init.c:72)
==25408==    by 0x401092A: call_init (dl-init.c:30)
==25408==    by 0x401092A: _dl_init (dl-init.c:120)
==25408==    by 0x40158C5: dl_open_worker (dl-open.c:575)
==25408==    by 0x40106C3: _dl_catch_error (dl-error.c:187)
==25408==    by 0x4014EA8: _dl_open (dl-open.c:660)
==25408==    by 0x8217EE8: dlopen_doit (dlopen.c:66)
==25408==    by 0x40106C3: _dl_catch_error (dl-error.c:187)
==25408==
==25408==
==25408== HEAP SUMMARY:
==25408==     in use at exit: 5,238,025 bytes in 38,955 blocks
==25408==   total heap usage: 308,327 allocs, 269,376 frees, 126,881,030 bytes allocated
==25408==
==25408== LEAK SUMMARY:
==25408==    definitely lost: 0 bytes in 0 blocks
==25408==    indirectly lost: 0 bytes in 0 blocks
==25408==      possibly lost: 710,143 bytes in 12,086 blocks
==25408==    still reachable: 4,527,882 bytes in 26,869 blocks
==25408==                       of which reachable via heuristic:
==25408==                         stdstring          : 106 bytes in 4 blocks
==25408==                         newarray           : 1,536 bytes in 16 blocks
==25408==         suppressed: 0 bytes in 0 blocks
==25408== Rerun with --leak-check=full to see details of leaked memory
==25408==
==25408== For counts of detected and suppressed errors, rerun with: -v
==25408== Use --track-origins=yes to see where uninitialised values come from
==25408== ERROR SUMMARY: 2787 errors from 119 contexts (suppressed: 0 from 0)

With vim --version:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 17 2017 12:13:35)
Included patches: 1-95
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     +tcl
+balloon_eval    +folding         +mouse_xterm     +termguicolors
+browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
+clientserver    +insert_expand   +packages        +toolbar
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       -python          +vreplace
+cscope          +lispindent      +python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con_gui  +lua             +rightleft       +writebackup
+diff            +menu            +ruby            +X11
+digraphs        +mksession       +scrollbind      -xfontset
+dnd             +modify_fname    +signs           +xim
-ebcdic          +mouse           +smartindent     +xpm
+emacs_tags      +mouseshape      +startuptime     +xsmp_interact
+eval            +mouse_dec       +statusline      +xterm_clipboard
+ex_extra        +mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax
+farsi           +mouse_netterm   +tag_binary
   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/mirclient -I/usr/include/mircore -I/usr/include/mircookie -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -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-8krYYf/vim-8.0.0095=. -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E  -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -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  -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.24/CORE -lperl -ldl -lm -lpthread -lcrypt  -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5m -lpthread -ldl -lutil -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm

Doesn't repro when I uninstall color_coded.

@swgillespie
Copy link
Author

Possibly a dupe of #142, I guess color_coded might not support Vim8?

@jeaye
Copy link
Owner

jeaye commented Jun 3, 2017

color_coded certainly supports vim8, just not its asynchronous features, which is what #142 is discussing.

Interestingly, that stack trace doesn't contain any color_coded frames, but it does point a finger at someone using an std::string (which color_coded does, of course). I wonder if this is an issue related to using C++ plugins with vim and not specific to color_coded. Another idea, since it happens on exit, would be the destructor of some global static string, but color_coded doesn't use any.

Either way, thanks for reporting. Do you get this 100% of the time? When I try, on Arch Linux, I don't see it.

┌─(✓)[jeaye@oryx]─[~][16:36:26]
└──╼ valgrind vim
==3662== Memcheck, a memory error detector
==3662== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==3662== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==3662== Command: vim
==3662== 
==3662== 
==3662== HEAP SUMMARY:
==3662==     in use at exit: 5,052,419 bytes in 37,973 blocks
==3662==   total heap usage: 217,251 allocs, 179,278 frees, 139,918,488 bytes allocated
==3662== 
==3662== LEAK SUMMARY:
==3662==    definitely lost: 0 bytes in 0 blocks
==3662==    indirectly lost: 0 bytes in 0 blocks
==3662==      possibly lost: 694,199 bytes in 13,754 blocks
==3662==    still reachable: 4,358,220 bytes in 24,219 blocks
==3662==                       of which reachable via heuristic:
==3662==                         newarray           : 1,536 bytes in 16 blocks
==3662==         suppressed: 0 bytes in 0 blocks
==3662== Rerun with --leak-check=full to see details of leaked memory
==3662== 
==3662== For counts of detected and suppressed errors, rerun with: -v
==3662== Use --track-origins=yes to see where uninitialised values come from
==3662== ERROR SUMMARY: 5318 errors from 202 contexts (suppressed: 0 from 0)

I have vim --version:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Apr 26 2017 07:49:10)
Included patches: 1-586
Compiled by Arch Linux
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     +tcl/dyn
+balloon_eval    +folding         +mouse_xterm     +termguicolors
+browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
+clientserver    +insert_expand   +packages        +toolbar
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl/dyn        +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python/dyn      +vreplace
+cscope          +lispindent      +python3/dyn     +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con_gui  +lua/dyn         +rightleft       +writebackup
+diff            +menu            +ruby/dyn        +X11
+digraphs        +mksession       +scrollbind      -xfontset
+dnd             +modify_fname    +signs           +xim
-ebcdic          +mouse           +smartindent     -xpm
+emacs_tags      +mouseshape      +startuptime     +xsmp_interact
+eval            +mouse_dec       +statusline      +xterm_clipboard
+ex_extra        +mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax          
+farsi           +mouse_netterm   +tag_binary      
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/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/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/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/libdrm -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -lncurses -lelf -lnsl    -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/core_perl/CORE -lperl -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lieee -lm

And valgrind --version: valgrind-3.12.0

@swgillespie
Copy link
Author

Yeah, this happens every time for me. I can try to dig a little deeper soon.

@jeaye
Copy link
Owner

jeaye commented Jun 5, 2017 via email

@korst1k
Copy link

korst1k commented Jun 6, 2017

I have similar problem on Ubuntu 17.04

*** Error in `vim': free(): invalid pointer: 0x00005606f965b628 ***                                                  
======= Backtrace: =========                                                                                         
/lib/x86_64-linux-gnu/libc.so.6(+0x7908b)[0x7f588650c08b]                                                            
/lib/x86_64-linux-gnu/libc.so.6(+0x826fa)[0x7f58865156fa]                                                         
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f588651912c]                                                       
/lib/x86_64-linux-gnu/libc.so.6(+0x3a270)[0x7f58864cd270]                                                                                       
/lib/x86_64-linux-gnu/libc.so.6(+0x3a2ca)[0x7f58864cd2ca]                                                                                       
vim(mch_exit+0x4b)[0x5606f8ed95bb]                                                                                                              
vim(getout+0xff)[0x5606f8fb280f]                                                                                                                
vim(+0xc3899)[0x5606f8e37899]                                                                                                                
vim(do_cmdline+0x17ff)[0x5606f8e3e4ef]                                                                                                       
vim(normal_cmd+0x8e5)[0x5606f8eb9c95]                                                                                                        
vim(main_loop+0x425)[0x5606f8fb3605]                                                                                                         
vim(vim_main2+0xc30)[0x5606f8fb4780]                                                                           
vim(main+0x751)[0x5606f8dd7421]                                                                                
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7f58864b33f1] 

vim --version:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 17 2017 12:13:35)
Included patches: 1-95
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     +tcl
+balloon_eval    +folding         +mouse_xterm     +termguicolors
+browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
+clientserver    +insert_expand   +packages        +toolbar
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       -python          +vreplace
+cscope          +lispindent      +python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con_gui  +lua             +rightleft       +writebackup
+diff            +menu            +ruby            +X11
+digraphs        +mksession       +scrollbind      -xfontset
+dnd             +modify_fname    +signs           +xim
-ebcdic          +mouse           +smartindent     +xpm
+emacs_tags      +mouseshape      +startuptime     +xsmp_interact
+eval            +mouse_dec       +statusline      +xterm_clipboard
+ex_extra        +mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax
+farsi           +mouse_netterm   +tag_binary

valgrind vim:

Vim: Caught deadly signal ABRT
Vim: Finished.
==25140==
==25140== Process terminating with default action of signal 6 (SIGABRT)
==25140==    at 0x9B47AA7: kill (syscall-template.S:84)
==25140==    by 0x26D60F: mch_exit (in /usr/bin/vim.gtk3)
==25140==    by 0x34680E: getout (in /usr/bin/vim.gtk3)
==25140==    by 0x8A4766F: ??? (in /lib/x86_64-linux-gnu/libpthread-2.24.so)
==25140==    by 0x9B4777E: __libc_signal_restore_set (nptl-signals.h:79)
==25140==    by 0x9B4777E: raise (raise.c:55)
==25140==    by 0x9B49379: abort (abort.c:89)
==25140==    by 0x10CF356C: __gnu_cxx::__verbose_terminate_handler() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22)
==25140==    by 0x10CF1315: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22)
==25140==    by 0x10CF1360: std::terminate() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22)
==25140==    by 0x1515C092: color_coded::async::queue<color_coded::async::task, color_coded::async::result>::~queue() (in /home/korst/.vim/bundle/color_coded/color_coded.so)
==25140==    by 0x9B4C26F: __run_exit_handlers (exit.c:83)
==25140==    by 0x9B4C2C9: exit (exit.c:105)
==25140==
==25140== HEAP SUMMARY:
==25140==     in use at exit: 6,870,712 bytes in 62,266 blocks
==25140==   total heap usage: 1,960,138 allocs, 1,897,874 frees, 31,793,442,184 bytes allocated
==25140==
==25140== LEAK SUMMARY:
==25140==    definitely lost: 167,656 bytes in 358 blocks
==25140==    indirectly lost: 10,260 bytes in 256 blocks
==25140==      possibly lost: 1,310,377 bytes in 31,894 blocks
==25140==    still reachable: 5,382,419 bytes in 29,758 blocks
==25140==                       of which reachable via heuristic:
==25140==                         stdstring          : 2,506 bytes in 14 blocks
==25140==                         newarray           : 1,536 bytes in 16 blocks
==25140==         suppressed: 0 bytes in 0 blocks
==25140== Rerun with --leak-check=full to see details of leaked memory
==25140==
==25140== For counts of detected and suppressed errors, rerun with: -v
==25140== Use --track-origins=yes to see where uninitialised values come from
==25140== ERROR SUMMARY: 3011 errors from 145 contexts (suppressed: 0 from 0)

@UnrealQuester
Copy link
Collaborator

Cannot reproduce on my system (gentoo). Might spin up a VM to take a closer look. My thoughts so far:

@swgillespie Not sure what exactly the problem is. The memory seems to be allocated by the std::string in one of the static boost::path objects in path.cpp. _GLOBAL__sub_I_path.cpp also calls atexit for each object (because they have a static storage duration) to call their destructor on exit. The destructor then frees the memory. This seems to fail for some reason. A double free is possible but I fail to see how that would happen and a bug in std::string seems unlikely.

@korst1k The SIGABRT in your valgrind output might be a different problem altogether.
It looks like the queue gets destroyed while it still holds a thread that is not joined. In this case the thread destructor calls std::terminate. This might be fixed by creating a destructor for color_coded::async::queue that just joins the thread.

@UnrealQuester
Copy link
Collaborator

I am unable to reproduce either issue on a ubuntu 17.04 VM using the same vim version and the following minimal vimrc:

set nocompatible
filetype off 
 
set rtp+=~/.vim/bundle/Vundle.vim 
call vundle#begin() 
Plugin 'jeaye/color_coded' 
call vundle#end() 
filetype plugin indent on 

@jeaye
Copy link
Owner

jeaye commented Jun 7, 2017

Thanks for the work, @UnrealQuester. It's curious that this doesn't show up on Arch, Gentoo, or even our own copy of Ubuntu 17.04. I wonder if both @swgillespie and @korst1k were running an older Ubuntu version, then did a dist upgrade; the remant of the older distro might be causing the issue.

Can you each verify if that has been the case? Clearly a fresh install of 17.04 doesn't show it.

@TravellingSalesPerson
Copy link

I do have this problem on my fresh install of 17.04 with the vimrc @UnrealQuester proposes except that I also added Vundle as plugin.

Vimrc:

set nocompatible
filetype off

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'jeaye/color_coded'
call vundle#end()
filetype plugin indent on

Vi version:

vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 17 2017 12:13:35)
Included patches: 1-95
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     +tcl
+balloon_eval    +folding         +mouse_xterm     +termguicolors
+browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
+clientserver    +insert_expand   +packages        +toolbar
+clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        +perl            +vertsplit
+cmdline_hist    +keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       -python          +vreplace
+cscope          +lispindent      +python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con_gui  +lua             +rightleft       +writebackup
+diff            +menu            +ruby            +X11
+digraphs        +mksession       +scrollbind      -xfontset
+dnd             +modify_fname    +signs           +xim
-ebcdic          +mouse           +smartindent     +xpm
+emacs_tags      +mouseshape      +startuptime     +xsmp_interact
+eval            +mouse_dec       +statusline      +xterm_clipboard
+ex_extra        +mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax
+farsi           +mouse_netterm   +tag_binary
   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/mirclient -I/usr/include/mircore -I/usr/include/mircookie -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -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-8krYYf/vim-8.0.0095=. -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E  -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -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  -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.24/CORE -lperl -ldl -lm -lpthread -lcrypt  -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5m -lpthread -ldl -lutil -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm

Valgrind output:

valgrind vi
==22943== Memcheck, a memory error detector
==22943== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==22943== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==22943== Command: vi
==22943==
--22943-- WARNING: unhandled amd64-linux syscall: 324
--22943-- You may be able to write your own handler.
--22943-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--22943-- Nevertheless we consider this a bug.  Please report
--22943-- it at http://valgrind.org/support/bug_reports.html.
==22943== Invalid free() / delete / delete[] / realloc()
==22943==    at 0x4C2F25B: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22943==    by 0x9B4C26F: __run_exit_handlers (exit.c:83)
==22943==    by 0x9B4C2C9: exit (exit.c:105)
==22943==    by 0x26D5BA: mch_exit (in /usr/bin/vim.gtk3)
==22943==    by 0x34680E: getout (in /usr/bin/vim.gtk3)
==22943==    by 0x1CB898: ??? (in /usr/bin/vim.gtk3)
==22943==    by 0x1D24EE: do_cmdline (in /usr/bin/vim.gtk3)
==22943==    by 0x244244: ??? (in /usr/bin/vim.gtk3)
==22943==    by 0x24DC94: normal_cmd (in /usr/bin/vim.gtk3)
==22943==    by 0x347604: main_loop (in /usr/bin/vim.gtk3)
==22943==    by 0x34877F: vim_main2 (in /usr/bin/vim.gtk3)
==22943==    by 0x16B420: main (in /usr/bin/vim.gtk3)
==22943==  Address 0x1413a2d8 is 24 bytes inside a block of size 27 alloc'd
==22943==    at 0x4C2E19F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22943==    by 0x10D34138: std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22)
==22943==    by 0x10D34256: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22)
==22943==    by 0x10D36055: std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22)
==22943==    by 0x15096913: _GLOBAL__sub_I_path.cpp (in /home/tsp/.vim/bundle/color_coded/color_coded.so)
==22943==    by 0x40109C9: call_init.part.0 (dl-init.c:72)
==22943==    by 0x4010ADA: call_init (dl-init.c:30)
==22943==    by 0x4010ADA: _dl_init (dl-init.c:120)
==22943==    by 0x4015A75: dl_open_worker (dl-open.c:575)
==22943==    by 0x4010873: _dl_catch_error (dl-error.c:187)
==22943==    by 0x4015058: _dl_open (dl-open.c:660)
==22943==    by 0x8217EE8: dlopen_doit (dlopen.c:66)
==22943==    by 0x4010873: _dl_catch_error (dl-error.c:187)
==22943==
==22943==
==22943== HEAP SUMMARY:
==22943==     in use at exit: 2,645,810 bytes in 25,047 blocks
==22943==   total heap usage: 92,993 allocs, 67,950 frees, 43,490,871 bytes allocated
==22943==
==22943== LEAK SUMMARY:
==22943==    definitely lost: 0 bytes in 0 blocks
==22943==    indirectly lost: 0 bytes in 0 blocks
==22943==      possibly lost: 339,968 bytes in 5,681 blocks
==22943==    still reachable: 2,305,842 bytes in 19,366 blocks
==22943==                       of which reachable via heuristic:
==22943==                         stdstring          : 106 bytes in 4 blocks
==22943==                         newarray           : 1,536 bytes in 16 blocks
==22943==         suppressed: 0 bytes in 0 blocks
==22943== Rerun with --leak-check=full to see details of leaked memory
==22943==
==22943== For counts of detected and suppressed errors, rerun with: -v
==22943== ERROR SUMMARY: 4 errors from 1 contexts (suppressed: 0 from 0)

@jeaye
Copy link
Owner

jeaye commented Sep 17, 2017

I'm very confident this is the same problem as #155. It's just manifesting a different way. In my tests, I saw that the vims which don't crash on startup, as they do in #155, also don't crash on closing, as you've shown here.

This also leads me to think that boost may not actually be the problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants