Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 40e62e68586e37c00e6218979315a68fc03ec8c8
Ticket: 458490ffffffffffffffffffffffffffffffffff
Leaking Open File Handles
User & Date: crokusek on 2001-09-04 19:08:47
Changes

  1. assignee changed to: "andreas_kupries"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Hi All, 
    
    I create an interpreter from "C" evaluate the 
    following script: 
    
    set F [open $rep_file w] puts invalid_file_ptr 
    this_causes_an_error close $F 
    
    Because an error occurs in the "puts" the "close $F" 
    does not get called during script evaluation. 
    
    Opening the file up with Wordpad gives the "File in 
    use by another application." Note that win-emacs can 
    open the file so it is a windows open exclusive type 
    open that gives the error. 
    
    After reporting the error, the "C" then code deletes 
    the interpreter but still the file handle must be open 
    because Wordpad still cannot open. I have also tried 
    calling this directly before and after deleting the 
    Interpreter: 
    
    Tcl_DeleteAssocData(gpInterp, "tclIO"); 
    
    But it has no effect either. :(. 
    
    I have verified this bug to exist in 8.0 8.3 and 8.4 
    
    Can anyone provide workaround. Do I have to 
    trap "open's" and "close's" myself? 
    
    Note that replacing the illegal "puts" statement with 
    a "return" actually has the same effect. 
    
    Of course exiting the process closes the handle and 
    wordpad is able to open the file. 
    
    Thanks,
    
    Chris 
    
    
    
  4. foundin changed to: "obsolete: 8.4a4"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "crokusek"
  9. subsystem changed to: "24. Channel Commands"
  10. title changed to: "Leaking Open File Handles"
  11. type changed to: "Bug"