socket -async leaves the socket non-blocking when the connect succeeds at once
Closed / Fixedd22dc7e9ca3577d84c76cf0091d9db9eb9245da2Created 52 days agoUpdated 50 days ago
Descriptionwiki2026-10-12 08:41:35
On illumos (OpenIndiana), a non-blocking
connect() to a local listener
succeeds at once instead of returning EINPROGRESS; on DragonFly this happens for IPv6
(::1). TcpConnect() makes the socket non-blocking for
socket -async but restores the blocking mode only when the connect
finishes in the background. So after such an immediate connect the socket stays
non-blocking while the channel is blocking, and a blocking gets returns
an empty string at once. This fails socket-14.7.0 and 14.7.1 on illumos and
socket-14.7.1 on DragonFly.
This is a regression of [219061] (HP-UX, fixed in 8.3.1 by resetting the socket to blocking mode when the connect succeeds at once). Since the 2011 rework the blocking mode, cached since [3401422], is restored only after a connect finishing in the background; [3428753] fixed only the flag for connections completing at once.
Proposed fix in branch unix-async-connect-immediate-success.
Referenced by4
72d704d6b7Fix [d22dc7e9ca]: restore the blocking mode when [socket -async] connects at once check-in2026-10-13 11:06:1960e048718eFix [d22dc7e9ca]: restore the blocking mode when [socket -async] connects at once check-in2026-10-12 12:28:566d02d5f8a6Fix [d22dc7e9ca]: restore the blocking mode when [socket -async] connects at once check-in2026-10-12 12:12:375964e4f4eeFix [d22dc7e9ca]: restore the blocking mode when [socket -async] connects at once, as illumos does for local listeners and DragonFly for IPv6 ones: the socket stayed non-blocking, so a blocking [gets] returned an empty string (socket-14.7.0, 14.7.1). check-in2026-10-12 08:39:11
serhiy.storchaka Ticket [d22dc7e9ca]: 2 changes
[History diff]2026-10-12 08:44:36
jan.nijtmanswiki2026-10-13 12:23:54
Fixed in [trunk], core-9-0-branch and core-8-6-branch
Log in (anonymous is fine) to add a comment.