Skip to content
Tcl Source Code History Of Ticket 9969cf8ca6
Login

History Of Ticket 9969cf8ca6

Artifacts Associated With Ticket 9969cf8ca6

  1. Ticket change [4f111e6f9b] (rid 138665) by dgp on 2014-07-11 21:27:07:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      ==4219== 157 (96 direct, 61 indirect) bytes in 2 blocks are definitely lost in loss record 5 of 7
      ==4219==    at 0x4A0610C: malloc (vg_replace_malloc.c:195)
      ==4219==    by 0x5D14E2: TclpAlloc (tclAlloc.c:699)
      ==4219==    by 0x43D1AE: Tcl_Alloc (tclCkalloc.c:1059)
      ==4219==    by 0x571252: Tcl_NewStringObj (tclStringObj.c:340)
      ==4219==    by 0x516C69: TclGetSourceFromFrame (tclExecute.c:9735)
      ==4219==    by 0x4306B8: EvalObjvCore (tclBasic.c:4262)
      ==4219==    by 0x4309D8: TclNRRunCallbacks (tclBasic.c:4390)
      ==4219==    by 0x43027D: Tcl_EvalObjv (tclBasic.c:4121)
      
    5. foundin initialized to: "trunk"
    6. is_private initialized to: "0"
    7. login: "dgp"
    8. priority initialized to: "5 Medium"
    9. resolution initialized to: "None"
    10. severity initialized to: "Minor"
    11. status initialized to: "Open"
    12. submitter initialized to: "dgp"
    13. subsystem initialized to: "- New Builtin Commands"
    14. title initialized to: "memleak in execute-10.3"
    15. type initialized to: "Bug"
  2. Ticket change [1b8f6ad7cd] (rid 138807) by dgp on 2014-07-17 03:41:34:

    1. icomment:
      Oh boy.
      
      Test execute-10.3 came in to test that a crashing
      scenario in Ticket 3072640 stopped crashing.
      
      The leak here appears to be exposing that although
      things are not crashing, they don't seem to be working
      properly either.
      
      The issue appears to be how to handle execution leave
      traces for the [yield] command or for other commands
      like [for] or [while] that can end up yielding due to
      [yield] in their bodies.  When these commands yield,
      in some sense they are blocking, they are still in progress,
      and we may sometime later return to them and let them
      complete and leave at that time.  So their leave traces
      do not fire *yet*.
      
      Execution trace implementation creates things for enter
      traces and destroys them after leave traces.  That's
      why we see a leak.  Those commands that never leave,
      never clean up their execution trace housekeeping.
      
      What's strange is that after the [yield], the execution
      trace appears to still be in effect, now tracing a whole
      other body of code.
      
      In the test execute-8.3, a bit of debug printing will
      reveal that the command
      
      ::t {trace remove execution ::generate enterstep ::t} enterstep
      
      is invoked, even though I would not normally think of the
      [trace remove] being part of [::generate].
      
      The other thing that appears missing is that I would think
      that when it becomes clear the coro will never be resumed
      (with [rename coro {}], then we ought to be cleaning up
      the abandoned trace housekeeping, and that's not happening
      (thus the leak)).
      
      My head hurts.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  3. Ticket change [8495e91db1] (rid 138808) by dgp on 2014-07-17 03:51:45:

    1. icomment:
      Simplest demo I can manage of how things are functioning now:
      
      % trace add execution yield {enter leave} {apply {{cmd args} {puts $args}}}
      % coroutine coro yield
      enter
      % coro
      0 {} leave
      
      I can convince myself that's correct.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  4. Ticket change [a4d7ca7396] (rid 138811) by dgp on 2014-07-17 04:27:42:

    1. icomment:
      Whoa.  This is either a stroke of dumb luck, or a consequence
      of well-crafter Sofer design.
      
      I found where the ->rewind bails out on coroutine deletion
      and saw that teardown of trace data in frames comes right
      after.  The leak appears to be a consequence of just this 
      small misordering of code.  Fix committed.
      
      The interaction of execution traces and [yield]ing commands
      still holds some mysteries I think, but I'll open another ticket
      for that, and keep this one open until I do.
      
      Leak plugged.  And there was much rejoicing...
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  5. Ticket change [bae575e4f3] (rid 138904) by dgp on 2014-07-21 14:34:28:

    1. assignee changed to: "dgp"
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. subsystem changed to: "47. Bytecode Compiler"
  6. Ticket change [2cc3f3db1c] (rid 138905) by dgp on 2014-07-21 14:34:59:

    1. login: "dgp"
    2. mimetype: "text/plain"