• tcl CORE

    From aotto1968@21:1/5 to All on Sat Aug 27 11:49:03 2022
    Hi, the following code is valid tcl

    This is a simple testcase

    test lcconfig-6-2-($F-$B+$C+$S) {crash} \
    -body {
    $FH($F) LcConfigRpc_create_bug cfg
    } \
    -returnCodes ok \

    with

    oo::define LcConfigRpcClient method LcConfigRpc_create_bug {name } {
    my PrivateCreateBug LcConfigRpc $name [LcConfigRpc Create [self] ]
    }
    oo::define LcConfigRpcClient export LcConfigRpc_create_bug

    oo::define MkKernelRpcClient method PrivateCreateBug {cls nme mqHdl} {
    my variable selfCash
    set selfCash($mqHdl) [namespace eval :: [$cls create $nme [self] $mqHdl]]
    }


    the tcl CORE

    the problem is the "list" is missing, with "list" everything is fine without "list" CORE

    set selfCash($mqHdl) [namespace eval :: [ >>list<< $cls create $nme [self] $mqHdl]]

    ==== lcconfig-6-2-(0-0-0-binary+pipe+tcl.pipe.pipe) crash FAILED
    ==== Contents of test case:

    $FH($F) LcConfigRpc_create_bug cfg

    ---- Test generated error; Return code was: 1
    ---- Return code should have been one of: 0
    ---- errorInfo: wrong # args: should be "::oo::Obj33::cfg method ?arg ...?"
    while executing
    "::oo::Obj33::cfg"
    (in namespace eval "::" script line 1)
    invoked from within
    "namespace eval :: [$cls create $nme [self] $mqHdl]"
    (class "::MkKernelRpcClient" method "PrivateCreateBug" line 3)
    invoked from within
    "my PrivateCreateBug LcConfigRpc $name [LcConfigRpc Create [self] ]"
    (class "::LcConfigRpcClient" method "LcConfigRpc_create_bug" line 2)
    invoked from within
    "$FH($F) LcConfigRpc_create_bug cfg"
    ("uplevel" body line 2)
    invoked from within
    "uplevel 1 $script"
    ---- errorCode: TCL WRONGARGS
    ==== lcconfig-6-2-(0-0-0-binary+pipe+tcl.pipe.pipe) FAILED


    with the following (mainly-tcl) backtrace


    : BackTrace {
    : [ library : filename : lineno ] function
    : [ ------- : -------- : ------ ] --------
    : [ system : ink/libmkkernel/MkBufferS_mk.h : 682 ] MkDisasterSignal
    : [ unknown : unknown : 0 ] unknown
    : [ system : tcl-latest/generic/tclOOCall.c : 931 ] IsStillValid
    : [ system : tcl-latest/generic/tclOOCall.c : 1013 ] TclOOGetCallContext
    : [ system : src/tcl-latest/generic/tclOO.c : 2598 ] TclOOObjectCmdCore
    : [ system : src/tcl-latest/generic/tclOO.c : 2460 ] PublicNRObjectCmd
    : [ system : /tcl-latest/generic/tclBasic.c : 4458 ] Dispatch
    : [ system : /tcl-latest/generic/tclBasic.c : 4494 ] TclNRRunCallbacks
    : [ system : /tcl-latest/generic/tclBasic.c : 8191 ] Tcl_NRCallObjProc
    : [ system : src/tcl-latest/generic/tclOO.c : 1140 ] ObjectNamespaceDeleted
    : [ system : tcl-latest/generic/tclNamesp.c : 939 ] Tcl_DeleteNamespace
    : [ system : src/tcl-latest/generic/tclOO.c : 843 ] ObjectRenamedTrace
    : [ system : /tcl-latest/generic/tclBasic.c : 3365 ] CallCommandTraces
    : [ system : /tcl-latest/generic/tclBasic.c : 3172 ] Tcl_DeleteCommandFromToken : [ system : tcl-latest/generic/tclNamesp.c : 1146 ] TclTeardownNamespace
    : [ system : tcl-latest/generic/tclNamesp.c : 1033 ] Tcl_DeleteNamespace
    : [ system : src/tcl-latest/generic/tclOO.c : 843 ] ObjectRenamedTrace
    : [ system : /tcl-latest/generic/tclBasic.c : 3365 ] CallCommandTraces
    : [ system : /tcl-latest/generic/tclBasic.c : 3172 ] Tcl_DeleteCommandFromToken : [ tclmsgque : LibMkKernel_tcl.c : 1334 ] tcl_mkkernel_AtomDeleteHard
    : [ tclmsgque : MkObjectC_tcl.c : 634 ] tcl_mkkernel_MkObjectC_Delete
    : [ system : tcl-latest/generic/tclOOCall.c : 313 ] TclOOInvokeContext
    : [ system : src/tcl-latest/generic/tclOO.c : 2644 ] TclOOObjectCmdCore
    : [ system : src/tcl-latest/generic/tclOO.c : 2460 ] PublicNRObjectCmd
    : [ system : /tcl-latest/generic/tclBasic.c : 4458 ] Dispatch
    : [ system : /tcl-latest/generic/tclBasic.c : 4494 ] TclNRRunCallbacks
    : [ system : /tcl-latest/generic/tclBasic.c : 4217 ] Tcl_EvalObjv
    : [ system : /tcl-latest/generic/tclBasic.c : 5363 ] TclEvalEx
    : [ system : tcl-latest/generic/tclIOUtil.c : 1824 ] Tcl_FSEvalFileEx
    : [ system : c/tcl-latest/generic/tclMain.c : 403 ] Tcl_MainEx
    : [ system : c/tcl-latest/unix/tclAppInit.c : 84 ] main
    : [ unknown : unknown : 0 ] unknown
    : [ unknown : unknown : 0 ] unknown
    : [ system : ../sysdeps/x86_64/start.S : 115 ] unknown
    : [ unknown : unknown : 0 ] unknown
    : }
    ./Nhi1Exec: line 671: 71732 Aborted LD_PRELOAD='/usr/lib64/gcc/x86_64-suse-linux/11/libasan.so ' .../tclsh8.6
    '.../lcconfig.test' '--dev-testing' '--lng-tcl' '--block-2' '-match' 'lcconfig-2-2-*'

    1. The "Nhi1Exec" tool is just the starter for test case, on or case add the libasan.so library for mem-check
    2. The "Backtrace" feature is my own function just to react on unix signal SIGSEGV and write a backtrace

    void MkDisasterSetup(void) {
    // once per application
    static bool setup_done = false;
    if (setup_done) return;
    setup_done = true;

    // initialised to all zero (I vote for GCC style breach of standard here)
    struct sigaction sa = {};

    sa.sa_handler = MkDisasterSignal;
    sa.sa_flags = 0 /* | SA_RESETHAND | SA_NODEFER */; /* To have or have not */
    sigaction(SIGSEGV, &sa, NULL);
    }

    ANALYSES: as you see mainly TCL code is involved,

    1. "$cls create ..." create a VALID oo-object (but not in the :: NS because the "list" is missing
    2. "namespace eval :: OBJ" write an error because call the new "oo-object" without arg is invalid
    3. PROBLEM: "something" is calling the destructor of the new object

    313 from TclOOInvokeContext

    /*
    * Run the method implementation.
    */

    return mPtr->typePtr->callProc(mPtr->clientData, interp, <------ PROBLEM
    (Tcl_ObjectContext) contextPtr, objc, objv);
    }


    CRASH: it seems the oPtr->selfCls is brokern

    static inline int
    IsStillValid(
    CallChain *callPtr,
    Object *oPtr,
    int flags,
    int mask)
    {
    if ((oPtr->flags & USE_CLASS_CACHE)) {
    oPtr = oPtr->selfCls->thisPtr; <------ CRASH
    flags |= USE_CLASS_CACHE;
    }
    return ((callPtr->objectCreationEpoch == oPtr->creationEpoch)
    && (callPtr->epoch == oPtr->fPtr->epoch)
    && (callPtr->objectEpoch == oPtr->epoch)
    && ((callPtr->flags & mask) == (flags & mask)));
    }

    mfg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From aotto1968@21:1/5 to All on Sat Aug 27 23:29:39 2022
    On 27.08.22 11:49, aotto1968 wrote:
    Hi, the following code is valid tcl

    ...

    OK I found the TCL-CRASH reason, the following script CRASH tcl


    =============================================================================== 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 otto-$hdl
    }

    oo::class create LcConfigRpc {
    superclass MkObjectRpc
    variable hdl
    }

    set FH [LcConfigRpcClient new]

    $FH LcConfigRpc_create_bug cfg

    $FH destroy ===============================================================================


    mfg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Christian Gollwitzer@21:1/5 to All on Sun Aug 28 08:30:44 2022
    Am 27.08.22 um 23:29 schrieb aotto1968:
    On 27.08.22 11:49, aotto1968 wrote:
    Hi, the following code is valid tcl

    ...

    OK I found the TCL-CRASH reason, the following script CRASH tcl



    Create a bug report with this code on https://core.tcl-lang.org/tcl/ticket

    Please make sure to test this against the most recent version of Tcl, to
    see that the bug was not fixed already.

    Christian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From aotto1968@21:1/5 to All on Thu Sep 1 13:36:36 2022
    Every BUG opens a path to a new feature :-)

    I discovered that TCL implemented a REFERENCE data-type (accidentally?).
    The *dmp* is created in the namespace of the server-instance and if the server-instance
    is deleted the namespace of the server-instance is deleted too and the *dmp* instance is deleted.

    the *dmp* destructor is called, not required to call the "*dmp* destroy" explicit

    method Ot_DMPL {} {
    my SendSTART
    # dmp will be created in the namespace of the server and DELETED
    # if the server is deleted
    MqDumpC create dmp [self]
    my SendLONG [dmp BinSize]
    my SendRETURN
    }

    mfg

    On 27.08.22 11:49, aotto1968 wrote:
    Hi, the following code is valid tcl

    This is a simple testcase

            test lcconfig-6-2-($F-$B+$C+$S) {crash} \
              -body {
                $FH($F) LcConfigRpc_create_bug cfg
              } \
              -returnCodes    ok \

    with

      oo::define LcConfigRpcClient method LcConfigRpc_create_bug {name } {
        my PrivateCreateBug LcConfigRpc $name [LcConfigRpc Create [self] ]
      }
      oo::define LcConfigRpcClient export LcConfigRpc_create_bug

      oo::define MkKernelRpcClient method PrivateCreateBug {cls nme mqHdl} {
        my variable selfCash
        set selfCash($mqHdl) [namespace eval :: [$cls create $nme [self] $mqHdl]]
      }

    ...

    mfg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)