Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 2c3cd3b2748ef0aaf7beacbc6967d01e84017a2ef610e3b2faeb5be47c18ae7d
Ticket: de232b49f26da1c18e07513d4c7caa203cd27910
write-only nonblocking refchan and Tcl internal buffers
User & Date: apnadkarni on 2024-03-31 14:06:03
Changes

  1. icomment:
    Nathan,
    
    Most of your post focuses on something that is not crux of the use case being
    discussed. 
    
    This is not about the use of writable events to ascertain when a channel can be
    written to. It is about the use of writable events **to asynchronously detect
    when a connection is open**. 
    
    From the socket -async docs,
    
    *Running the event loop also allows you to set up a writable channel event on the
    socket to get notified when the asynchronous connection has succeeded or failed.*
    
    The complaint I have is that in 9.0 the writable channel event is generated
    prematurely - **before** the connection has succeeded or failed. While I might
    have used the "writable event" loosely, it is in this context - signifying the
    connection is open.
    
    While you airly dismiss test the long standing socket-14.11.0 as a broken test,
    this test is almost exactly how the simplest of network applications - port
    scanners - would be written ("almost" because a port scanner would not do the
    puts). Your "fix" makes it impossible to write a reasonable (synchronous or
    polling is not reasonable) one in Tcl. I do notice you did not address the port
    scanner example or the address logging example in your response.
    
    And to the specifics of your comments...
    
    *...twapi related example..* - no, your code fragment, does not solve the
    problem. When the lambda fires, the connection is not complete. The fconfigure
    and fileevent following are completely irrelevant. See above. Even otherwise,
    the idiom of of socket -async followed by fconfigure -blocking 0 has been around
    forever. There has been nothing to forbid it. There is no justification for
    asking that to be reworked as a workaround for a buggy core change.
    
    *...Here's another example...* about puts after a socket -async. Again, 
    irrelevant. puts is not the issue. See above.
    
    *...socket-14.11.0 failures...* Oh if only we could fix all test failures by
    disparaging the test! This is a perfectly reasonable test reflecting a real
    world use case. I also do not understand your purpose behind quoting the manpage
    flushing /closing the channel. That is completely irrelevant to this issue.
    
    *...I believe this existing fix is theoretically correct...* Outside of some
    special cases, a timer based event generation scheme for I/O is completely
    pointless. It defeats the entire purpose of event based I/O. Imagine the Unix
    select call, which serves a similar purpose, marking descriptors as "ready"
    based on a timer as opposed to actually being ready.
    
    **Timer based event generation for i/o is essentially polling at regular
    intervals. There is no point to such an "event driven" i/o system where the
    "event" is a timer as opposed to i/o! An application might as well just poll
    itself using after!**
    
    *A few years ago I submitted issue 67a5eabbd3 and fixed it* Relevance? No one is
    disputing refchan limitations but my -buffering none branch does not break that
    issue either. I could not find a relevant test case but I manually tested the
    script in that issue.
    
    *I'm not in favour of changing the default buffering for refchans.* It would
    help if you pointed out the technical issues or negative practical impact as to
    why. I've already stated in my earlier post that fixing refchans would be
    preferable but I do not think that is feasible in a reasonable time frame. An
    opinion that "it is a knee jerk reaction" is neither here or there. Your
    reference to the 080f846fd58958ef is a red herring because you did not address
    the actual issue being raised there.
    
  2. login: "apnadkarni"
  3. mimetype: "text/x-markdown"