Set mouse=a causes Vim to hang in screen.

47 views
Skip to first unread message

Gautam Iyer

unread,
Jan 11, 2008, 8:08:02 PM1/11/08
to vim...@vim.org
Hi All,

The following caused Vim to hang:

1. Create /tmp/vimrc with the following lines:

set nocp
set mouse=a

2. Run screen, and then do

$ vim -u /tmp/vimrc

Vim hangs before starting up.

GI

PS: Note -- doing "env TERM=rxvt vim -u /tmp/vimrc" works perfectly even
under screen.

--
All wiyht. Rho sritched mg kegtops awound?

James Vega

unread,
Jan 11, 2008, 8:51:56 PM1/11/08
to vim...@vim.org
On Jan 11, 2008 8:08 PM, Gautam Iyer <gi1...@stanford.edu> wrote:
> The following caused Vim to hang:
>
> 1. Create /tmp/vimrc with the following lines:
>
> set nocp
> set mouse=a
>
> 2. Run screen, and then do
>
> $ vim -u /tmp/vimrc
>
> Vim hangs before starting up.

But it does finish starting? Sounds like you have a $DISPLAY
environment variable which is incorrect and Vim is (unsuccessfully)
attempting to connect to the X server.

James

Gautam Iyer

unread,
Jan 11, 2008, 9:46:56 PM1/11/08
to vim...@googlegroups.com, vim...@vim.org
On Fri, Jan 11, 2008 at 08:51:56PM -0500, James Vega wrote:

> > The following caused Vim to hang:
> >
> > 1. Create /tmp/vimrc with the following lines:
> >
> > set nocp
> > set mouse=a
> >
> > 2. Run screen, and then do
> >
> > $ vim -u /tmp/vimrc
> >
> > Vim hangs before starting up.
>
> But it does finish starting?

Nope! Just hangs for ever. However when I kill it (using "kill" --
Ctrl-C is ignored), it leaves the intro message drawn on the screen.

> Sounds like you have a $DISPLAY environment variable which is
> incorrect and Vim is (unsuccessfully) attempting to connect to the X
> server.

Well, the same problem is caused when I do "vim -X". Also, "env
TERM=rxvt vim" connects to the X server just fine (in fact, even gvim
runs).

Can anyone else reproduce this?

GI

PS: The target host system is Scientific Linux, and I'm running Vim-7.1
with patches 1--215.

--
The Geek shall inherit the earth. - Linus 5:5

Zdenek@gmail

unread,
Jan 14, 2008, 3:36:26 AM1/14/08
to vim...@googlegroups.com, vim...@vim.org

> -----Original Message-----
> From: vim...@googlegroups.com [mailto:vim...@googlegroups.com] On
> Behalf Of Gautam Iyer
> Sent: 12 January 2008 03:47
> To: vim...@googlegroups.com; vim...@vim.org
> Subject: Re: Set mouse=a causes Vim to hang in screen.
>
>
> On Fri, Jan 11, 2008 at 08:51:56PM -0500, James Vega wrote:
>
> > > The following caused Vim to hang:
> > >
> > > 1. Create /tmp/vimrc with the following lines:
> > >
> > > set nocp
> > > set mouse=a
> > >
> > > 2. Run screen, and then do
> > >
> > > $ vim -u /tmp/vimrc
> > >
> > > Vim hangs before starting up.
> >
> > But it does finish starting?
>
> Nope! Just hangs for ever. However when I kill it (using "kill" --
> Ctrl-C is ignored), it leaves the intro message drawn on the screen.
>
> > Sounds like you have a $DISPLAY environment variable which is
> > incorrect and Vim is (unsuccessfully) attempting to connect to the X
> > server.
>
> Well, the same problem is caused when I do "vim -X". Also, "env
> TERM=rxvt vim" connects to the X server just fine (in fact, even gvim
> runs).
>
> Can anyone else reproduce this?

I tried and I can't reproduce it.
This is on Linux RH server v 4, vim 7.1.211.

---Zdenek

Vladimir Marek

unread,
Jan 14, 2008, 11:59:24 AM1/14/08
to vim...@googlegroups.com, vim...@vim.org, Gautam Iyer
[...]

> Can anyone else reproduce this?

Nope. Solaris, x86, vim 7.1

--
Vlad

Gautam Iyer

unread,
Jan 14, 2008, 2:12:59 PM1/14/08
to vim...@vim.org
On Mon, Jan 14, 2008 at 05:59:24PM +0100, Vladimir Marek wrote:

> [...]
>
> > Can anyone else reproduce this?
>
> Nope. Solaris, x86, vim 7.1

Ok. I tried reproducing this on a few other systems too. I can't
reproduce it on Fedora, Gentoo and Mac OS X (Leo). But the above causes
Vim to hang every time on Scientific Linux release 5.0 (Boron).

Would anyone have any idea as to why? I've currently just aliased "vim"
to "env TERM=rxvt vim" under screen, which causes the problem to go
away. So it's not "critical"...

GI

--
The 10 Commandments of DOS:
3. Thy hard disk shall never have more than 1024 sectors. You don't need
that much space anyway.

Zdenek Sekera

unread,
Jan 15, 2008, 4:01:56 AM1/15/08
to vim...@googlegroups.com

> -----Original Message-----
> From: vim...@googlegroups.com [mailto:vim...@googlegroups.com] On
> Behalf Of Gautam Iyer
> Sent: 14 January 2008 20:13
> To: vim...@vim.org
> Subject: Re: Set mouse=a causes Vim to hang in screen.
>
>

> On Mon, Jan 14, 2008 at 05:59:24PM +0100, Vladimir Marek wrote:
>
> > [...]
> >
> > > Can anyone else reproduce this?
> >
> > Nope. Solaris, x86, vim 7.1
>
> Ok. I tried reproducing this on a few other systems too. I can't
> reproduce it on Fedora, Gentoo and Mac OS X (Leo). But the above causes
> Vim to hang every time on Scientific Linux release 5.0 (Boron).
>

Just another data point: it doesn't hang on Scientific Linux 4.0.

---Zdenek

Dominique Pelle

unread,
Jan 15, 2008, 7:23:31 AM1/15/08
to vim...@googlegroups.com


Not sure whether this explains it, but recent patch 7.1.215 fixes
access to uninitialized value in the code that handles the mouse:

Patch 7.1.225
Problem: Using unitialized value when XGetWMNormalHints() fails.
Solution: Check the return value. (Dominique Pelle)
Files: src/os_unix.c

-- Dominique

Zdenek@gmail

unread,
Jan 15, 2008, 7:55:56 AM1/15/08
to vim...@googlegroups.com

Interesting. My vim is 7.1.228 so your explanation holds but I have
no means to check. Maybe Gautam should try on version > 7.225
(don't know on which one he's found the problem).

---Zdenek

Gautam Iyer

unread,
Jan 15, 2008, 2:26:23 PM1/15/08
to vim...@googlegroups.com
On Tue, Jan 15, 2008 at 01:55:56PM +0100, Zdenek@gmail wrote:

> > > > > > Can anyone else reproduce this?
> > > > >
> > > > > Nope. Solaris, x86, vim 7.1
> > > >
> > > > Ok. I tried reproducing this on a few other systems too. I can't
> > > > reproduce it on Fedora, Gentoo and Mac OS X (Leo). But the above
> > > > causes Vim to hang every time on Scientific Linux release 5.0
> > > > (Boron).
> > >
> > > Just another data point: it doesn't hang on Scientific Linux 4.0.
> >

> > Not sure whether this explains it, but recent patch 7.1.215 fixes
> > access to uninitialized value in the code that handles the mouse:
> >
> > Patch 7.1.225
> > Problem: Using unitialized value when XGetWMNormalHints() fails.
> > Solution: Check the return value. (Dominique Pelle)
> > Files: src/os_unix.c
>
> Interesting. My vim is 7.1.228 so your explanation holds but I have
> no means to check. Maybe Gautam should try on version > 7.225
> (don't know on which one he's found the problem).

Ok. Tested. Vim-7.1.229 still hangs on Scientific Linux 5:

/tmp/vimrc has:

set nocp
set mouse=a

Then "vim -u /tmp/vimrc -X" hangs when run under screen. It does not
display anything, or respond to terminal input (including Ctrl-C). When
killed (SIGTERM), it draws the intro screen and prints a message saying
"Received TERM signal, exiting."

The same happens with -X / without -X, independent of the DISPLAY
variable. But "env TERM=rxvt vim" runs fine.

GI

--
Experience is what a comb gives you after you lose your hair.

Richard Hartmann

unread,
Jan 17, 2008, 10:50:57 AM1/17/08
to vim...@googlegroups.com
On Jan 15, 2008 8:26 PM, Gautam Iyer <gi1...@stanford.edu> wrote:

> Ok. Tested. Vim-7.1.229 still hangs on Scientific Linux 5:

What are your screen settings? Perhaps they have an influence?


Richard

Dominique Pelle

unread,
Jan 17, 2008, 11:19:39 AM1/17/08
to vim...@googlegroups.com
On Jan 15, 2008 8:26 PM, Gautam Iyer <gi1...@stanford.edu> wrote:
>
> Then "vim -u /tmp/vimrc -X" hangs when run under screen. It does not
> display anything, or respond to terminal input (including Ctrl-C). When
> killed (SIGTERM), it draws the intro screen and prints a message saying
> "Received TERM signal, exiting."


I can't reproduce that. A couple of questions/suggestions:

When it "hangs", does it take 100% of the CPU (endless loop)
or is the vim process blocked (0% of CPU).

You can check the CPU usage with the "top" command.

You can also try to run vim with strace (useful in case it
blocks in a system call?):

$ strace vim 2> trace.log

... then look at trace.log

You can also try to attach with gdb to the running process.
You will first need to build vim with DEBUG information (-g -O0).
Just put the following line in vim7/src/Makefile:

CFLAGS = -g -O0

Then recompile vim and run it. When vim hangs, attach to the
process with gdb as follows:

$ gdb /usr/local/bin/vim process_id

(replace /usr/local/bin/vim with actual location of your vim program
and replace process_id with the process ID of vim).

Then in gdb, type "bt" command to get a stack trace.

It should help to debug.

-- Dominique

Gautam Iyer

unread,
Jan 21, 2008, 6:11:31 PM1/21/08
to vim...@googlegroups.com
On Thu, Jan 17, 2008 at 05:19:39PM +0100, Dominique Pelle wrote:

> >
> > Then "vim -u /tmp/vimrc -X" hangs when run under screen. It does not
> > display anything, or respond to terminal input (including Ctrl-C).
> > When killed (SIGTERM), it draws the intro screen and prints a
> > message saying "Received TERM signal, exiting."

Hmm. My sysadmin ran a system update, and now I can't reproduce the
problem either.

If I ever can, I'll be sure to send a GDB backtrace, or at least an
strace output. Thanks for all your suggestions,

GI

--
Time is not wasted if you are wasted all the time.

Reply all
Reply to author
Forward
0 new messages