Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d3312ed138bb802f874048bae0ae9d4f02d6b05b4e65407fae2dfe6dfaf988ac
Ticket: 7586dbc9f53aad9e461dc547c1e83de06bd1382b
fconfigure -sockname fails with "invalid argument" after a failed async connect
User & Date: serhiy.storchaka on 2026-10-28 11:40:57
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-wiki"
  4. comment changed to:
    After an async connect has failed, <tt>fconfigure -sockname</tt> calls <tt>getsockname()</tt> on the failed socket. On DragonFly this fails with EINVAL, so it raises <tt>can't get sockname: invalid argument</tt>. On other systems it returns whatever the system reports for the dead socket. <tt>-peername</tt> raises <tt>can't get peername</tt> in the same case.
    
    This makes socket-14.17 fail intermittently on DragonFly 6.4: if both <tt>::1</tt> and <tt>127.0.0.1</tt> are refused before <tt>fconfigure</tt> runs, the connect is no longer pending. A loop of <tt>socket -async localhost $closedport</tt> followed by <tt>fconfigure -sockname</tt> failed 144 times in 2000 iterations on 8.6 and 9.0 and 120 times on 9.1 in one session, and 1 to 4 times in 2000 in another.
    
    Also, in socket test mode (<tt>testsocket testflags $s 1</tt>), <tt>fconfigure -sockname</tt> or <tt>-peername</tt> on a pending async socket dereferences a NULL <tt>errorCodePtr</tt> in <tt>WaitForConnect()</tt> and crashes.
    
  5. foundin changed to: "8.6.18, 9.0.5, 9.1.0"
  6. login: "serhiy.storchaka"
  7. priority changed to: "5 Medium"
  8. resolution changed to: "None"
  9. severity changed to: "Important"
  10. status changed to: "Open"
  11. submitter changed to: "serhiy.storchaka"
  12. subsystem changed to: "27. Channel Types"
  13. title changed to:
    fconfigure -sockname fails with "invalid argument" after a failed async connect
    
  14. type changed to: "Bug"