Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-10-13
12:23 • Closed ticket [d22dc7e9ca]: socket -async leaves the socket non-blocking when th... artifact: 65a92a358d user: jan.nijtmans
11:06
Fix [d22dc7e9ca]: restore the blocking mode when [socket -async] connects at once check-in: 72d704d6b7 user: jan.nijtmans tags: core-8-6-branch
2026-10-12
12:28
Fix [d22dc7e9ca]: restore the blocking mode when [socket -async] connects at once check-in: 60e048718e user: jan.nijtmans tags: core-9-0-branch
12:12
Fix [d22dc7e9ca]: restore the blocking mode when [socket -async] connects at once check-in: 6d02d5f8a6 user: jan.nijtmans tags: trunk, main
08:44 • Ticket [d22dc7e9ca] socket -async leaves the socket non-blocking when the connec... artifact: de82dcfccc user: serhiy.storchaka
08:41 • New ticket [d22dc7e9ca]. artifact: 2ca2c53187 user: serhiy.storchaka
08:39
Fix [d22dc7e9ca]: restore the blocking mode when [socket -async] connects at once, as illumos does f... closed check-in: 5964e4f4ee user: serhiy.storchaka tags: unix-async-connect-immediate-success

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:19
  • 60e048718eFix [d22dc7e9ca]: restore the blocking mode when [socket -async] connects at once check-in2026-10-12 12:28:56
  • 6d02d5f8a6Fix [d22dc7e9ca]: restore the blocking mode when [socket -async] connects at once check-in2026-10-12 12:12:37
  • 5964e4f4eeFix [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.