Loading ...
Sorry, an error occurred while loading the content.

Vim freezes with 100% cpu usage on exit

Expand Messages
  • Thiago Padilha
    Hi I m experiencing a bug with vim inside virtualbox running ubuntu 12.04 LTS(which automatically installs guest additions). I noticed the bug happens with the
    Message 1 of 8 , Mar 31, 2013
    View Source
    • 0 Attachment
      Hi

      I'm experiencing a bug with vim inside virtualbox running ubuntu 12.04 LTS(which automatically installs guest additions). I noticed the bug happens with the following actions:

      1 - I open vim inside a tmux session and start working on some project. I always have two files open in vertically split window(not sure if this is relevant)
      2 - I detach the tmux session, save virtualbox state then shutdown my computer.
      3 - Some time later(like 30 minutes) I turn my computer on, resume virtualbox and reattach to the tmux/vim session.

      When I reattach, everything is working normally, except when I try to quit vim with :qa . When I do that, vim freezes and starts to consume 100% cpu until I send a SIGKILL.

      This always happens with me. The vim version I'm using is the one that comes with ubuntu 12.04 LTS(7.3.429), but I also have tested with the latest build(875) and the problem persists. The ubuntu guest only contains the minimal install (console-only)

      To whoever is interested in investigating this bug and fails to reproduce it: just ask and I will try to collect more info about my working environment.

      Thanks in advance.

      --
      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
       
      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
       
       
    • Thiago Padilha
      Sometimes when I reattach to the tmux session after the virtual machine has been frozen for a long time vim freezes right away without consuming 100% cpu, it
      Message 2 of 8 , Apr 19 6:07 AM
      View Source
      • 0 Attachment
        Sometimes when I reattach to the tmux session after the virtual machine has been frozen for a long time vim freezes right away without consuming 100% cpu, it just stays frozen for about 5-10 minutes then comes back(but when I quit after that vim freezes again with 100% cpu).

        I'm guessing vim is running some kind of periodic activity that goes crazy when the virtualbox daemon running in the vm  suddenly updates the hardware clock after a long time period.

        At first I tought this had something to do with the CursorHold autocmd but after reading the documentation I saw it is only triggered after the user presses a key which doesn't apply in this case since the virtual machine is frozen.

        This is really annoying me, I was hoping someone could give me hints on how to debug this issue.



        On Sun, Mar 31, 2013 at 9:42 PM, Thiago Padilha <tpadilha84@...> wrote:
        Hi

        I'm experiencing a bug with vim inside virtualbox running ubuntu 12.04 LTS(which automatically installs guest additions). I noticed the bug happens with the following actions:

        1 - I open vim inside a tmux session and start working on some project. I always have two files open in vertically split window(not sure if this is relevant)
        2 - I detach the tmux session, save virtualbox state then shutdown my computer.
        3 - Some time later(like 30 minutes) I turn my computer on, resume virtualbox and reattach to the tmux/vim session.

        When I reattach, everything is working normally, except when I try to quit vim with :qa . When I do that, vim freezes and starts to consume 100% cpu until I send a SIGKILL.

        This always happens with me. The vim version I'm using is the one that comes with ubuntu 12.04 LTS(7.3.429), but I also have tested with the latest build(875) and the problem persists. The ubuntu guest only contains the minimal install (console-only)

        To whoever is interested in investigating this bug and fails to reproduce it: just ask and I will try to collect more info about my working environment.

        Thanks in advance.


        --
        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
         
        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
         
         
      • Dominique Pellé
        ... You could build vim with debug information (-g -O0). Then, when bug happens & Vim uses 100% of the CPU, you can attach with gdb to the Vim process that
        Message 3 of 8 , Apr 19 12:05 PM
        View Source
        • 0 Attachment
          Thiago Padilha <tpadilha84@...> wrote:

          > Sometimes when I reattach to the tmux session after the virtual machine
          > has been frozen for a long time vim freezes right away without consuming 100% cpu,
          ...
          > This is really annoying me, I was hoping someone could give me hints on how to debug this issue.


          You could build vim with debug information (-g -O0). Then, when bug
          happens & Vim uses 100% of the CPU, you can attach with gdb to the
          Vim process that hogs the CPU, and look at the stack trace. That may
          give useful information to debug it.

          $ gdb
          (gdb) attach pid
          (gdb) bt

          (where pid is he process ID of the Vim process using 100% of the CPU)

          You can then continue with...

          (gdb) c

          ... and press CTRL-C in gdb to stop vim and run bt again to see if you
          get similar stack trace. You can repeat that a few times to get a feeling
          of what Vim is doing.

          Dominique

          --
          --
          You received this message from the "vim_use" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php

          ---
          You received this message because you are subscribed to the Google Groups "vim_use" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        • Thiago Padilha
          Dominique thanks for your help. I have attached gdb to vim in both cases: when I re-attach to tmux after a reboot(which hangs without cpu activity for a while)
          Message 4 of 8 , Apr 20 7:26 AM
          View Source
          • 0 Attachment
            Dominique thanks for your help.

            I have attached gdb to vim in both cases: when I re-attach to tmux after a reboot(which hangs without cpu activity for a while) and soon after that, when I send the quit command(which hangs vim with 100% cpu).

            In both cases it seems the issue is related with x11 libraries and the fact that my x11 session(provided by cygwin-x) has a different lifecycle than the vim session.The function that causes vim to freeze with 100% cpu is '_XtWaitForSomething' from libXt. As the name says this function waits for something that never happens with a busy poll which causes the freeze.

            The issue was fixed for me by replacing ubuntu's 'vim-gtk' for 'vim-nox' package. The x11 clipboard integration I replaced by creating mappings that invoke the xclip commandline utility(which doesn't keep a connection with x11 open).

            In any case I attached gdb backtraces for anyone interested in doing further investigations. It may be possible to reproduce these issues by starting vim with x11 support in a tmux/screen session, restarting x11 and then reattaching to it. To debug in debian/ubuntu just install the vim-gtk/vim-dbg packages


            On Fri, Apr 19, 2013 at 4:05 PM, Dominique Pellé <dominique.pelle@...> wrote:
            Thiago Padilha <tpadilha84@...> wrote:

            > Sometimes when I reattach to the tmux session after the virtual machine
            > has been frozen for a long time vim freezes right away without consuming 100% cpu,
            ...
            > This is really annoying me, I was hoping someone could give me hints on how to debug this issue.


            You could build vim with debug information (-g -O0). Then, when bug
            happens & Vim uses 100% of the CPU, you can attach with gdb to the
            Vim process that hogs the CPU, and look at the stack trace. That may
            give useful information to debug it.

            $ gdb
            (gdb) attach pid
            (gdb) bt

            (where pid is he process ID of the Vim process using 100% of the CPU)

            You can then continue with...

            (gdb) c

            ... and press CTRL-C in gdb to stop vim and run bt again to see if you
            get similar stack trace.  You can repeat that a few times to get a feeling
            of what Vim is doing.

            Dominique

            --
            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php

            ---
            You received this message because you are subscribed to the Google Groups "vim_use" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.



            --
            --
            You received this message from the "vim_use" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
             
            ---
            You received this message because you are subscribed to the Google Groups "vim_use" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
            For more options, visit https://groups.google.com/groups/opt_out.
             
             
          • Christian Brabandt
            Hi Thiago! ... Hm, Your backtrace looks like the one I just got for a similar problem. Look for the subject hanging vim, I just posted there yesterday. Maybe
            Message 5 of 8 , Apr 20 7:33 AM
            View Source
            • 0 Attachment
              Hi Thiago!

              On Sa, 20 Apr 2013, Thiago Padilha wrote:

              > Dominique thanks for your help.
              >
              > I have attached gdb to vim in both cases: when I re-attach to tmux after a
              > reboot(which hangs without cpu activity for a while) and soon after that,
              > when I send the quit command(which hangs vim with 100% cpu).
              >
              > In both cases it seems the issue is related with x11 libraries and the fact
              > that my x11 session(provided by cygwin-x) has a different lifecycle than
              > the vim session. The function that causes vim to freeze with 100% cpu is
              > '_XtWaitForSomething' from libXt. As the name says this function waits for
              > something that never happens with a busy poll which causes the freeze.
              >
              > The issue was fixed for me by replacing ubuntu's 'vim-gtk' for 'vim-nox'
              > package. The x11 clipboard integration I replaced by creating mappings that
              > invoke the xclip commandline utility(which doesn't keep a connection with
              > x11 open).
              >
              > In any case I attached gdb backtraces for anyone interested in doing
              > further investigations. It may be possible to reproduce these issues by
              > starting vim with x11 support in a tmux/screen session, restarting x11 and
              > then reattaching to it. To debug in debian/ubuntu just install the
              > vim-gtk/vim-dbg packages
              > backtrace after tmux attach(triggered by clicking at the vim pane with
              > the mouse, but this will call eventually returns):

              Hm, Your backtrace looks like the one I just got for a similar problem.
              Look for the subject hanging vim, I just posted there yesterday. Maybe
              this is a problem with the Ubuntu X11 libraries?

              In any case, starting vim with -X should also fix this for you.

              regards,
              Christian

              --
              --
              You received this message from the "vim_use" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php

              ---
              You received this message because you are subscribed to the Google Groups "vim_use" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
              For more options, visit https://groups.google.com/groups/opt_out.
            • Yegappan Lakshmanan
              Hi, ... I also saw Vim hang sometimes when selecting a large amount of text (see the Vim crash issue I reported last week). The traceback of the hung Vim is
              Message 6 of 8 , Apr 20 11:31 AM
              View Source
              • 0 Attachment
                Hi,


                On Sat, Apr 20, 2013 at 7:33 AM, Christian Brabandt <cblists@...> wrote:
                Hi Thiago!

                On Sa, 20 Apr 2013, Thiago Padilha wrote:

                > Dominique thanks for your help.
                >
                > I have attached gdb to vim in both cases: when I re-attach to tmux after a
                > reboot(which hangs without cpu activity for a while) and soon after that,
                > when I send the quit command(which hangs vim with 100% cpu).
                >
                > In both cases it seems the issue is related with x11 libraries and the fact
                > that my x11 session(provided by cygwin-x) has a different lifecycle than
                > the vim session. The function that causes vim to freeze with 100% cpu is
                > '_XtWaitForSomething' from libXt. As the name says this function waits for
                > something that never happens with a busy poll which causes the freeze.
                >
                > The issue was fixed for me by replacing ubuntu's 'vim-gtk' for 'vim-nox'
                > package. The x11 clipboard integration I replaced by creating mappings that
                > invoke the xclip commandline utility(which doesn't keep a connection with
                > x11 open).
                >
                > In any case I attached gdb backtraces for anyone interested in doing
                > further investigations. It may be possible to reproduce these issues by
                > starting vim with x11 support in a tmux/screen session, restarting x11 and
                > then reattaching to it. To debug in debian/ubuntu just install the
                > vim-gtk/vim-dbg packages
                > backtrace after tmux attach(triggered by clicking at the vim pane with
                > the mouse, but this will call eventually returns):

                Hm, Your backtrace looks like the one I just got for a similar problem.
                Look for the subject hanging vim, I just posted there yesterday. Maybe
                this is a problem with the Ubuntu X11 libraries?

                In any case, starting vim with -X should also fix this for you.


                I also saw Vim hang sometimes when selecting a large amount of text (see the
                Vim crash issue I reported last week).

                The traceback of the hung Vim is similar to the traceback you are seeing.
                It looks like the X11 clipboard interaction has a problem. I am not familiar with
                the X11 clipboard handling code. So I am not able to make any progress
                in finding a fix for this crash/hang problem.

                - Yegappan
                 

                --
                --
                You received this message from the "vim_use" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php
                 
                ---
                You received this message because you are subscribed to the Google Groups "vim_use" group.
                To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                For more options, visit https://groups.google.com/groups/opt_out.
                 
                 
              • Thiago Padilha
                Hi Christian I don t think the bug is specific to ubuntu, I m guessing that the problem is that x11 client libraries weren t designed for applications that
                Message 7 of 8 , Apr 20 12:06 PM
                View Source
                • 0 Attachment
                  Hi Christian

                  I don't think the bug is specific to ubuntu, I'm guessing that the problem is that x11 client libraries weren't designed for applications that survive across multiple x11 sessions which is what happens when running terminal apps that connect to x11.

                  Thanks for the '-X' flags by the way, I'd rather keep vim compiled with gtk on my system


                  On Sat, Apr 20, 2013 at 11:33 AM, Christian Brabandt <cblists@...> wrote:
                  Hi Thiago!

                  On Sa, 20 Apr 2013, Thiago Padilha wrote:

                  > Dominique thanks for your help.
                  >
                  > I have attached gdb to vim in both cases: when I re-attach to tmux after a
                  > reboot(which hangs without cpu activity for a while) and soon after that,
                  > when I send the quit command(which hangs vim with 100% cpu).
                  >
                  > In both cases it seems the issue is related with x11 libraries and the fact
                  > that my x11 session(provided by cygwin-x) has a different lifecycle than
                  > the vim session. The function that causes vim to freeze with 100% cpu is
                  > '_XtWaitForSomething' from libXt. As the name says this function waits for
                  > something that never happens with a busy poll which causes the freeze.
                  >
                  > The issue was fixed for me by replacing ubuntu's 'vim-gtk' for 'vim-nox'
                  > package. The x11 clipboard integration I replaced by creating mappings that
                  > invoke the xclip commandline utility(which doesn't keep a connection with
                  > x11 open).
                  >
                  > In any case I attached gdb backtraces for anyone interested in doing
                  > further investigations. It may be possible to reproduce these issues by
                  > starting vim with x11 support in a tmux/screen session, restarting x11 and
                  > then reattaching to it. To debug in debian/ubuntu just install the
                  > vim-gtk/vim-dbg packages
                  > backtrace after tmux attach(triggered by clicking at the vim pane with
                  > the mouse, but this will call eventually returns):

                  Hm, Your backtrace looks like the one I just got for a similar problem.
                  Look for the subject hanging vim, I just posted there yesterday. Maybe
                  this is a problem with the Ubuntu X11 libraries?

                  In any case, starting vim with -X should also fix this for you.

                  regards,
                  Christian

                  --
                  --
                  You received this message from the "vim_use" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php

                  ---
                  You received this message because you are subscribed to the Google Groups "vim_use" group.
                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                  For more options, visit https://groups.google.com/groups/opt_out.



                  --
                  --
                  You received this message from the "vim_use" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php
                   
                  ---
                  You received this message because you are subscribed to the Google Groups "vim_use" group.
                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                  For more options, visit https://groups.google.com/groups/opt_out.
                   
                   
                • Thiago Padilha
                  Here s what I have in my vimrc to workaround these x11 issues(adjust the mappings to your likings): function! X11Yank() call system( xclip -i -selection
                  Message 8 of 8 , Apr 21 5:33 AM
                  View Source
                  • 0 Attachment
                    Here's what I have in my vimrc to workaround these x11 issues(adjust the mappings to your likings):

                    function! X11Yank()
                      call system('xclip -i -selection clipboard', @t)
                    endfunction
                    function! X11Paste()
                      let @t = system('xclip -o -selection clipboard')
                    endfunction

                    vnoremap <silent> <a-y> "ty:call X11Yank()<cr>
                    vnoremap <silent> <a-d> "td:call X11Yank()<cr>
                    nnoremap <silent> <a-p> :call X11Paste()<cr>"tp
                    vnoremap <silent> <a-p> d:call X11Paste()<cr>h"tp


                    On Sat, Apr 20, 2013 at 3:31 PM, Yegappan Lakshmanan <yegappanl@...> wrote:
                    Hi,
                     
                    I also saw Vim hang sometimes when selecting a large amount of text (see the
                    Vim crash issue I reported last week).

                    The traceback of the hung Vim is similar to the traceback you are seeing.
                    It looks like the X11 clipboard interaction has a problem. I am not familiar with
                    the X11 clipboard handling code. So I am not able to make any progress
                    in finding a fix for this crash/hang problem.

                    - Yegappan
                     

                    --
                    --
                    You received this message from the "vim_use" maillist.
                    Do not top-post! Type your reply below the text you are replying to.
                    For more information, visit http://www.vim.org/maillist.php
                     
                    ---
                    You received this message because you are subscribed to the Google Groups "vim_use" group.
                    To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
                    For more options, visit https://groups.google.com/groups/opt_out.
                     
                     
                  Your message has been successfully submitted and would be delivered to recipients shortly.