Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

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

  1. cmimetype changed to: "text/x-fossil-wiki"
  2. 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].
    
  3. foundin changed to: "9.1.0"
  4. login: "serhiy.storchaka"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. severity changed to: "Minor"
  8. status changed to: "Open"
  9. submitter changed to: "serhiy.storchaka"
  10. subsystem changed to: "27. Channel Types"
  11. title changed to:
    socket -async leaves the socket non-blocking when the connect succeeds at once
    
  12. type changed to: "Bug"