As shown above, on OS X, we got the error messages "Connection refused,"
which correspond to ECONNREFUSED.
But I found the actual errno is EINPROGRESS; the errno value is overwritten
at line 457.
Actually, if line 457 is commented out, I got other error messages
"Operation now in progress," which correspond to EINPROGRESS.
This indicates that, although we got the error messages from the block
456--462, the real cause of the error came from connect(), as select()
won't set errno to EINPROGRESS.
Reading the code at line 420 and below, we see that the code doesn't
consider it an error when the errno is set to EINPROGRESS even if connect()
returns -1.
If EINPROGRESS is given a go like this, then wouldn't we have to wait for
the socket to be connected like this? (for simplicity, timeout to avoid
infinite loop is omitted):
diff --git a/src/channel.c b/src/channel.c
index d621798..7db37ce 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -421,7 +421,20 @@ channel_open(char *hostname, int port_in, int
waittime, void (*close_cb)(void))
SOCK_ERRNO;
if (ret < 0)
{
+#ifdef __APPLE__
+ if (errno == EINPROGRESS)
+ do
+ {
+ usleep(1000);
+ errno = 0;
+ ret = connect(sd, (struct sockaddr *)&server,
sizeof(server));
+ }
+ while (ret < 0 && errno == EALREADY);
+
+ if (errno != EWOULDBLOCK && errno != EINPROGRESS && errno != EISCONN)
+#else
if (errno != EWOULDBLOCK && errno != EINPROGRESS)
+#endif
{
CHERROR("channel_open: Connect failed with errno %d\n", errno);
CHERROR("Cannot connect to port\n", "");
Should it be a fix, the story couldn't put an end. We'd get another error:
>From test_channel.vim:
Found errors in Test_communicate():
function Test_communicate line 51: Expected 'ok' but got ''
cat testdir/messages
>From test_channel.vim:
Executing Test_communicate()
Executing Test_server_crash()
Executing Test_two_channels()
Executed 3 tests
1 FAILED
But I saw this sort of error appeared in previous patches and soon
disappeared at some point recently. Isn't it possible to fix that in a
similar way, though I'm not pretty sure how the previous issue was fixed.
I know little about the recent development of channel. So if I miss the
point and am wrong, sorry about disturbing you.
Best regards,
Kazunobu Kuriyama
2016-02-06 23:28 GMT+09:00 Bram Moolenaar <[email protected]>:
>
> Manuel Ortega wrote:
>
> > On Fri, Feb 5, 2016 at 4:51 PM, Manuel Ortega <[email protected]>
> wrote:
> >
> > > Vim 7.4.1262 and 7.4.1263 on Mac OS X 10.11.3 both fail the `make test`
> > > phase. I'm pasting the error message below.
> >
> > The failure is still there on 7.4.1264, but the output is different:
> I'll
> > paste it below:
> >
> > >From test_channel.vim:
> > Executing Test_communicate()
> > Executing Test_server_crash()
> > Executing Test_two_channels()
> > Executed 3 tests
> > 6 FAILED
> >
> > >From test_channel.vim:
> > Found errors in Test_communicate():
> > Caught exception in Test_communicate(): Vim(let):E902: Cannot connect to
> > port: Connection refused @ function
> > Test_communicate[1]..<SNR>3_start_server, line 34
> > Found errors in Test_server_crash():
> > Caught exception in Test_server_crash(): Vim(let):E902: Cannot connect to
> > port: Connection refused @ function
> > Test_server_crash[1]..<SNR>3_start_server, line 34
> > Found errors in Test_two_channels():
> > Caught exception in Test_two_channels(): Vim(let):E902: Cannot connect to
> > port: Connection refused @ function
> > Test_two_channels[1]..<SNR>3_start_server, line 34
> >
> > Test results:
> >
> >
> > >From test_channel.vim:
> > Found errors in Test_communicate():
> > Caught exception in Test_communicate(): Vim(let):E902: Cannot connect to
> > port: Connection refused @ function
> > Test_communicate[1]..<SNR>3_start_server, line 34
> > Found errors in Test_server_crash():
> > Caught exception in Test_server_crash(): Vim(let):E902: Cannot connect to
> > port: Connection refused @ function
> > Test_server_crash[1]..<SNR>3_start_server, line 34
> > Found errors in Test_two_channels():
> > Caught exception in Test_two_channels(): Vim(let):E902: Cannot connect to
> > port: Connection refused @ function
> > Test_two_channels[1]..<SNR>3_start_server, line 34
> > TEST FAILURE
> > make[2]: *** [report] Error 1
> > make[1]: *** [test] Error 2
> > make: *** [test] Error 2
>
> This is most likely due to the timeout on connect(). That's tricky new
> code that might not work the same way on different systems. I had
> already added ignoring an error that seems Linux specific.
>
> I hope someone can debug this and make a fix.
>
> --
> Although the scythe isn't pre-eminent among the weapons of war, anyone who
> has been on the wrong end of, say, a peasants' revolt will know that in
> skilled hands it is fearsome.
> -- (Terry Pratchett, Mort)
>
> /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net
> \\\
> /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/
> \\\
> \\\ an exciting new programming language -- http://www.Zimbu.org
> ///
> \\\ help me help AIDS victims -- http://ICCF-Holland.org
> ///
>
> --
> --
> 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].
> For more options, visit https://groups.google.com/d/optout.
>
--
--
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].
For more options, visit https://groups.google.com/d/optout.