AndrewRadev / vimrunner

Control a vim instance through ruby code
MIT License
238 stars 13 forks source link

reuse_server: kill/restart it after timeout #49

Open blueyed opened 7 years ago

blueyed commented 7 years ago

After a bunch (15-20) tests the suite from https://github.com/Vimjas/vim-python-pep8-indent stalls.

Adding some puts the last --remote-expr is vim --servername VIMRUNNER0.687345666041246 --remote-expr feedkeys("iclass Foo(\<CR>")

In this case vim --servername VIMRUNNER0.687345666041246 --remote-expr 1 hangs already.

It would be nice if this could be detected and e.g. after a few seconds the server getting restarted.

A good idea might be to send a ping always --remote-expr 1 and have a short timeout for this.

It looks like a bug in Vim after all - I cannot pinpoin it to a single test, and I've not looked at strace too closely, but vim is taking ~60% CPU.

AndrewRadev commented 7 years ago

Yeah, I've noticed this issue in the past. For larger test suites, Vim hangs. I'm not sure if it's a bug with Vim, or some problem in the way I spawn processes, but I have no idea how to debug it, either :/.

I'll consider your ideas about auto-restarting. For the moment, a quick fix is to use gvim (or mvim on a Mac). With Vimrunner, it's Vimrunner.start_gvim. That one doesn't seem to hang. If you start xvfb-run in your build, it won't be a problem, even in travis.

blueyed commented 7 years ago

I've tried using xvfb-run explicitly, and it did not seem to help?! Also in Docker with ENTRYPOINT ["sh", "-c", "xvfb-run rspec spec -f doc $@", "ignore"].

blueyed commented 7 years ago
  1. it also happens with IO.popen instead of PTY
  2. it seems to make sense to include --noplugin -i NONE as Vim options (from looking at what -V10/tmp/vim.log provides).
AndrewRadev commented 7 years ago

I've tried using xvfb-run explicitly, and it did not seem to help?!

But did you try it with the graphical version of Vim? What I'm saying is that, in my experience, the gui version doesn't hang.

it seems to make sense to include --noplugin -i NONE as Vim options (from looking at what -V10/tmp/vim.log provides).

That might make sense. I'll see about making that change and check if it breaks anything. In general, I'm not sure what exactly --noplugin disables, so I'll need to experiment with it a bit.

blueyed commented 7 years ago

Ah, misunderstood it. gvim works for me, too.