connect() hangs on a listen()ing AF_UNIX socket

Christian Franke Christian.Franke@t-online.de
Thu Sep 25 14:35:00 GMT 2014


Corinna Vinschen wrote:
> On Aug 26 21:03, Christian Franke wrote:
>> Corinna Vinschen wrote:
>>> Sounds like a nice idea.  We should try that.  I'm just not sure how
>>> much time I have left to work on this before my vaca next month.  Do you
>>> have fun to look into that?  We have waited so long for postfix, I guess
>>> a couple more weeks won't really hurt.
>> OK, will try that
> Cool!  Don't hesitate to discuss implementation details on the
> cygwin-developers list.

Unfortunately, a very first prototype did not work. If receiving of 
secret+cred is delayed until first send()/recv(), postfix hangs in first 
send() after the connect(). During startup, the postfix master calls 
connect() and first client send() before corresponding server accept() 
is called.

So I decided to provide a intermediate solution for now, see:
https://cygwin.com/ml/cygwin-patches/2014-q3/msg00015.html

For the long term, this approach may work or not:
Remove the complete handshake over TCP. Maintain a table of current TCP 
connections in the socket "file". The table contains pid, TCP port and 
credentials for the server which did the (first) listen() call and for 
all connected clients. Some hashes could be added to check for validity.


>> Postfix apparently pushes Cygwin to its limits. With a test cygwin1.dll
>> where the secret+cred exchange is fully disabled, postfix starts up but
>> queuing of mail fails.
>>
>> This is because fchmod() is called on a file rename()d after open():
>>
>> fd = open("tempfile", ., 0600);
>> // use fd's inode number and current time to create unique "queuefile".
>> rename("tempfile", "queuefile");
>> write(fd, "SOME MAIL....", .);
>> fchmod(fd, 0700); // fails with ENOENT on Cygwin (because it does a
>> chmod("tempfile",.)?)
>> close(fd);
> I fixed that in CVS (and I'm just generating a snapshot).

Works with postfix.

Thanks,
Christian


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list