The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Anybody Seen VIM runaway!

Discussion in 'General Discussion' started by shaun, Aug 22, 2002.

  1. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    San Clemente, Ca
    anybody ever seen VIM consume 99% of the cpu when a user close's his session with out logging out. I'm seeing this on 3 machines now and it seams to be happening more and more. Wondering if anybody knew of a fix...
     
  2. NetEndeavors

    NetEndeavors Member

    Joined:
    Apr 29, 2002
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Happened to me yesterday on a brand new RH 7.3 machine -- don't know why -- hope it doesn't happen again....
     
  3. dandanfireman

    dandanfireman Well-Known Member
    PartnerNOC

    Joined:
    May 31, 2002
    Messages:
    117
    Likes Received:
    0
    Trophy Points:
    16
    I would think it would happen if someone vi's a very large file. I happened to intentionally vi a 500M file the other day and got very high util opening and writing the file.
     
  4. feanor

    feanor Well-Known Member

    Joined:
    Aug 13, 2001
    Messages:
    836
    Likes Received:
    0
    Trophy Points:
    16
    doesn't even matter about the file size.

    Vim runs away into the sunset and will run at 99.9% until it's killed..... a sentry program listening for such insanity is something you should definitely employ on a shared box. At least until they fix this, and detach the process from memory if a user is disconnected or somehow logs out without halting the lovely Vim session.

    This would never have happened with the sexy as hell core VI

    :p
     
  5. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    San Clemente, Ca
    the point is, is that this is happening on random machines... I have man redhat machines which are fine. and now it's happening to 4 of my machines (that i have noticed so far).

    Somebody should submit a bug to redhat see what they say.

    I have totally removed VIM and reinstalled it also with no change
     
  6. bliz42

    bliz42 Member

    Joined:
    May 7, 2002
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    random?

    I have experienced this at random intervals from time to time on all my cpanel machines... never seen the problem outside of my cpanel machines.. so either my other machines don't get enough usage, or it's something cpanel specific... doubtful it's related to cpanel.. but who knows.

    Anyhow, definately recommend writing a script that checks for it and kills it off.. just be careful not to kill real vi instances that users are working with that happen to be in startup mode, which can shoot the usage up to 99% for just a second.
     
  7. xnull

    xnull Well-Known Member

    Joined:
    Sep 9, 2001
    Messages:
    156
    Likes Received:
    0
    Trophy Points:
    16
    This has happened to us 3-4 times in the last year, a couple of which actually took the server to its knees. Vim shouldn't do that :)
     
  8. Curt

    Curt Well-Known Member

    Joined:
    Oct 16, 2001
    Messages:
    90
    Likes Received:
    0
    Trophy Points:
    6
    This happened to me today and I killed the process but I am concerned that this happens. Is there a way to disable VIM?

    Thanks!
    Curt
     
  9. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    San Clemente, Ca
    Disable VIM!!!!! Are you nutz then you'd have to use like Pico or somthing.. Ewwwwww. :p

    Ya you can disable it if you like, you'll probably piss off some clients though.

    if you really wanted to you could remove the packages or just can do a chmod -x /usr/bin/vim
     
  10. NetEndeavors

    NetEndeavors Member

    Joined:
    Apr 29, 2002
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Cron script to take care of the issue.....

    Guys / Gals,

    Here's the script I've created to eliminate the problem on our servers -- I've called it killvim and put it in the /scripts directory and scheduled it as a cron job to run periodically.... Use it if you care to.....


    #!/usr/bin/perl

    `ps -ef | grep & vim & | grep & 1 & | grep & ? & & /tmp/vim.$$`;

    open(VIMTHRDS, &&/tmp/vim.$$&);
    while(&VIMTHRDS&) {
    my ($x1, $x2) = split();
    chomp $x2;
    my ($pid, $trash) = split(/ /, $x2);
    if (length(&$pid&) & 0) {
    `kill -9 $pid`;
    }
    }
    close(VIMTHRDS);

    `rm -f /tmp/vim.$$`;
     
  11. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    San Clemente, Ca
    NetEndeavors: that's great and all but from what it looks like your killing off every vim process. I'd hate to be the one who awnsers the phone when a client who was writing a script on the server using vim calls because the process was killed.

    Well this morning i decided to go the extra step and find out what the hell is happening. I'm assuming this is a bug.

    I found that the problem is in /usr/bin/vim. Their are 2 ways to run vim or vi. by typeing vi or vim. vi exists in /bin/vi and vim exists in /usr/bin/vim. from what i can tell vim comes from vim-enhanced and /bin/vi comes from vim-minimal.

    What i did to fix this problem? i removed all vim packages. and reinstalled only 2 of them. I'm not sure what the diffrence is between vim-minimal and vim-enhanced. I'm assuming it's just extra crap that vim has to offer. so this is what i did. i just created a symbolic link from /usr/bin/vim -& /bin/vi.

    This should fix the problem.

    Steps to Fix this.

    1. rpm -e vim-common vim-enhanced vim-minimal
    2. download the original vim-common and vim-minimal packages from redhat.
    3. rpm -ivh vim-common-x.x-x.i386.rpm vim-minimal-x.x-x.i386.rpm
    4. ln -s /bin/vi /usr/bin/vim

    That should do it...
     
  12. NetEndeavors

    NetEndeavors Member

    Joined:
    Apr 29, 2002
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Shaun,

    The triple grep command should prevent attached vim processes from being killed (note the grep for both & 1 & and & ? &). Someone who knows pattern matching in perl better than I could probably rewrite this better, but if you look at the vim processes that are running and attached vs. those that are no longer attached to a session, you'll see that this does appear to work....

    Comments??

    But hey your approach is worth investigating -- I think we both agree that once it happens to ya', you'll be looking for a fix!!!
     
  13. shaun

    shaun Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    698
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    San Clemente, Ca
    NetEndeavors: Ahhh i see, i glaced over the code quckly, just saw it going thru killing process's.

    So far on the machine i &Patched& it seams to be working fine. No hung up VIM process's. Sombody should probably submit a redhat Bug for VIM-Enhanced... (i hate submitting bugs to redhat :) )
     
  14. jackal

    jackal Well-Known Member
    PartnerNOC

    Joined:
    Feb 23, 2002
    Messages:
    708
    Likes Received:
    0
    Trophy Points:
    16
    Man a post from the dead. Has anyone figured out what to do about this?

    Really need some help here same thing happening to us on 2 servers.

    cPanel.net Support Ticket Number:
     
  15. jackal

    jackal Well-Known Member
    PartnerNOC

    Joined:
    Feb 23, 2002
    Messages:
    708
    Likes Received:
    0
    Trophy Points:
    16
    Have you made the changes mentioned above?

    cPanel.net Support Ticket Number:
     
  16. shacker23

    shacker23 Well-Known Member

    Joined:
    Feb 20, 2005
    Messages:
    263
    Likes Received:
    1
    Trophy Points:
    16
    the vim reaper

    I'm seeing a lot of need for this (including on my own servers) but not a lot of solutions. So I wrote one - a shell script called "the vim reaper" (bwa ha ha ha). If it's useful, help yourself:

    http://www.birdhouse.org/blog/software/vimreaper.txt
     

Share This Page