Skip to content
Tcl Source Code History Of Ticket 7842f33a5c
Login

History Of Ticket 7842f33a5c

Artifacts Associated With Ticket 7842f33a5c

  1. Ticket change [42083508d2] (rid 203359) by anonymous on 2022-08-27 21:39:42:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-plain"
    4. comment initialized to:
      The following script will CRASH tcl
      
      TWO instances are linked together, the second instance uses in the destructor the first instance. but the second instance is created in the namespace of the first instance. if the first instance is deleted the destructor of the second instance is called and this is calling the first instance again etc…
      
      
      oo::class create RpcClient {
      }
      
      oo::define RpcClient method write {name } {
        puts "RpcClient → $name"
      }
      
      oo::class create LcConfigRpcClient {
        superclass RpcClient
      }
      
      oo::define LcConfigRpcClient method LcConfigRpc_create_bug {name } {
        LcConfigRpc create $name [self] 111
      }
      oo::define LcConfigRpcClient export LcConfigRpc_create_bug
      
      
      oo::class create MkObjectRpc {
        variable hdl
      }
      
      oo::define MkObjectRpc constructor {rpcHdl mqHdl} {
        set hdl $mqHdl
        oo::objdefine [self] forward rpc $rpcHdl
      }
      
      oo::define MkObjectRpc destructor {
        my rpc write otto-$hdl
      }
      
      oo::class create LcConfigRpc {
        superclass MkObjectRpc
        variable hdl
      }
      
      set FH [LcConfigRpcClient new]
      
      $FH LcConfigRpc_create_bug cfg
      
      $FH destroy
      
    5. foundin initialized to: "8.6"
    6. is_private initialized to: "0"
    7. login: "anonymous"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "cfa5542303e02522a952e7e43ae9583a052b31e9"
    10. resolution initialized to: "None"
    11. severity initialized to: "Severe"
    12. status initialized to: "Open"
    13. submitter initialized to: "anonymous"
    14. subsystem initialized to: "10. Objects"
    15. title initialized to: "TCL crash (core)"
    16. type initialized to: "Bug"
  2. Ticket change [8d00e24e79] (rid 216295) by chrstphrchvz on 2023-07-08 12:23:33:

    1. icomment:
      Changing subsystem to TclOO; the “Objects” subsystem is meant for Tcl values in general.
      
    2. login: "chrstphrchvz"
    3. mimetype: "text/x-fossil-wiki"
    4. subsystem changed to: "35. TclOO Package"
  3. Ticket change [ca867048e7] (rid 219686) by chrstphrchvz on 2023-10-22 16:41:58:

    1. icomment:
      The reporter’s example still crashes for core-8-6-branch. UBSan (<tt>-fsanitize=null</tt>) and ASan (<tt>-fsanitize=address</tt>) errors:
      
      <blockquote><pre>
      <span style="font-weight:bold">tcl/generic/tclOOCall.c:1024:25: <span style="color:firebrick">runtime error:</span> member access within null pointer of type 'struct Class'</span>
      SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tcl/generic/tclOOCall.c:1024:25 in 
      AddressSanitizer:DEADLYSIGNAL
      =================================================================
      <span style="font-weight:bold;color:firebrick">==65360==ERROR: AddressSanitizer: SEGV on unknown address 0x0000000000f0 (pc 0x0001109f36a5 bp 0x7ff7b1f52830 sp 0x7ff7b1f51c80 T0)</span>
      ==65360==The signal is caused by a READ memory access.
      ==65360==Hint: address points to the zero page.
          #0 0x1109f36a5 in TclOOGetCallContext tclOOCall.c:1024
          #1 0x1109be8b2 in TclOOObjectCmdCore tclOO.c:2599
          #2 0x1109cd36d in PublicNRObjectCmd tclOO.c:2461
          #3 0x10fa83837 in Dispatch tclBasic.c:4520
          #4 0x10fa63bbf in TclNRRunCallbacks tclBasic.c:4556
          #5 0x10fa52ad3 in Tcl_NRCallObjProc tclBasic.c:8269
          #6 0x1109c8db5 in ObjectNamespaceDeleted tclOO.c:1141
          #7 0x1106b22dd in Tcl_DeleteNamespace tclNamesp.c:917
          #8 0x1109cd534 in ObjectRenamedTrace tclOO.c:844
          #9 0x10fa57e58 in CallCommandTraces tclBasic.c:3426
          #10 0x10fa4d7e7 in Tcl_DeleteCommandFromToken tclBasic.c:3226
          #11 0x1106ba16e in TclTeardownNamespace tclNamesp.c:1124
          #12 0x1106b3857 in Tcl_DeleteNamespace tclNamesp.c:1011
          #13 0x1109cd534 in ObjectRenamedTrace tclOO.c:844
          #14 0x10fa57e58 in CallCommandTraces tclBasic.c:3426
          #15 0x10fa4d7e7 in Tcl_DeleteCommandFromToken tclBasic.c:3226
          #16 0x1109d4b98 in TclOO_Object_Destroy tclOOBasic.c:361
          #17 0x1109eb8c0 in TclOOInvokeContext tclOOCall.c:314
          #18 0x1109c0400 in TclOOObjectCmdCore tclOO.c:2645
          #19 0x1109cd36d in PublicNRObjectCmd tclOO.c:2461
          #20 0x10fa83837 in Dispatch tclBasic.c:4520
          #21 0x10fa63bbf in TclNRRunCallbacks tclBasic.c:4556
          #22 0x10fa76fdf in TclEvalObjEx tclBasic.c:6138
          #23 0x10fa5f951 in Tcl_EvalObjEx tclBasic.c:6119
          #24 0x110510fa2 in Tcl_RecordAndEvalObj tclHistory.c:191
          #25 0x1106ab031 in Tcl_MainEx tclMain.c:520
          #26 0x10dfab8d6 in main tclAppInit.c:91
          #27 0x11a14552d in start+0x1cd (dyld:x86_64+0x552d)
      
      ==65360==Register values:
      rax = 0x00000000000000f0  rbx = 0x00007ff7b1f51d80  rcx = 0x0000100000000000  rdx = 0x0000000000000000  
      rdi = 0x00007ff7b1f50f70  rsi = 0x0000000000000000  rbp = 0x00007ff7b1f52830  rsp = 0x00007ff7b1f51c80  
       r8 = 0x0000000000000057   r9 = 0xbfffff00000fffff  r10 = 0x00007ff809a2059e  r11 = 0x0000000000000202  
      r12 = 0x000000011a1c03a0  r13 = 0x00007ff7b1f57a58  r14 = 0x000000010dfab898  r15 = 0x000000011a1ac010  
      AddressSanitizer can not provide additional info.
      SUMMARY: AddressSanitizer: SEGV tclOOCall.c:1024 in TclOOGetCallContext
      ==65360==ABORTING
      </pre></blockquote>
      A <tt>NULL+0xf0</tt> dereference at tclOOCall.c:1024 would mean that <tt>oPtr-&gt;selfCls</tt> is <tt>NULL</tt>.
      
    2. login: "chrstphrchvz"
    3. mimetype: "text/x-fossil-wiki"
  4. Ticket change [b337ceecf0] (rid 226205) by dkf on 2024-05-20 13:36:40:

    1. icomment:
      Stripped down further (from a test case I'm developing):
      
      ```
      oo::class create RpcClient {
         method write name {
            lappend ::result "RpcClient -> $name"
         }
         method create_bug {} {
            MkObjectRpc create cfg [self] 111
         }
      }
      oo::class create MkObjectRpc {
         variable hdl
         constructor {rpcHdl mqHdl} {
            set hdl $mqHdl
            oo::objdefine [self] forward rpc $rpcHdl
         }
         destructor {
            my rpc write otto-$hdl
         }
      }
      
      set FH [RpcClient new]
      $FH create_bug
      $FH destroy
      ```
      
      Have confirmed that this is a current issue in both 8.6 and trunk.
      
    2. login: "dkf"
    3. mimetype: "text/x-markdown"
    4. priority changed to: "9 Immediate"
  5. Ticket change [65a51edf8d] (rid 226206) by dkf on 2024-05-20 13:37:02:

    1. assignee changed to: "dkf"
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. severity changed to: "Critical"
  6. Ticket change [715f32ddd6] (rid 226212) by dkf on 2024-05-20 13:51:11:

    1. icomment:
      **Debug-annotated stack trace**
      
      ```
      #0  TclOOGetCallContext (oPtr=0x1d1190, methodNameObj=0x15f510, flags=1, cacheInThisObj=0x15f510)
          at C:/Users/ZZALSDKF/code/tcl/generic/tclOOCall.c:1024
      #1  0x00007ffae26a8812 in TclOOObjectCmdCore (oPtr=0x1d1190, interp=0x11d6d0, objc=3,
          objv=0x12afb0, flags=1, startCls=0x0) at C:/Users/ZZALSDKF/code/tcl/generic/tclOO.c:2599
      #2  0x00007ffae26a83d7 in PublicNRObjectCmd (clientData=0x1d1190, interp=0x11d6d0, objc=3,
          objv=0x12afb0) at C:/Users/ZZALSDKF/code/tcl/generic/tclOO.c:2461
      #3  0x00007ffae256f4b1 in Dispatch (data=0x163f58, interp=0x11d6d0, result=0)
          at C:/Users/ZZALSDKF/code/tcl/generic/tclBasic.c:4503
      #4  0x00007ffae256f546 in TclNRRunCallbacks (interp=0x11d6d0, result=0, rootPtr=0x15fc00)
          at C:/Users/ZZALSDKF/code/tcl/generic/tclBasic.c:4539
      #5  0x00007ffae2575294 in Tcl_NRCallObjProc (interp=0x11d6d0,
          objProc=0x7ffae26ac3bd <TclOOInvokeContext>, clientData=0x12ae20, objc=0, objv=0x0)
          at C:/Users/ZZALSDKF/code/tcl/generic/tclBasic.c:8235
      #6  0x00007ffae26a562a in ObjectNamespaceDeleted (clientData=0x1d1790)
          at C:/Users/ZZALSDKF/code/tcl/generic/tclOO.c:1141
      #7  0x00007ffae269c70b in Tcl_DeleteNamespace (namespacePtr=0x1ddd20)
          at C:/Users/ZZALSDKF/code/tcl/generic/tclNamesp.c:919
      #8  0x00007ffae26a4ba8 in ObjectRenamedTrace (clientData=0x1d1790, interp=0x11d6d0,
          oldName=0x1cebe0 "::oo::Obj14::cfg", newName=0x0, flags=16512)
          at C:/Users/ZZALSDKF/code/tcl/generic/tclOO.c:844
      #9  0x00007ffae256d9c7 in CallCommandTraces (iPtr=0x11d6d0, cmdPtr=0x1d1890,
          oldName=0x1cebe0 "::oo::Obj14::cfg", newName=0x0, flags=16512)
          at C:/Users/ZZALSDKF/code/tcl/generic/tclBasic.c:3409
      #10 0x00007ffae256d600 in Tcl_DeleteCommandFromToken (interp=0x11d6d0, cmd=0x1d1890)
          at C:/Users/ZZALSDKF/code/tcl/generic/tclBasic.c:3209
      #11 0x00007ffae269cb46 in TclTeardownNamespace (nsPtr=0x1dd920)
          at C:/Users/ZZALSDKF/code/tcl/generic/tclNamesp.c:1127
      #12 0x00007ffae269c927 in Tcl_DeleteNamespace (namespacePtr=0x1dd920)
          at C:/Users/ZZALSDKF/code/tcl/generic/tclNamesp.c:1014
      #13 0x00007ffae26a4ba8 in ObjectRenamedTrace (clientData=0x1d1190, interp=0x11d6d0,
          oldName=0x17e6c0 "::oo::Obj14", newName=0x0, flags=16512)
          at C:/Users/ZZALSDKF/code/tcl/generic/tclOO.c:844
      #14 0x00007ffae256d9c7 in CallCommandTraces (iPtr=0x11d6d0, cmdPtr=0x1d1290,
          oldName=0x17e6c0 "::oo::Obj14", newName=0x0, flags=16512)
          at C:/Users/ZZALSDKF/code/tcl/generic/tclBasic.c:3409
      #15 0x00007ffae256d600 in Tcl_DeleteCommandFromToken (interp=0x11d6d0, cmd=0x1d1290)
          at C:/Users/ZZALSDKF/code/tcl/generic/tclBasic.c:3209
      #16 0x00007ffae26aa08f in TclOO_Object_Destroy (clientData=0x0, interp=0x11d6d0, context=0x12adf0,
          objc=2, objv=0x12add0) at C:/Users/ZZALSDKF/code/tcl/generic/tclOOBasic.c:361
      ```
      
    2. login: "dkf"
    3. mimetype: "text/x-markdown"
  7. Ticket change [c69bb1bae4] (rid 226219) by dkf on 2024-05-20 15:16:02:

    1. icomment:
      The problem was in the computation of stereotypical call chains when the object in question had already gone rather a long way through the destruction process. Nasty!
      
      Things no longer crash, but if you want to get the `MkObjectRpc` destructor to run and successfully call into the `RpcClient write` method, you'd better explicitly destroy the object created by `LcConfigRpc_create_bug` in the `LcConfigRpcClient` destructor. Without that, there's just slightly too much state ripped out of the way of things by the point when destruction happens and TclOO instead builds empty call chains (resulting in calls doing nothing; normally calls to non-existent methods result in call chains that go to the `unknown` method handler, in `oo::object` if not overridden).
      
    2. login: "dkf"
    3. mimetype: "text/x-markdown"
  8. Ticket change [7385169a2f] (rid 226220) by dkf on 2024-05-20 15:16:27:

    1. login: "dkf"
    2. mimetype: "text/plain"
    3. resolution changed to: "Fixed"
  9. Ticket change [fa0b8ec6b3] (rid 226221) by dkf on 2024-05-20 15:18:47:

    1. closedate changed to: "2460451.13804413"
    2. closer changed to: "dkf"
    3. login: "dkf"
    4. mimetype: "text/plain"
    5. status changed to: "Closed"
  10. Ticket change [8bbe17b992] (rid 226294) by jan.nijtmans on 2024-05-20 20:53:00:

    1. closer changed to: "nobody"
    2. icomment:
      ---- oo-35.7.1 start
      Test file error: child killed: segmentation violation
      
      
      Something is still wrong
      
    3. login: "jan.nijtmans"
    4. mimetype: "text/plain"
    5. resolution changed to: "None"
    6. status changed to: "Open"
  11. Ticket change [1571188edf] (rid 226295) by jan.nijtmans on 2024-05-21 08:37:38:

    1. icomment:
      The 8.6 build succeeded, the 8.7 build failed on all platforms.
      
      @dkf please have a look.
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  12. Ticket change [747c9d49bb] (rid 226327) by oehhar on 2024-05-21 12:35:06:

    1. icomment:
      Magic Sergey has fixed the crash reported below by commit [1d16344c8c].
      Thank you all, great team,
      Harald
      
    2. login: "oehhar"
    3. mimetype: "text/x-fossil-wiki"
    4. username: "oehhar"
  13. Ticket change [0116b6cf56] (rid 226400) by apnadkarni on 2024-05-22 03:40:33:

    1. icomment:
      While the crash may be fixed, it is not clear to me how things get into that state and if there is an underlying fault in the call chain computation that is hidden. Still worth Donal also taking a look imo.
      
    2. login: "apnadkarni"
    3. mimetype: "text/plain"
  14. Ticket change [98645273ef] (rid 226430) by sebres on 2024-05-22 10:53:03:

    1. icomment:
      Well, the case where <code>oPtr->selfCls<code> may be NULL is normal case, related to the code (even fix of dkf for other pieces [8b4a3295ed9e537c] shows such conditions check).
      
      The fact that it fails in 8.7+ but not in 8.6 is easy to explain: in 8.6 since [b0e486eaa693a6a6] <code><b>AddSimpleClassChainToCallContext</b><code> checks whether <code>classPtr == NULL<code> (direct after tailRecurse label), where in 8.7+ this check was lost (probably due to some conflicts or because it was backported to <code><b>AddPrivates</b>FromClassChainToCallContext<code> only, which doesn't exist in 8.6)... Therefore the new tests <code>oo-35.7.*</code> didn't fail in 8.6, but in 8.7+ (I guess Donal simply merged it to 8.7 in [de08cf03235f3ce9], but didn't test it there).
      
      Now this is fixed everywhere (I also restored the mentioned check in [22966032c2912825]), additionally the invocation of <code>AddSimpleClassChainToCallContext<code> and <code>AddPrivatesFromClassChainToCallContext<code> is avoided completely if <code>oPtr->selfCls<code> is NULL (totally unneeded and wouldn't crash if later both would be rewritten again).
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
  15. Ticket change [0a71d415a5] (rid 226434) by apnadkarni on 2024-05-22 13:42:06:

    1. icomment: "Thanks for the explanation Sergey."
    2. login: "apnadkarni"
    3. mimetype: "text/plain"
  16. Ticket change [2fb5ef5ad5] (rid 226489) by dkf on 2024-05-23 10:33:40:

    1. closedate changed to: "2460453.94005637"
    2. closer changed to: "dkf"
    3. icomment: "Thanks for fixing that."
    4. login: "dkf"
    5. mimetype: "text/x-markdown"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"