[slim-vim] More details on the socket crash bug
Brad Beveridge
brad.beveridge at gmail.com
Sun Jun 11 17:20:09 CDT 2006
A quick recap - the bug is this: When you evaluate a form on Swank it
send back a reply via a socket. In Slim-vim we listen on that socket
and print some data out to a Vim buffer. Eventually this crashes and
leaves you with a broken console (keystrokes don't appear). I can
blindly issue (cl-user::quit) and get to a bash prompt, I then need to
"reset" the terminal.
I spent today trying to reproduce the bug (see attached files for my
attempt). Serverstream just listens on a socket and prints data to a
buffer, test.lisp sends data to serverstream. I run these files in
different Vims so that I can have 2 instances of ECL.
I could not break this simple configuration, TEST can happily stream
loads of data to SERVERSTREAM, which dutifully puts it out to a Vim
buffer. This implies to me writing to a Vim buffer from the Async
handler is completely fine.
So I had a bit of a brain storm and thought about what is different
between my test and Swank. Well, the test is kinda one way, Swank
starts comms in Vim and responds to them in Vim. So I made the
SERVERSTREAM also echo back any socket data to the TEST client. Whoa!
It breaks.
So the call chain looks a bit like
ECL code sends data to Swank (Vim main loop, then ECL)
Swank responds (Vim mainloop catches data
and calls into ECL)
listener callback runs ECL code.
I suspect that the bug is actually in the ECL code (which makes sense
that we get dropped down to a REPL). Are we somehow managing to get
re-entrant effects here? I don't really see how though because the
Vim mainloop does select/poll, so I would expect the initial data send
should be complete before the callback triggers.
Does it make sense to put some sort of vim level mutex in the mainloop?
Thoughts?
Cheers
Brad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.lisp
Type: application/octet-stream
Size: 5825 bytes
Desc: not available
Url : http://www.lispniks.com/pipermail/slim-vim/attachments/20060611/0c90ebe2/test.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: serverstream.lisp
Type: application/octet-stream
Size: 5473 bytes
Desc: not available
Url : http://www.lispniks.com/pipermail/slim-vim/attachments/20060611/0c90ebe2/serverstream.obj
More information about the slim-vim
mailing list