Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b0a581527ee65b2870c9e0ccd10c9b5a200690d8
Ticket: 1028264fffffffffffffffffffffffffffffffff
socket: failed write prevents read
User & Date: ferrieux on 2009-04-28 13:52:59
Changes

  1. icomment:
    Please note that this was thoroughly covered in the tracker comments (ca. 20090107) though ;-)
    
    Anyway, the late exit handler mechanism is here to delay the winsock cleanup call until after all sockets have been closed, with the final goal of preventing the *sending* of an RST on Tcl exit. Notice that "server" and "client" are interchangeable here; it's more a question of who's sending the RST and who's barfing on receiving it.
    
    Since 2446662 fixes the receive side, and was committed before this one on all three branches, it means that a Tcl peer receiving the RST will no longer raise an error. But it still will discard queued input data after it got the RST (because that's the RST's semantics in the kernel stack). 
    
    Hence (1) I exaggerated when I said this fix was not unit-testable (the very test case that was sometimes failing is now working reliably -- but building a 100% failing case is a lot of work), and (2) I think the "late WSACleanup" is the only way to prevent sending those nasty RSTs on exit (which may also disrupt a non-Tcl peer).
    
    Of course a contorted hack could involve doing this late cleanup by making the whole interp teardown function completely platform-specific, and hard-code the winsock cleanup near the end in the win32 case. But I fail to see the advantage of such an approach over the cleaner and generic notion of late exit handlers, which allows any extension to use the same semantics (and has been committed to HEAD for some time with no ill effect...).
    
    
    
    
  2. login: "ferrieux"
  3. mimetype: "text/plain"
  4. username: "ferrieux"