On Sun, Oct 27, 2019 at 10:07:14PM +0100, Bram Moolenaar wrote:
> Paul Ackersviller wrote:
> > With athena gui version on AIX, vim will consistently go into an
> > infinite loop if the network connection drops.  Trussing such a process
> > points to a select system call, so I found this one without any check on
> > the return value.  This patch mostly prevents the problem, although
> > not quite 100% of the time.
> > 
> > My EINTR check is just what I'm guessing some other OSes might need, it
> > doesn't seem to matter for AIX.  In fact the error-handling I'm doing
> > below doesn't seem to matter either, as I can't get it to execute, nor
> > can I stop there in a debugger, but the check seems enough for exiting
> > the process via somewhere in X libraries.
> 
> It looks like this code depends on undocumented or system-specific
> behavior.  At least for what I could find poll() and select() called
> with no file descriptors will always wait until the timeout and then
> return zero.  Do you have documentation about when the error code would
> be returned?

I can pass on man pages if you want to know possible errno values, but
that won't help with EINTR, as no OSes I use have that behaviour.  I put
that check in only to mimic how vim is already handling select() errors
elsewhere, i.e. in RealWaitForChar() also in os_unix.c, as well as
can_write_buf_line() in the channel.c file.

> Also, I don't see how a hang can occur here when poll() or select()
> returns without waiting.  Vim would simply continue.  Or is the delay
> critical in some situation?

Yes, continues infinitely, which is the issue... chewing up 100% of a CPU
until killed.  Not sure how you got th idea of a hang.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20191029004616.GC24639%40ma.sdf.org.

Raspunde prin e-mail lui