Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 65a92a358d33945271107835d0116fe1de9afa67ad71128767a190a36a548135
Ticket: d22dc7e9ca3577d84c76cf0091d9db9eb9245da2
socket -async leaves the socket non-blocking when the connect succeeds at once
User & Date: jan.nijtmans on 2026-10-13 12:23:54
Changes

  1. assignee changed to: "jan.nijtmans"
  2. closedate changed to: "2461327.0166012617"
  3. closer changed to: "jan.nijtmans"
  4. 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].
    
  5. icomment:
    Fixed in [6d02d5f8a6|trunk], core-9-0-branch and core-8-6-branch
    
  6. login: "jan.nijtmans"
  7. mimetype: "text/x-fossil-wiki"
  8. resolution changed to: "Fixed"
  9. status changed to: "Closed"