Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a192677ef092fec91b066dee184a8696dae8daec
Ticket: 1028264fffffffffffffffffffffffffffffffff
socket: failed write prevents read
User & Date: ferrieux on 2008-11-17 06:49:20
Changes

  1. icomment:
    OK, here is a first report on my analysis.
    
    The problem is that SocketExitHandler is registered among the process-wide handlers, which are called early in Tcl_Finalize, while the closeProc is called in FinalizeIOSubsystem which is part of the later per-thread cleanup.
    Now what's peculiar is that FinalizeIOSubsystem also calls "TclpFinalizeSockets" which is the channeldriver-guts part of the cleanup in SocketExitHandler...
    
    I'm not sure (euphemism) I understand this state of affairs (especially the redundant call of TclpFinalizeSockets on the main thread), however here is how I'd fix it:
    
       - remove entirely the process-wide handler concerning sockets
       - instead enrich TclpFinalizeSockets with a client-counting scheme keeping track of how many threads "with socket interest" remain
       - when this count drops to zero, do the rest of what is currently in SocketExitHandler: UnregisterClass and WSACleanup.
    
    Does this feel correct ?
    Any hint of a definition of "with socket interest" ?
    
    -Alex
    
    
    
    
  2. login: "ferrieux"
  3. mimetype: "text/plain"
  4. username: "ferrieux"