Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: af5665fb1f11162d546f108a509812db31b8614b
Ticket: 1343211fffffffffffffffffffffffffffffffff
exec implemenation fails to close() open file descriptors
User & Date: illumino on 2005-10-31 05:32:55
Changes

  1. assignee changed to: "vincentdarley"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Tcl/Tk version : 8.4.6 (exists in 8.4.11)
    Platform: Sun SPARC Solaris 9 
    
    In the child section of TclpCreateProcess() in
    unix/tclUnixPipe.c, after the "pid = fork(); if ( pid
    ....)" code, the child process sets up std file
    descriptors, restores signal handling, and executes the
    new process.
    
    Unfortunately, the child leaves all existing file
    descriptors open! I believe there should be an option
    (perhaps the default) to close all open file
    descriptors before exec() so the children (and
    grandchildren,...) don't inherit them. If it is an
    option then "exec" will need an interface to this
    option, to allow the script writer to close all open
    file descriptors.
    
    Regards,
    Peter Bray
    Sydney, Australia
    
    PS: In our case a UI, which loads a shared library that
    connects to a server (TCP/IP), used "exec" to start a
    backgrounded (daemonised actually) copy of firefox to
    display the user help.
    LSOF shows that firefox inherited the socket
    connections and other file descriptors, and when the UI
    exited, the firefox process still had references to
    these file descriptors, meaning that the server did not
    detect a connection close. Trouble ensued and memory
    and cpu exited stage left... as the server try to
    buffer data for a client that was not reading from its
    socket connection.
    
  4. foundin changed to: "obsolete: 8.4.11"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "illumino"
  9. subsystem changed to: "37. File System"
  10. title changed to:
    exec implemenation fails to close() open file descriptors
    
  11. type changed to: "Bug"