Skip to content
Tcl Source Code History Of Ticket 0b874c344d
Login

History Of Ticket 0b874c344d

Artifacts Associated With Ticket 0b874c344d

  1. Ticket change [f4281addbd] (rid 135730) by cmcc on 2013-11-23 18:33:55:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      I have a 2000 line script which invariably generates a SEGV on [info frame].  I don't know how to get you the script.  Contact me for it, please.
      
    5. foundin initialized to: "8.6b1"
    6. is_private initialized to: "0"
    7. login: "cmcc"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "16910d69b11045755316a073070779a85cd9218f"
    10. resolution initialized to: "None"
    11. severity initialized to: "Critical"
    12. status initialized to: "Open"
    13. submitter initialized to: "cmcc"
    14. subsystem initialized to: "04. Async Events"
    15. title initialized to: "Tcl SEGV"
    16. type initialized to: "Bug"
  2. Add attachment "H.tcl" [931d4bfb6f] (rid 135731) by cmcc on 2013-11-23 18:42:03.

  3. Ticket change [5ab37fd4a6] (rid 135732) by cmcc on 2013-11-23 18:44:54:

    1. comment changed to:
      Attached a 2000 line script which invariably generates a SEGV on [info frame]
      
      SEGV occurs in InfoFrameCmd() lines
      
      	/* TODO - deal with overflow */
      	topLevel += corPtr->caller.cmdFramePtr->level;
      
      Where
      
      (gdb) p *corPtr
      $11 = {cmdPtr = 0xb6a1a78, eePtr = 0x9a2fab0, callerEEPtr = 0x9743b68, caller = {framePtr = 0x8055d70, varFramePtr = 0x8055d70, cmdFramePtr = 0x0, lineLABCPtr = 0x9a20110}, running = {framePtr = 0xb68f668, varFramePtr = 0xb68f668, cmdFramePtr = 0xb68f860, lineLABCPtr = 0x9a205d0}, lineLABCPtr = 0x9a205d0, stackLevel = 0xbffff05c, auxNumLevels = 3, nargs = -1}
      
      (gdb) p corPtr->caller
      $12 = {framePtr = 0x8055d70, varFramePtr = 0x8055d70, cmdFramePtr = 0x0, lineLABCPtr = 0x9a20110}
      
      (gdb) p corPtr->caller.cmdFramePtr
      $13 = (struct CmdFrame *) 0x0
      
    2. login: "cmcc"
    3. mimetype: "text/plain"
  4. Ticket change [6fbd8d0a8f] (rid 135733) by cmcc on 2013-11-23 18:46:14:

    1. icomment:
      (gdb) bt
      #0  0xb7e8cde6 in InfoFrameCmd (dummy=0x0, interp=0x8055770, objc=1, objv=0xb68f8b4) at /home/colin/Desktop/packages/tcl8.6.1/generic/tclCmdIL.c:1174
      #1  0xb7e734ef in Dispatch (data=0xada4b5c, interp=0x8055770, result=0) at /home/colin/Desktop/packages/tcl8.6.1/generic/tclBasic.c:4335
      #2  0xb7e78b4f in TclNRRunCallbacks (interp=interp@entry=0x8055770, result=0, rootPtr=rootPtr@entry=0x810d108) at /home/colin/Desktop/packages/tcl8.6.1/generic/tclBasic.c:4368
      #3  0xb7e7c68f in TclEvalObjEx (interp=interp@entry=0x8055770, objPtr=objPtr@entry=0xb688bc0, flags=flags@entry=131072, invoker=invoker@entry=0x0, word=word@entry=0) at /home/colin/Desktop/packages/tcl8.6.1/generic/tclBasic.c:5934
      #4  0xb7e7c6db in Tcl_EvalObjEx (interp=interp@entry=0x8055770, objPtr=0xb688bc0, flags=flags@entry=131072) at /home/colin/Desktop/packages/tcl8.6.1/generic/tclBasic.c:5915
      #5  0xb7f54508 in AfterProc (clientData=0x97e49b0) at /home/colin/Desktop/packages/tcl8.6.1/generic/tclTimer.c:1191
      #6  0xb7f54854 in TimerHandlerEventProc (evPtr=evPtr@entry=0x9a0ef40, flags=flags@entry=-3) at /home/colin/Desktop/packages/tcl8.6.1/generic/tclTimer.c:593
      #7  0xb7f31da3 in Tcl_ServiceEvent (flags=flags@entry=-3) at /home/colin/Desktop/packages/tcl8.6.1/generic/tclNotify.c:670
      #8  0xb7f3203e in Tcl_DoOneEvent (flags=flags@entry=-3) at /home/colin/Desktop/packages/tcl8.6.1/generic/tclNotify.c:907
      #9  0xb7ef12cc in Tcl_VwaitObjCmd (clientData=0x0, interp=0x8055770, objc=2, objv=0x805ca30) at /home/colin/Desktop/packages/tcl8.6.1/generic/tclEvent.c:1408
      #10 0xb7e734ef in Dispatch (data=0xac8d824, interp=0x8055770, result=0) at /home/colin/Desktop/packages/tcl8.6.1/generic/tclBasic.c:4335
      #11 0xb7e78b4f in TclNRRunCallbacks (interp=interp@entry=0x8055770, result=0, rootPtr=rootPtr@entry=0x0) at /home/colin/Desktop/packages/tcl8.6.1/generic/tclBasic.c:4368
      #12 0xb7e78c7f in Tcl_EvalObjv (interp=interp@entry=0x8055770, objc=objc@entry=3, objv=objv@entry=0x805c8e0, flags=flags@entry=2097168) at /home/colin/Desktop/packages/tcl8.6.1/generic/tclBasic.c:4099
      #13 0xb7e7a168 in TclEvalEx (interp=interp@entry=0x8055770, script=0x80b0808 "# H.tcl - light Httpd 1.1\nif {[info exists argv0] && ($argv0 eq [info script])} {\n    apply {{} {\n\tset home [file dirname [file normalize [info script]]]\n\tlappend ::auto_path $home [file join [file di"..., numBytes=5472, flags=flags@entry=0, line=1876, line@entry=1, clNextOuter=clNextOuter@entry=0x0, outerScript=0x80b0808 "# H.tcl - light Httpd 1.1\nif {[info exists argv0] && ($argv0 eq [info script])} {\n    apply {{} {\n\tset home [file dirname [file normalize [info script]]]\n\tlappend ::auto_path $home [file join [file di"...) at /home/colin/Desktop/packages/tcl8.6.1/generic/tclBasic.c:5237
      #14 0xb7f25221 in Tcl_FSEvalFileEx (interp=interp@entry=0x8055770, pathPtr=pathPtr@entry=0x8082030, encodingName=0x0) at /home/colin/Desktop/packages/tcl8.6.1/generic/tclIOUtil.c:1809
      #15 0xb7f2beab in Tcl_MainEx (argc=<optimised out>, argc@entry=2, argv=<optimised out>, argv@entry=0xbffff674, appInitProc=appInitProc@entry=0x8048790 <Tcl_AppInit>, interp=0x8055770) at /home/colin/Desktop/packages/tcl8.6.1/generic/tclMain.c:417
      #16 0x0804868a in main (argc=2, argv=0xbffff674) at /home/colin/Desktop/packages/tcl8.6.1/unix/tclAppInit.c:84
      (gdb)
      
    2. login: "cmcc"
    3. mimetype: "text/plain"
    4. username: "BackTrace"
  5. Ticket change [cc6b081807] (rid 135734) by miguel on 2013-11-23 23:46:35:

    1. assignee changed to: "aku"
    2. icomment:
      I believe corPtr->caller.cmdFramePtr should never be NULL. How did this happen?
      
    3. login: "miguel"
    4. mimetype: "text/plain"
    5. username: "[email protected]"
  6. Ticket change [46b2303656] (rid 135770) by dgp on 2013-11-25 17:32:50:

    1. icomment:
      In case it's helpful, the demo script generates
      a SEGV starting with checkin
      
      2012-04-02 13:13:11 1d6747e53fa1fc82 BAD CURRENT
      
      That's the implementation of TIP 396.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  7. Ticket change [45ece106ae] (rid 135771) by aku on 2013-11-25 17:55:39:

    1. icomment:
      Thanks for bisecting. I just opened this bug and started to update my checkouts to investigate. So yes, having the bad commit should help.
      
    2. login: "aku"
    3. mimetype: "text/plain"
  8. Ticket change [739df5982a] (rid 135772) by aku on 2013-11-25 18:09:05:

    1. icomment:
      While my checkouts continue to update I looked over the changes made by [1d6747e53fa1fc82].
      
      My current primary suspect is the call to "TclNRYieldObjCmd" at the end of "TclNRYieldToObjCmd", going from "clientData" to "INT2PTR(CORO_ACTIVATE_YIELDM))".
      
      ... Update complete, I can now build and actually start trialing.
      
    2. login: "aku"
    3. mimetype: "text/plain"
  9. Ticket change [00c288b312] (rid 135773) by aku on 2013-11-25 18:20:48:

    1. icomment:
      First, I can confirm dgp's finding that revision [1d6747e53fa1fc82] is where things go bad, with the previous revision being ok.
      
    2. login: "aku"
    3. mimetype: "text/plain"
  10. Ticket change [a682344e3b] (rid 135774) by dgp on 2013-11-25 20:23:35:

    1. icomment:
      Part of the sequence of events leading to the segfault
      is the 
      
      SAVE_CONTEXT(corPtr->caller);
      
      around line 8740 or so in tclBasic.c (in the TIP 396 commit,
      in case the file has changed a lot since then).
      
      This is called at a time when iPtr->cmdFramePtr is NULL,
      which puts the NULL value in place which [info frame] later
      crashes on attempting to dereference.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  11. Ticket change [bd6a1cbec3] (rid 135775) by aku on 2013-11-25 20:51:14:

    1. icomment:
      Interestingly enough, the other branch of the condition is where CORO_ACTIVATE_YIELDM is handled.
      
    2. login: "aku"
    3. mimetype: "text/plain"
  12. Ticket change [8ad7165b4d] (rid 135779) by aku on 2013-11-29 18:16:43:

    1. icomment:
      Possible fix on branch "bug-0b874c344d-ak-info-frame-coro".
      Revision [f8164c896c].
      Committed.
      Pushed.
      
    2. login: "aku"
    3. mimetype: "text/plain"
  13. Ticket change [b5c7d71ccb] (rid 135784) by dgp on 2013-12-03 15:10:22:

    1. icomment:
      So the fix takes the perspective that the
      implementation of [info frame] failed to
      account for an unusual, but normal condition.
      
      This is in contrast to a perspective that
      (corPtr->caller.cmdFramePtr == NULL) was
      an invalid state and some bug was wrongly
      allowing it to occur.
      
      Accepting that, we should merge the fix to
      the trunk.
      
      Any prospects for crafting a test for the
      test suite that doesn't require a 2100 line
      script?
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  14. Ticket change [b90afbe102] (rid 135791) by aku on 2013-12-03 18:33:05:

    1. icomment:
      > Perspective
      Yes. There was actually code in the function for dealing with a possible NULL in the main iPtr->cmdFramePtr already. Given this it was considered to be possible for such a NULL to wind up in the corPtr->caller.cmdFramePtr as well.
      
      > Merging
      Ok.
      
      > Test(s)
      While accepting the possibility of a NULL winding up in the coro cmdFrame I am not sure yet how it actually happens. So, from me I have no prospects of crafting the necessary test.
      
      And yes, I do wish that Colin had taken the time to reduce his script as much as possible.
      
    2. login: "aku"
    3. mimetype: "text/plain"
  15. Ticket change [95660eb5dc] (rid 135792) by dgp on 2013-12-03 19:58:52:

    1. icomment:
      Here's a much shorter demo script:
      
          proc a {} {
              after 0 [info coroutine]
              yield
              coroutine C c
          }
      
          proc b {} {
              yield
              info frame
          }
      
          proc c {} {
              tailcall B
          }
      
          after 0 {
              coroutine A a
              coroutine B b
          }
          vwait forever
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  16. Ticket change [efc5301ba4] (rid 135793) by dgp on 2013-12-03 20:07:13:

    1. icomment:
      Simpler still; no event loop required:
      
      proc a {} {yield; coroutine C c}
      proc b {} {yield; info frame}
      proc c {} {tailcall B}
      coroutine A a
      coroutine B b
      A
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  17. Ticket change [a3ed36cac2] (rid 135794) by aku on 2013-12-03 20:11:04:

    1. icomment:
      Thank you Don.
      That is very short and sweet.
      Will work on making that a test ASAP.
      
    2. login: "aku"
    3. mimetype: "text/plain"
    4. priority changed to: "8"
  18. Ticket change [55ceeaad48] (rid 135797) by dgp on 2013-12-04 12:55:52:

    1. icomment:
      Final entry:
      
      coroutine X coroutine Y info frame
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  19. Ticket change [1594a0f703] (rid 135798) by dgp on 2013-12-04 14:37:30:

    1. icomment:
      A variant of that:
      
      coroutine X coroutine Y info frame 0
      
      demonstrates that the proposed fix is
      not enough to solve the problem.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  20. Ticket change [1c34360184] (rid 135821) by dgp on 2013-12-05 20:47:00:

    1. icomment: "Draft fix checked into branch bug-0b874c344d."
    2. login: "dgp"
    3. mimetype: "text/plain"
  21. Ticket change [50781ee15f] (rid 136070) by dgp on 2013-12-18 18:23:29:

    1. closedate changed to: "2456645.26630907"
    2. closer changed to: "dgp"
    3. icomment: "Much improved fix now merged to trunk."
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"