Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: connect frequently fails under DragonFly BSD, especially to localhost #7474

Closed
4a6f656c opened this issue Mar 5, 2014 · 1 comment
Closed

Comments

@4a6f656c
Copy link
Contributor

4a6f656c commented Mar 5, 2014

connect frequently fails under DragonFly BSD, especially to localhost. The TestErrorNil
and TestSelfConnect tests are easy ways to reproduce the problem. The issue is related
to the fact that Go does a syscall.Connect on a non-blocking socket, then waits for the
socket to become writable. When it does we call syscall.Connect again on the same
socket, expecting that it will return syscall.EISCONN or the error that was previously
encountered.

Under DragonFly BSD this fails since the second syscall.Connect appears to retry the
connection and results in an syscall.EINPROGRESS. As a result, we sit in a loop:

954:2  net.test CALL  connect(0x3,0xc20800c40c,0x10)
954:2  net.test RET   connect -1 errno 36 Operation now in progress
954:2  net.test CALL  kevent(0x4,0,0,0x7fffff9fd6c8,0x40,0x7fffff9fd6b0)
954:2  net.test RET   kevent 2
954:2  net.test CALL  connect(0x3,0xc20800c40c,0x10)
954:2  net.test RET   connect -1 errno 36 Operation now in progress
954:2  net.test CALL  kevent(0x4,0,0,0x7fffff9fd6c8,0x40,0x7fffff9fd6b0)
954:2  net.test RET   kevent 2
954:2  net.test CALL  connect(0x3,0xc20800c40c,0x10)
954:2  net.test RET   connect -1 errno 36 Operation now in progress
954:2  net.test CALL  kevent(0x4,0,0,0x7fffff9fd6c8,0x40,0x7fffff9fd6b0)

Instead, of repeated syscall.Connect calls we should use the the SO_ERROR socket option
to see if the connection succeeded or failed.

For more details see:

  http://lists.dragonflybsd.org/pipermail/commits/2013-August/197962.html

Setting kern.ipc.soconnect_async=0 provides the same behaviour as other BSDs
(discovered/confirmed by Mikio).
@4a6f656c
Copy link
Contributor Author

4a6f656c commented Mar 5, 2014

Comment 1:

This issue was closed by revision 734d463.

Status changed to Fixed.

@4a6f656c 4a6f656c added the fixed label Mar 5, 2014
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants