Menu

#54 tclx cvs head core dump

open
nobody
None
5
2015-04-09
2008-03-25
No

I am building tclx against the tcl 8.5.2 rc1 candidate on solaris 8 with sun C compiler.

When I run the test suite, I get the following core :

pipe.test
process.test
profile.test
gmake: *** [test] Segmentation Fault (core dumped)
$ dbx /vol/tclsrcsol/tcl852/src/tcl8.5.2/unix/tclsh core
For information about new features see `help changes'
To remove this message, put `dbxenv suppress_startup_message 7.0' in your .dbxrc
Reading tclsh
core file header read successfully
Reading ld.so.1
Reading libtcl8.5.so
Reading libdl.so.1
Reading libsocket.so.1
Reading libnsl.so.1
Reading libm.so.1
Reading libc.so.1
Reading libmp.so.2
Reading libc_psr.so.1
Reading libtclx8.4.so
Reading nss_files.so.1
program terminated by signal SEGV (no mapping at the fault address)
Current function is InitializeProcStack
686 UNKNOWN_LEVEL);
(dbx 1) list 670,690
670 */
671 static void
672 InitializeProcStack (infoPtr, framePtr)
673 profInfo_t *infoPtr;
674 CallFrame *framePtr;
675 {
676 if (framePtr == NULL)
677 return;
678 InitializeProcStack (infoPtr, framePtr->callerPtr);
679
680
681 PushEntry (infoPtr,
682 Tcl_GetStringFromObj (framePtr->objv [0], NULL),
683 TRUE,
684 infoPtr->stackPtr->procLevel + 1,
685 framePtr->level,
686 UNKNOWN_LEVEL);
687 }
688 ^L
(dbx 2) where
=>[1] InitializeProcStack(infoPtr = 0x1001cec10, framePtr = 0x1000332d0), line 686 in "tclXprofile.c"
[2] TurnOnProfiling(infoPtr = 0x1001cec10, commandMode = 0, evalMode = 0), line 729 in "tclXprofile.c"
[3] TclX_ProfileObjCmd(clientData = 0x1001cec10, interp = 0x100032b50, objc = 2, objv = 0x100033b70), line 895 in "tclXprofile.c"
[4] TclEvalObjvInternal(interp = 0x100032b50, objc = 2, objv = 0x100033b70, command = 0x10035cffe "profile on\nProcA1\nprofile off profData\nforeach idx [array names profData] {\n if {[string match "::ProcA1 *" $idx]} break\n}\n\nif {([lindex $profData($idx) 1] == 0) && \\n ![cequal $tcl_platform(platform) windows]} {\n puts "*** The profile command is returning real time values of"\n puts "*** zero. This suggests that your `times' system call does"\n puts "*** not return elapsed real time. The configure script"\n puts "*** did not properly detect this. Try undefining the flag"\n puts "***" ..., length = 11, flags = 0), line 3650 in "tclBasic.c"
[5] TclEvalEx(interp = 0x100032b50, script = 0x10035cbc0 "#\n# profile.test\n#\n# Tests for the profile command and profrep procedure.\n#------------------------------------------------------------------------------\n# Copyright 1992-1999 Karl Lehenbauer and Mark Diekhans.\n#\n# Permission to use, copy, modify, and distribute this software and its\n# documentation for any purpose and without fee is hereby granted, provided\n# that the above copyright notice appear in all copies. Karl Lehenbauer and\n# Mark Diekhans make no representations about the suitability of this\n# so" ..., numBytes = 24800, flags = 0, line = 27), line 4298 in "tclBasic.c"
[6] Tcl_EvalEx(interp = 0x100032b50, script = 0x10035cbc0 "#\n# profile.test\n#\n# Tests for the profile command and profrep procedure.\n#------------------------------------------------------------------------------\n# Copyright 1992-1999 Karl Lehenbauer and Mark Diekhans.\n#\n# Permission to use, copy, modify, and distribute this software and its\n# documentation for any purpose and without fee is hereby granted, provided\n# that the above copyright notice appear in all copies. Karl Lehenbauer and\n# Mark Diekhans make no representations about the suitability of this\n# so" ..., numBytes = 24800, flags = 0), line 4003 in "tclBasic.c"
[7] Tcl_FSEvalFileEx(interp = 0x100032b50, pathPtr = 0x1001f40f0, encodingName = (nil)), line 1820 in "tclIOUtil.c"
[8] Tcl_SourceObjCmd(dummy = (nil), interp = 0x100032b50, objc = 2, objv = 0x1000338a8), line 955 in "tclCmdMZ.c"
[9] TclEvalObjvInternal(interp = 0x100032b50, objc = 2, objv = 0x1000338a8, command = 0xffffffffffffffff "", length = -1, flags = 0), line 3650 in "tclBasic.c"
[10] TclExecuteByteCode(interp = 0x100032b50, codePtr = 0x1001766c0), line 2323 in "tclExecute.c"
[11] TclCompEvalObj(interp = 0x100032b50, objPtr = 0x100237230, invoker = 0x1000337f0, word = 1), line 1468 in "tclExecute.c"
[12] TclEvalObjEx(interp = 0x100032b50, objPtr = 0x100237230, flags = 0, invoker = 0x1000337f0, word = 1), line 4764 in "tclBasic.c"
[13] Tcl_CatchObjCmd(dummy = (nil), interp = 0x100032b50, objc = 3, objv = 0x100033838), line 253 in "tclCmdAH.c"
[14] TclEvalObjvInternal(interp = 0x100032b50, objc = 3, objv = 0x100033838, command = 0xffffffffffffffff "", length = -1, flags = 0), line 3650 in "tclBasic.c"
[15] TclExecuteByteCode(interp = 0x100032b50, codePtr = 0x100069260), line 2323 in "tclExecute.c"
[16] TclCompEvalObj(interp = 0x100032b50, objPtr = 0x1001f4030, invoker = 0x1000335c8, word = 3), line 1468 in "tclExecute.c"
[17] TclEvalObjEx(interp = 0x100032b50, objPtr = 0x1001f4030, flags = 0, invoker = 0x1000335c8, word = 3), line 4764 in "tclBasic.c"
[18] Tcl_ForeachObjCmd(dummy = (nil), interp = 0x100032b50, objc = 4, objv = 0x100033620), line 1814 in "tclCmdAH.c"
[19] TclEvalObjvInternal(interp = 0x100032b50, objc = 4, objv = 0x100033620, command = 0x100057951 "foreach file [lsort [::tcltest::getMatchingFiles]] {\n set tail [file tail $file]\n puts stdout $tail\n if {[catch {source $file} msg]} {\n^Iputs stdout $msg\n }\n}\n\n# cleanup\nputs stdout "\nTests ended at [eval $timeCmd]"\n::tcltest::cleanupTests 1\nreturn\n\nif 0 {\n proc eq {a b} { cequal $a $b }\n proc eq1 {a b} { string equal $a $b }\n proc eq2 {a b} { foo $a $b}\n interp alias {} foo {} string equal\n set a [string repeat a 50]b\n set b [string repeat a 50]b\n set c [string repeat a 50]" ..., length = 170, flags = 0), line 3650 in "tclBasic.c"
[20] TclEvalEx(interp = 0x100032b50, script = 0x1000573f0 "# all.tcl --\n#\n# This file contains a top-level script to run all of the Tcl\n# tests. Execute it by invoking "source all.test" when running tcltest\n# in this directory.\n#\n# RCS: @(#) $Id: all.tcl,v 1.2 2002/04/02 02:29:43 hobbs Exp $\n\nif {[lsearch [namespace children] ::tcltest] == -1} {\n package require tcltest\n namespace import ::tcltest::*\n}\n\nset ::tcltest::testSingleFile false\nset ::tcltest::testsDirectory [file dir [info script]]\n\n# We need to ensure that the testsDirectory is absolute\n::tcltest" ..., numBytes = 1934, flags = 0, line = 43), line 4298 in "tclBasic.c"
[21] Tcl_EvalEx(interp = 0x100032b50, script = 0x1000573f0 "# all.tcl --\n#\n# This file contains a top-level script to run all of the Tcl\n# tests. Execute it by invoking "source all.test" when running tcltest\n# in this directory.\n#\n# RCS: @(#) $Id: all.tcl,v 1.2 2002/04/02 02:29:43 hobbs Exp $\n\nif {[lsearch [namespace children] ::tcltest] == -1} {\n package require tcltest\n namespace import ::tcltest::*\n}\n\nset ::tcltest::testSingleFile false\nset ::tcltest::testsDirectory [file dir [info script]]\n\n# We need to ensure that the testsDirectory is absolute\n::tcltest" ..., numBytes = 1934, flags = 0), line 4003 in "tclBasic.c"
[22] Tcl_FSEvalFileEx(interp = 0x100032b50, pathPtr = 0x10004ff40, encodingName = (nil)), line 1820 in "tclIOUtil.c"
[23] Tcl_Main(argc = -1, argv = 0xffffffff7fffe258, appInitProc = 0x100001e58 = &Tcl_AppInit(Tcl_Interp *interp)), line 441 in "tclMain.c"
[24] main(argc = 2, argv = 0xffffffff7fffe248), line 87 in "tclAppInit.c"

Discussion

  • Larry W. Virden

    Larry W. Virden - 2008-08-26

    Logged In: YES
    user_id=15949
    Originator: YES

    This problem continues to be seen, even with Tcl 8.5.4

     
  • Larry W. Virden

    Larry W. Virden - 2008-10-15

    Updating this bug report, with the tclx cvs head and tcl 8.5.4, I see this same core dump in the profile.test .

     
  • Larry W. Virden

    Larry W. Virden - 2008-12-16

    Problem continues with latest version, tested against tcl 8.6 alpha cvs head.

     
  • Mikhail T.

    Mikhail T. - 2009-03-15

    Larry, is there any fix/workaround for this? I'd like to update FreeBSD port of TclX to depend on Tcl-8.5.x (which is the default Tcl on FreeBSD now), but can not do so because of this issue :-(

    Please, advise. Thanks!

     
  • Nobody/Anonymous

    Unfortunately, I have not found a solution to this bug. I have tried. just this morning, building the latest CVS head against the Tcl 8.5.6, and I continue to see the core dump.

     
  • Nobody/Anonymous

    here's purify's take on things:
    profile.test

    **** Purify instrumented /tmp/.lwv/t856/tcl8.5.6/unix/tclsh (pid 12734) ****
    NPR: Null pointer read:
    * This is occurring while in:
    InitializeProcStack [tclXprofile.c:686]
    TurnOnProfiling [tclXprofile.c:729]
    TclX_ProfileObjCmd [tclXprofile.c:895]
    TclEvalObjvInternal [tclBasic.c:3690]
    TclEvalEx [tclBasic.c:4339]
    Tcl_EvalEx [tclBasic.c:4043]
    * Reading 4 bytes from 0x0

    **** Purify instrumented /tmp/.lwv/t856/tcl8.5.6/unix/tclsh (pid 12734) ****
    COR: Fatal core dump:
    * This is occurring while in:
    InitializeProcStack [tclXprofile.c:686]
    TurnOnProfiling [tclXprofile.c:729]
    TclX_ProfileObjCmd [tclXprofile.c:895]
    TclEvalObjvInternal [tclBasic.c:3690]
    TclEvalEx [tclBasic.c:4339]
    Tcl_EvalEx [tclBasic.c:4043]
    * Received signal 11 (SIGSEGV - Segmentation Fault)
    * Faulting address = 0x0
    * Signal mask: (SIGSEGV)
    * Pending signals:

    **** Purify instrumented /tmp/.lwv/t856/tcl8.5.6/unix/tclsh (pid 12734) ****
    Purify: Searching for all memory leaks...

    Memory leaked: 0 bytes (0%); potentially leaked: 0 bytes (0%)

    Purify Heap Analysis (combining suppressed and unsuppressed blocks)
    Blocks Bytes
    Leaked 0 0
    Potentially Leaked 0 0
    In-Use 20347 1653409
    ----------------------------------------
    Total Allocated 20347 1653409

     
  • Mikhail T.

    Mikhail T. - 2009-07-31

    The crash happens in InitializeProcStack(), when it tries to access framePtr->objv[0] -- with the objv being NULL. The following patch fixes the problem -- and the profile.test passes:

    --- generic/tclXprofile.c 2004-11-22 19:12:54.000000000 -0500
    +++ generic/tclXprofile.c 2009-07-31 02:44:11.000000000 -0400
    @@ -674,5 +674,5 @@
    CallFrame *framePtr;
    {
    - if (framePtr == NULL)
    + if (framePtr == NULL || framePtr->objv == NULL)
    return;
    InitializeProcStack (infoPtr, framePtr->callerPtr);

    I'm adding this patch to FreeBSD's port of tclX.

     
  • Larry W. Virden

    Larry W. Virden - 2009-07-31

    after the patch, on sparc solaris 8, tclx's test suite still segment faults during profile.test.
    Current function is PushProcCallFrame
    1582 Namespace *nsPtr = procPtr->cmdPtr->nsPtr;
    (dbx 1) where
    =>[1] PushProcCallFrame(clientData = 0x8f4a8, interp = 0x2b678, objc = 1, objv = 0x2c038, isLambda = 0), line 1582 in "tclProc.c"
    [2] TclNRInterpProc(clientData = 0x8f4a8, interp = 0x2b678, objc = 1, objv = 0x2c038), line 1692 in "tclProc.c"
    [3] NRRunObjProc(data = 0x2011bc, interp = 0x2b678, result = 0), line 4311 in "tclBasic.c"
    [4] TclNRRunCallbacks(interp = 0x2b678, result = 0, rootPtr = 0x211bd0, tebcCall = 1), line 4258 in "tclBasic.c"
    [5] TclExecuteByteCode(interp = 0x2b678, codePtr = 0x1fb1e0), line 2855 in "tclExecute.c"
    [6] NRCallTEBC(data = 0x14fe6c, interp = 0x2b678, result = 0), line 4334 in "tclBasic.c"
    [7] TclNRRunCallbacks(interp = 0x2b678, result = 0, rootPtr = (nil), tebcCall = 0), line 4258 in "tclBasic.c"
    [8] Tcl_EvalObjv(interp = 0x2b678, objc = 4, objv = 0x2bdd8, flags = 2097152), line 4029 in "tclBasic.c"
    [9] TclEvalEx(interp = 0x2b678, script = 0x47f00 "# all.tcl --\n#\n# This file contains a top-level script to run all of the Tcl\n# tests. Execute it by invoking "source all.test" when running tcltest\n# in this directory.\n#\n# RCS: @(#) $Id: all.tcl,v 1.2 2002/04/02 02:29:43 hobbs Exp $\n\nif {[lsearch [namespace children] ::tcltest] == -1} {\n package require tcltest\n namespace import ::tcltest::*\n}\n\nset ::tcltest::testSingleFile false\nset ::tcltest::testsDirectory [file dir [info script]]\n\n# We need to ensure that the testsDirectory is absolute\n::tcltest" ..., numBytes = 1934, flags = 0, line = 43), line 5151 in "tclBasic.c"
    [10] Tcl_EvalEx(interp = 0x2b678, script = 0x47f00 "# all.tcl --\n#\n# This file contains a top-level script to run all of the Tcl\n# tests. Execute it by invoking "source all.test" when running tcltest\n# in this directory.\n#\n# RCS: @(#) $Id: all.tcl,v 1.2 2002/04/02 02:29:43 hobbs Exp $\n\nif {[lsearch [namespace children] ::tcltest] == -1} {\n package require tcltest\n namespace import ::tcltest::*\n}\n\nset ::tcltest::testSingleFile false\nset ::tcltest::testsDirectory [file dir [info script]]\n\n# We need to ensure that the testsDirectory is absolute\n::tcltest" ..., numBytes = 1934, flags = 0), line 4852 in "tclBasic.c"
    [11] Tcl_FSEvalFileEx(interp = 0x2b678, pathPtr = 0x41830, encodingName = (nil)), line 1753 in "tclIOUtil.c"
    [12] Tcl_Main(argc = -1, argv = 0xffbee4d4, appInitProc = 0x11328 = &Tcl_AppInit(Tcl_Interp *interp)), line 353 in "tclMain.c"
    [13] main(argc = 2, argv = 0xffbee4cc), line 87 in "tclAppInit.c"

     
  • Mikhail T.

    Mikhail T. - 2009-07-31

    Strange... I just checked the profile.test on Linux -- under valgrind -- and there were no errors... It looks like your Solaris is 64-bit... Maybe, it is that? There are patches in FreeBSD port, that address /some/ 64-bit issues:

    Try applying what's under http://www.freebsd.org/cgi/cvsweb.cgi/ports/lang/tclX/files/ and check again... Thanks!

     
  • Larry W. Virden

    Larry W. Virden - 2009-07-31

    I tried to add the patches, but quickly ran into compile warnings after doing so.
    "../generic/tclXkeylist.c", line 424: warning: implicit function declaration: alloca
    "../generic/tclXkeylist.c", line 424: warning: improper pointer/integer combination: op "="
    "../generic/tclXkeylist.c", line 883: warning: end-of-loop code not reached
    "../generic/tclXkeylist.c", line 982: warning: Prototype mismatch in arg 3 for function TclX_KeyedListGetKeys:
    function : old style declaration pointer to const char
    prototype: pointer to char
    "../generic/tclXkeylist.c", line 1259: warning: argument #2 is incompatible with prototype:
    prototype: pointer to char : "../generic/tclXkeylist.c", line 226
    argument : pointer to const char

    After adding the alloca.h header, I was able to get rid of one of the warnings. The profile.test still core dumped.

    I can continue to apply these patches of casts, but the fact of the matter is that at the point of the coredump, there is an attempt to dereference a null ptr - in PushProcCallFrame, line 1582, the procPtr->cmdPtr is null. That wouldn't be due to a cast, but some other issue.

    Also, these compiles _should_ be 32 bit compiles, as far as I am aware.

     
  • Mikhail T.

    Mikhail T. - 2009-07-31

    You are right -- you are doing 32-bit. I was looking at the originator's message initially and noticed the wide pointers.

    I'm puzzled, why you are seeing crashes and I don't even see a valgrind warning here -- the tests completes cleanly on both Linux/x86 and FreeBSD/amd64 after my patch.

    Maybe, we are using a different Tcl? I use tcl-8.5.5, what's yours?

     
  • Larry W. Virden

    Larry W. Virden - 2009-07-31

    My Tcl 8.5.x version is frozen in production, so I've been testing against Tcl 8.6 beta.

     
  • Mikhail T.

    Mikhail T. - 2009-07-31

    I would not be at all surprised, that 8.6 is causing a problem. Especially, 8.6 /beta/ :-) Please, check with 8.5 (you don't need Tcl's libraries recompiled and can use the production binaries). Thanks!

     
  • Larry W. Virden

    Larry W. Virden - 2009-07-31

    If I build and test against tcl 8.5.4 libraries, (which is where my production is frozen), the profile.test passes without core dumping with the patch listed earlier in this thread.

    Hopefully at least this patch can get added soon into Tclx CVS.

    Then, someone is going to have to look into why TclX and Tcl 8.6 is having problems.

    Thanks for your help!

     
  • Mikhail T.

    Mikhail T. - 2014-08-02

    Larry, if -- five years later -- you are still interested in TclX and its profile-command, please, try this patch -- in particular, the last part of it, which patches tclXprofile.c

    The changes modify TclX code to use the official API-calls instead of modifying the internal structures directly. Two of the tests inside profile.test will fail (4.2 and 4.4), if used with Tcl-8.6 -- because ::error is now "internal". Everything else ought to work as before. Let me know... Thanks!

     
  • michel bruant

    michel bruant - 2015-04-09

    Hi Mikahail,

    I patched tclx with your version 1.5 of tclXprofile.c ; because I faced the same issue described here.

    I still have a segmentation violation. It is improved because I think the profiler is now called back by tcl. But (line556) : infoPrt->savedCmdInfo.objProc is a null pointer.
    Please tell me if you think another patch can be done for that.
    Many thanks;
    Michel

     

Log in to post a comment.