This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: tmux failed and got the message: failed to connect to server: No error


On Jun  2 11:27, Robert Pendell wrote:
> On Mon, Jun 2, 2014 at 4:37 AM, Michael Wild <> wrote:
> > Hi Guan-Zhong
> >
> > The problem is known upstream [1, 2] and I'm also trying to figure out
> > which change in the cygwin DLL triggered this issue. I'll post here
> > again once I know more.
> >
> > Michael
> >
> > [1] http://sourceforge.net/p/tmux/mailman/message/32396655/
> > [2] http://sourceforge.net/p/tmux/mailman/message/32400834/
> >
> > On Sat, May 31, 2014 at 5:29 PM, Guan-Zhong Huang wrote:
> >> cygwin-1.7.29-2 is ok.
> >> After updating to cygwin-1.7.30-1, I can't start tmux.
> >>
> >> I find it is because when tmux tries to connect to the unix domain
> >> socket that tmux server listens and tmux server hasn't started yet,
> >> connect() fails but errno is 0, not "Connection Refused (111)". This
> >> causes tmux to exit with error.
> >>
> >> If you want to reproduce this bug.
> >> tmux might work at the first time because the unix domain socket is not created.
> >> But after that, tmux will fail due to incorrect errno.
> >>
> >> Here's the strace I got:
> >> cygwin-1.7.30-1:
> >>    96 1063224 [main] tmux 4072 cygwin_connect: -1 = connect(5,
> >> 0x229780, 24), errno 0
> >> cygwin-1.7.29-2:
> >>    92 1054064 [main] tmux 3548 cygwin_connect: -1 = connect(5,
> >> 0x229780, 24), errno 111
> >>
> >>
> >> Best regads,
> >> Guan-Zhong
> 
> I took a look and ran through some snapshots.  I remembered a
> discussion last month regarding the propogation of socket errors to
> dup'd sockets.  It seems the patch (or something commited at the same
> time) broke this as on the 4/18 snapshot all works well and it breaks
> on the 4/24 snapshot which is the same one that got that last bit
> patched.  I do not know if the patch was ever tested as the OP of that
> thread never responded from what I can tell.

Yes, indeed.  The patch was supposed to fix the problem with the
SOL_SOCKET/SO_ERROR valus not being set when calling select on a
duplicated socket.

I just gave it a try and it turned out that the Winsock call setsockopt
sets the last WSA error code to 0 in case of success (grrr!), which I
didn't notice when applying the original patch, sorry.

I applied a patch to CVS which should fix the issue by simply calling
WSASetLastError after calling setsockopt.  The original SO_ERROR
testcase still works for me, and a faild connect attempt now returns an
ECONNREFUSED as expected.

I'll generate a new snapshot later today.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpSeyVPuY5DF.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]