Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7d7a6294d91a39b56191075c381b89bf674ac536712e680ebfc13fc9251198de
Ticket: 2b6b0a57296aecf267d19554a6a0c6f2ac83efbc
writes accepted after non-blocking chan close write
User & Date: serhiy.storchaka on 2026-10-16 21:22:15
Changes

  1. cmimetype changed to: "text/x-fossil-wiki"
  2. comment changed to:
    After <nowiki>[chan close $chan write]</nowiki> on a non-blocking channel with output still queued, the channel stays writable until the background flush finishes: <nowiki>[puts]</nowiki> is accepted and the data is sent after the half-close.
    
    <verbatim>
    set p [open |[list [info nameofexecutable] child.tcl] r+]   ;# child reads stdin later
    fconfigure $p -blocking 0
    puts -nonewline $p [string repeat a 1000000]
    chan close $p write      ;# returns at once, output still pending
    puts $p AFTER            ;# no error; the child receives "AFTER"
    </verbatim>
    
    A blocking channel gives "channel wasn't opened for writing". CloseWrite() sets CHANNEL_CLOSEDWRITE, but TCL_WRITABLE is reset only when the flush completes (CloseChannelPart), and neither Tcl_GetChannelMode() nor CheckChannelErrors() looks at CHANNEL_CLOSEDWRITE. Seen with pipes and sockets.
    
  3. foundin changed to: "8.6.18, 9.0.5, 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: "25. Channel System"
  11. title changed to:
    writes accepted after non-blocking chan close write
    
  12. type changed to: "Bug"