Skip to content
Tcl Source Code History Of Ticket 3394654
Login

History Of Ticket 3394654

Artifacts Associated With Ticket 3394654

  1. Ticket change [71be4bf5e4] (rid 100739) by dgp on 2011-08-19 16:13:48:

    1. assignee initialized to: "andreas_kupries"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      
      $ cat leak.tcl
          set nested 0
          proc foo {fd args} {
              switch -exact [lindex $args 0] {
                  initialize {return {initialize finalize read write}}
                  finalize {return {}}
              }
              global nested
              if {$nested} {
                  return
              }
              set nested 1
              chan pop $fd
          }
          set b [open /dev/null w]
          set c [chan push $b [list foo $b]]
          puts $c a
          flush $c
          close $c
      
      $ valgrind --leak-check=yes ./tclsh leak.tcl
      ...
      ==27262== 8,577 (16 direct, 8,561 indirect) bytes in 1 blocks are definitely lost in loss record 20 of 20
      ==27262==    at 0x4A05E1C: malloc (vg_replace_malloc.c:195)
      ==27262==    by 0x482844: Tcl_Alloc (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x453534: TclpOpenFileChannel (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x42066F: Tcl_FSOpenFileChannel (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x4E0073: Tcl_OpenObjCmd (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x47CF39: TclNREvalObjv (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x47D583: Tcl_EvalObjv (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x47DFF3: TclEvalEx (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x42CE58: TclSubstTokens (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x47D8BF: TclEvalEx (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x47E325: Tcl_EvalEx (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x421169: Tcl_FSEvalFileEx (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      
      
    4. foundin initialized to: "obsolete: 8.6b2"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "dgp"
    10. subsystem initialized to: "26. Channel Transforms"
    11. title initialized to: "leak due to non closing base of stacked channels"
    12. type initialized to: "Bug"
  2. Ticket change [5c8efe195f] (rid 115321) by dgp on 2011-08-19 23:17:40:

    1. icomment:
      
      The ClientData of channel $c is leaking
      because [close $c] is not actually closing
      the channel (not calling CloseChannel(),
      thus not calling the closeProc of the driver).
      
      This is not happening because FlushChannel
      sees the channel as not having an empty
      buffer at "curOutPtr" and for reasons I don't
      understand, takes that as an indication not
      to make the close.
      
      If I disable that test in FlushChannel(), the
      leak goes away.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  3. Ticket change [a9f680a1cb] (rid 99241) by dgp on 2011-08-19 23:29:13:

    1. icomment:
      
      The need for this "only empty buffers
      can permit a close" test is not demonstrated
      by the test suite, FWIW.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  4. Ticket change [b8a61f98b6] (rid 128999) by dgp on 2011-08-19 23:30:49:

    1. icomment:
      
      That said, I suspect the real bug here is
      that the buffers in fact should be empty
      at this point, and whatever bug is causing
      it not to be empty is likely a common cause
      of Bug 3393276
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  5. Ticket change [c0b6578fb8] (rid 102462) by dgp on 2011-08-20 00:28:40:

    1. icomment:
      
      When the buffer fails to test as empty,
      it claims to be holding -2 bytes.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  6. Ticket change [b865861203] (rid 128960) by dgp on 2011-08-20 01:43:20:

    1. icomment:
      FlushChannel needs to account for the
      possibility that the ChanWrite() call might
      recycle the buffer our from under us.
      
      Adding a test IsBufferEmpty(.) at the right
      place is effective.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  7. Ticket change [b772805ff8] (rid 125601) by dgp on 2011-08-20 02:07:20:

    1. closedate changed to: "2011-08-19T19:07:20"
    2. closer changed to: "dgp"
    3. icomment:
      
      
      allow_comments - 1
      
      fixed in trunk
      
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "dgp"
  8. Ticket change [19cb6a134a] (rid 122850) by dgp on 2011-08-20 02:07:31:

    1. assignee changed to: "dgp"
  9. Ticket change [e389045189] (rid 137997) by dgp on 2014-05-08 15:59:59:

    1. closedate changed to: "2456786.16665822"
    2. comment changed to:
      $ cat leak.tcl
          set nested 0
          proc foo {fd args} {
              switch -exact [lindex $args 0] {
                  initialize {return {initialize finalize read write}}
                  finalize {return {}}
              }
              global nested
              if {$nested} {
                  return
              }
              set nested 1
              chan pop $fd
          }
          set b [open /dev/null w]
          set c [chan push $b [list foo $b]]
          puts $c a
          flush $c
          close $c
      
      $ valgrind --leak-check=yes ./tclsh leak.tcl
      ...
      ==27262== 8,577 (16 direct, 8,561 indirect) bytes in 1 blocks are definitely lost in loss record 20 of 20
      ==27262==    at 0x4A05E1C: malloc (vg_replace_malloc.c:195)
      ==27262==    by 0x482844: Tcl_Alloc (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x453534: TclpOpenFileChannel (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x42066F: Tcl_FSOpenFileChannel (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x4E0073: Tcl_OpenObjCmd (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x47CF39: TclNREvalObjv (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x47D583: Tcl_EvalObjv (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x47DFF3: TclEvalEx (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x42CE58: TclSubstTokens (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x47D8BF: TclEvalEx (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x47E325: Tcl_EvalEx (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      ==27262==    by 0x421169: Tcl_FSEvalFileEx (in /local/tmp/dgp/fossil/tcl-only/valgrind/tclsh)
      
    3. icomment:
      Turns out this was a band-aid solution, and the
      design troubles with sharing of ChannelBuffers
      ran much deeper.  Now the band-aid is corrupting
      the actual fix.  Removing it allows the real fix
      (refcounting ChannelBuffers) to function properly.
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. severity changed to: "Minor"