Skip to content
Tcl Source Code History Of Ticket 1225727fffffffffffffffffffffffffffffffff
Login

History Of Ticket 1225727fffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 1225727fffffffffffffffffffffffffffffffff

  1. Ticket change [a2de3f8a55] (rid 109965) by kennykb on 2005-06-22 18:46:17:

    1. assignee initialized to: "kennykb"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      tclWinPipe.c cleans up its process list in an
      exit handler created by Tcl_CreateExitHandler.
      The problem with this is that the exit handler is
      called too soon - with the pipe still open.
      When, subsequently, Tcl_FinalizeIOSubsystem
      closes the pipe, the code goes off to
      TclCleanupChildren to collect the exit status
      and reap the child processes.  That procedure
      eventually gets into Tcl_WaitPid, which calls
      PipeInit.  PipeInit sees that 'initialized' is false,
      and winds up calling Tcl_CreateExitHandler to
      re-establish the exit handler.
      
      The memory used by the second exit handler
      is trashed upon return to Tcl_Finalize by the
      calls to Tcl_FinalizeMemorySubsystem and
      Tcl_FinalizeThreadAlloc.  The exit handler pointer,
      however, is still linked on the chain. Once the
      process finally exits, there is another call to
      Tcl_Finalize from tclWin32Dll.c (DllMain).
      This call runs ProcExitHandler again (which
      is innocuous; all it does is turn off the
      'initialized' flag). Then Tcl_Finalize does
      ckfree on the exit handler structure, which
      was trashed in Tcl_FinalizeMemorySubsystem,
      corrupting the heap.
      
      It turns out that this, too, is *usually* innocuous,
      because little allocated memory remains
      this late in the process.  I have seen, however,
      the 'ckfree' corrupt the lock table in msvcrtd.dll,
      resulting in a crash deep in ntdll.dll on the
      final cleanup of C runtime.
      
      The attached patch is an attempt to fix it
      in 8.4, and applies to 8.4.11rc5.  It works by
      delaying cleanup of the pipe subsystem until
      after all channels are closed.  It also adds
      an assertion in Tcl_Finalize that no exit
      handlers have been created in the dead
      process.
      
      
    4. foundin initialized to: "obsolete: 8.4.11"
    5. priority initialized to: "9 Immediate"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "kennykb"
    9. subsystem initialized to: "27. Channel Types"
    10. title initialized to: "crash when process exits with open pipes"
    11. type initialized to: "Bug"
  2. Add attachment "pipes.patch" [a73557ed72] (rid 98750) by kennykb on 2005-06-23 01:46:18.

  3. Ticket change [1bff910b23] (rid 90527) by kennykb on 2005-06-23 01:46:26:

    1. icomment:
      
      
      File Added - 139407: pipes.patch
      
      
      
    2. login: "kennykb"
    3. mimetype: "text/plain"
    4. username: "kennykb"
  4. Ticket change [7632c3e368] (rid 105535) by kennykb on 2005-06-23 02:49:19:

    1. closedate changed to: "2005-06-22T19:49:19"
    2. closer changed to: "kennykb"
    3. icomment:
      Logged In: YES 
      user_id=99768
      
      Fix committed to HEAD and core-8-4-branch.  We might want to
      re-tag 8.4.11 to accommodate it.
      
      
    4. login: "kennykb"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "kennykb"