Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I run vi under Linux CentOS 5.3. Each time I exit from a file, I have to wait several seconds before vi saves the file. The same thing happens with vim.

I ran this command:

strace -odetails -ff -f -r -v vi test

This is the section from the log file that shows a long delay (16 seconds). The delay is not always the same:

 0.000041 write(1, "q", 1)          = 1     0.000040 select(1, [0], NULL, [0], {4, 0}) = 1 (in [0], left {3, 737000})     0.262932 select(1, [0], NULL, [0], NULL) = 1 (in [0])     0.000055 read(0, "\r", 250)        = 1     0.000047 select(1, [0], NULL, [0], {0, 0}) = 0 (Timeout)     0.000050 write(1, "\r", 1)         = 1
 0.000057 stat64("/root/yyy58/test", 0xbfb50ee8) = -1 ENOENT (No such file or directory)
 0.000060 write(1, "\33[?25l", 6)   = 6     0.000044 ioctl(0, SNDCTL_TMR_START or TCSETS, {c_iflags=0x500, c_oflags=0x5, c_cflags=0xbf, c_lflags=0x8a3b, c_line=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0
 0.000077 ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {c_iflags=0x500, c_oflags=0x5, c_cflags=0xbf, c_lflags=0x8a3b, c_line=0, c_cc="\x03\x1c\x7f\x15\x04\x00\x01\x00\x11\x13\x1a\x00\x12\x0f\x17\x16\x00\x00\x00"}) = 0     0.000063 write(1, "\"test\"", 6)   = 6     0.000043 stat64("test", 0xbfb511c0) = -1 ENOENT (No such file or directory)     0.000089 open("test", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 4
 0.000089 write(4, "\nsdf\nsf\nsdf\nsd\nfsdf\nsdf\nsdf\ns\nd\n"..., 42) = 42     0.000076 fsync(4)                  = 0
16.520635 stat64("test", {st_dev=makedev(0, 189), st_ino=30549058, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=42, st_atime=2011/08/06-15:59:23, st_mtime=2011/08/06-15:59:23, st_ctime=2011/08/06-15:59:23}) = 0     0.000106 close(4)                  = 0     0.000061 write(1, " [New] 13L, 42C written", 23) = 23     0.000054 _llseek(3, 0, [0], SEEK_SET) = 0     0.000038 write(3, "b0VIM 7.0\0\0\0\0\20\0\0\0\0\0\0\0\0\0\0\345\37\0\0root"..., 4096) = 4096     0.000055 stat64("/root/yyy58/test", {st_dev=makedev(0, 189), st_ino=30549058, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=42, st_atime=2011/08/06-15:59:23, st_mtime=2011/08/06-15:59:23, st_ctime=2011/08/06-15:59:23}) = 0     0.000089 write(1, "\r\r\n\33[?1l\33>", 10) = 10     0.000042 write(1, "\33[?12l\33[?25h\33[?1049l", 20) = 20
 0.000036 close(3)                  = 0
 0.000030 unlink("/root/yyy58/.test.swp") = 0     0.000150 exit_group(0)             = ?

How can I fix this or better trace the problem?

share|improve this question

migrated from stackoverflow.com Aug 6 '11 at 23:08

This question came from our site for professional and enthusiast programmers.

2  
Is this a network mount? –  Ben Voigt Aug 6 '11 at 23:06
    
Do you have the same problems with other editors, like nano? Did you strace them as well? –  rozcietrzewiacz Aug 7 '11 at 0:13

1 Answer 1

I had frequently similar issues when there was a stale/slow sftp+FUSE mount in my home directory; I would check that first.

share|improve this answer
    
I left the answer part; the comment part was already posted by someone else, so I didn't bother converting it –  Michael Mrozek Aug 7 '11 at 16:58
    
I stopped vsftpd and now vi saves instantly. –  user9672 Aug 7 '11 at 16:59
    
@Sergiu Normally you could mark this accepted, but there's some difficulty since you're unregistered and this was migrated. If you register here and on SO it will link your accounts though –  Michael Mrozek Aug 7 '11 at 17:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.