Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f33a7c3244f246fd59ff70aedef727fc177c35f0
Ticket: 1958930fffffffffffffffffffffffffffffffff
exec with pipes and fileevents leaks ~2Mb everytime
User & Date: ferrieux on 2008-05-08 23:12:07
Changes

  1. icomment:
    Logged In: YES 
    user_id=496139
    Originator: NO
    
    (Don't know if this will reach you, SF is awfully unresponsive for me)
    I've sent this also to tcl-core.
    ---
    I think I can now produce a global analysis of the pipe-leak issue.
    
    (1) This is a core issue, Tclx is a red herring here, it is only one
    of many ways of exhibiting the problem;
    
    (2) A core-only way is:
    
     # this leaks 2M per run in Windows
     # assuming "block.tcl" contains just "after 5000"
     set pr [open "|tclsh block.tcl" r];after 500;fconfigure $pr
    -blocking 0;read $pr 1;close $pr
    
    (3) The crux of the problem is the (now possiby obsolete)
    PipeReaderThread being blocked on a ReadFile at [close]-time, implying
    the use of the thermonuclear TerminateThread, which is known to have a
    4k kernel leak in Windows.
    
    (4) But in today's Windows (XPSP2), it leaks 2M, not 4k !!!
    
    I don't know at which point in time the x500 amplification of the leak occured.
    Notice that the situation producing it is rather unusual (it assumes a
    long-running child which we close prematurely from the output side,
    and only on  Windows where those tools (like vmstat) are not common).
    
    Now there are IMO two parallel paths to follow simultaneously:
    
     (P1) investigate to understand the large leak
    
     (P2) (longer term) modernize the core to use waitable handles
    (assuming they are really !), thus avoiding the need of ancillary
    threads.
    
    I would love to hear comments on this. I feel a bit shaky on Windows
    to undertake (P2); and possibly a person who is literate in Windows
    patch history migh home in on (P1) much fasterthan I would...
    
    Thanks in advance,
    
    -Alex
    
    
    
    
  2. login: "ferrieux"
  3. mimetype: "text/plain"
  4. username: "ferrieux"