Overview
| Artifact ID: | 2ca2c53187094576567407943dc400023b53379e81a95eb4f2352a95bb884c5f |
|---|---|
| Ticket: | d22dc7e9ca3577d84c76cf0091d9db9eb9245da2
socket -async leaves the socket non-blocking when the connect succeeds at once |
| User & Date: | serhiy.storchaka on 2026-10-12 08:41:35 |
Changes
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
On illumos (OpenIndiana), a non-blocking <code>connect()</code> to a local listener succeeds at once instead of returning EINPROGRESS; on DragonFly this happens for IPv6 (<code>::1</code>). <code>TcpConnect()</code> makes the socket non-blocking for <code>socket -async</code> 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 <code>gets</code> 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 [/timeline?r=unix-async-connect-immediate-success|unix-async-connect-immediate-success].
- foundin changed to: "9.1.0"
- login: "serhiy.storchaka"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "serhiy.storchaka"
- subsystem changed to: "27. Channel Types"
- title changed to:
socket -async leaves the socket non-blocking when the connect succeeds at once
- type changed to: "Bug"