Artifacts Associated With Ticket 3165503fffffffff
Ticket change [49e1454569] (rid 126443) by sehmann on 2011-01-25 20:45:20:
- assignee initialized to: "msofer"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Tested on Linux: Linux XXX YYYY #5 SMP Mon Nov 16 15:30:32 PST 2009 x86_64 x86_64 x86_64 GNU/Linux Compiled tcl8.5.9 like this: configure --prefix=/home/sehmann/tcltk-8.5.9 --enable-shared --enable-64bit --enable-symbols make install These problems do not occur on tcl8.4.9, we are trying to upgrade and this is a blocker. Case 1) This is the case for my application C code: Tcl_Obj* cmdArgs[3]; cmdArgs[0] = Tcl_NewStringObj("::testtest", -1); cmdArgs[1] = Tcl_NewStringObj("::testtest2", -1); cmdArgs[2] = Tcl_NewIntObj(1); int result = Tcl_EvalObjv(interp, 3, cmdArgs, TCL_EVAL_GLOBAL); TCL code: proc testtest2 {} { error "this is a test error" } proc testtest {foo bar} { $foo } Gives: Error message: UpdateStringProc should not be invoked for type cmdName Program received signal SIGABRT, Aborted. Stack trace: #0 0x0000003eb752e21d in raise () from /lib64/tls/libc.so.6 #1 0x0000003eb752fa1e in abort () from /lib64/tls/libc.so.6 #2 0x00007ffff7e85a7d in Tcl_PanicVA (format=0x7ffff7ed4870 "UpdateStringProc should not be invoked for type %s", argList=0x7fffffff9c60) at /home/sehmann/tcl8.5.9/unix/../generic/tclPanic.c:103 #3 0x00007ffff7e85b57 in Tcl_Panic (format=0x7ffff7ed4870 "UpdateStringProc should not be invoked for type %s") at /home/sehmann/tcl8.5.9/unix/../generic/tclPanic.c:132 #4 0x00007ffff7e82d94 in Tcl_GetStringFromObj (objPtr=0x170c5b0, lengthPtr=0x7fffffff9da4) at /home/sehmann/tcl8.5.9/unix/../generic/tclObj.c:1626 #5 0x00007ffff7e73d47 in UpdateStringOfList (listPtr=0xec4dd0) at /home/sehmann/tcl8.5.9/unix/../generic/tclListObj.c:1872 #6 0x00007ffff7e82da6 in Tcl_GetStringFromObj (objPtr=0xec4dd0, lengthPtr=0x7fffffff9e7c) at /home/sehmann/tcl8.5.9/unix/../generic/tclObj.c:1629 #7 0x00007ffff7de411d in Tcl_EvalObjv (interp=0x504640, objc=3, objv=0x7fffffff9f10, flags=131072) at /home/sehmann/tcl8.5.9/unix/../generic/tclBasic.c:3919 Case 2) This is disturbing C code: Tcl_Obj* cmdArgs[3]; cmdArgs[0] = Tcl_NewStringObj("::testtest", -1); cmdArgs[1] = Tcl_NewStringObj("::testtest2", -1); cmdArgs[2] = Tcl_NewIntObj(1); int result = Tcl_EvalObjv(interp, 3, cmdArgs, TCL_EVAL_GLOBAL); TCL code: proc testtest2 {} { error "this is a test error" } proc testtest {foo bar} { testtest2 } Gives: Error message: Program received signal SIGSEGV, Segmentation fault. Stack trace (infinite recursion): #0 0x00007ffff7e73c47 in UpdateStringOfList (listPtr=0xec4dd0) at /home/sehmann/tcl8.5.9/unix/../generic/tclListObj.c:1848 #1 0x00007ffff7e82da6 in Tcl_GetStringFromObj (objPtr=0xec4dd0, lengthPtr=0x7ffffdfc40a4) at /home/sehmann/tcl8.5.9/unix/../generic/tclObj.c:1629 #2 0x00007ffff7e73d47 in UpdateStringOfList (listPtr=0xec4dd0) at /home/sehmann/tcl8.5.9/unix/../generic/tclListObj.c:1872 #3 0x00007ffff7e82da6 in Tcl_GetStringFromObj (objPtr=0xec4dd0, lengthPtr=0x7ffffdfc41a4) at /home/sehmann/tcl8.5.9/unix/../generic/tclObj.c:1629 #4 0x00007ffff7e73d47 in UpdateStringOfList (listPtr=0xec4dd0) at /home/sehmann/tcl8.5.9/unix/../generic/tclListObj.c:1872 #5 0x00007ffff7e82da6 in Tcl_GetStringFromObj (objPtr=0xec4dd0, lengthPtr=0x7ffffdfc42a4) at /home/sehmann/tcl8.5.9/unix/../generic/tclObj.c:1629 #6 0x00007ffff7e73d47 in UpdateStringOfList (listPtr=0xec4dd0) at /home/sehmann/tcl8.5.9/unix/../generic/tclListObj.c:1872 #7 0x00007ffff7e82da6 in Tcl_GetStringFromObj (objPtr=0xec4dd0, lengthPtr=0x7ffffdfc43a4) at /home/sehmann/tcl8.5.9/unix/../generic/tclObj.c:1629 #8 0x00007ffff7e73d47 in UpdateStringOfList (listPtr=0xec4dd0) at /home/sehmann/tcl8.5.9/unix/../generic/tclListObj.c:1872 #9 0x00007ffff7e82da6 in Tcl_GetStringFromObj (objPtr=0xec4dd0, lengthPtr=0x7ffffdfc44a4) at /home/sehmann/tcl8.5.9/unix/../generic/tclObj.c:1629 #10 0x00007ffff7e73d47 in UpdateStringOfList (listPtr=0xec4dd0) at /home/sehmann/tcl8.5.9/unix/../generic/tclListObj.c:1872 #11 0x00007ffff7e82da6 in Tcl_GetStringFromObj (objPtr=0xec4dd0, lengthPtr=0x7ffffdfc45a4) at /home/sehmann/tcl8.5.9/unix/../generic/tclObj.c:1629 #12 0x00007ffff7e73d47 in UpdateStringOfList (listPtr=0xec4dd0) at /home/sehmann/tcl8.5.9/unix/../generic/tclListObj.c:1872 #13 0x00007ffff7e82da6 in Tcl_GetStringFromObj (objPtr=0xec4dd0, lengthPtr=0x7ffffdfc46a4) at /home/sehmann/tcl8.5.9/unix/../generic/tclObj.c:1629 #14 0x00007ffff7e73d47 in UpdateStringOfList (listPtr=0xec4dd0) at /home/sehmann/tcl8.5.9/unix/../generic/tclListObj.c:1872 #15 0x00007ffff7e82da6 in Tcl_GetStringFromObj (objPtr=0xec4dd0, lengthPtr=0x7ffffdfc47a4) at /home/sehmann/tcl8.5.9/unix/../generic/tclObj.c:1629 #16 0x00007ffff7e73d47 in UpdateStringOfList (listPtr=0xec4dd0) at /home/sehmann/tcl8.5.9/unix/../generic/tclListObj.c:1872 #17 0x00007ffff7e82da6 in Tcl_GetStringFromObj (objPtr=0xec4dd0, lengthPtr=0x7ffffdfc48a4) at /home/sehmann/tcl8.5.9/unix/../generic/tclObj.c:1629 #18 0x00007ffff7e73d47 in UpdateStringOfList (listPtr=0xec4dd0) at /home/sehmann/tcl8.5.9/unix/../generic/tclListObj.c:1872 #19 0x00007ffff7e82da6 in Tcl_GetStringFromObj (objPtr=0xec4dd0, lengthPtr=0x7ffffdfc49a4) at /home/sehmann/tcl8.5.9/unix/../generic/tclObj.c:1629 - foundin initialized to: "obsolete: 8.5.9"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "sehmann"
- subsystem initialized to: "45. Parsing and Eval"
- title initialized to: "Tcl_EvalObjv has two types of crashes"
- type initialized to: "Bug"
Ticket change [b97d15a347] (rid 129157) by msofer on 2011-01-26 04:10:05:
- closedate changed to: "2011-01-25T21:10:05"
- closer changed to: "msofer"
- icomment:
There is a is pilot error: the elements in objv should have a reference count maintained by the caller. Do for (i=0; i<3; i++) { Tcl_IncrRefCount(cmdArgs[i]); } Tcl_EvalObjv((interp, 3, cmdArgs, TCL_EVAL_GLOBAL); for (i=0; i<3; i++) { result = Tcl_DecrRefCount(cmdArgs[i]); } Does this fix the problem? - login: "msofer"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Pending"
- username: "msofer"
Ticket change [e950d26dd7] (rid 104801) by msofer on 2011-01-26 04:15:34:
- icomment:
Oops ... this box is bad for editing, isn't it? Make it or (i=0; i<3; i++) { Tcl_IncrRefCount(cmdArgs[i]); } result = Tcl_EvalObjv((interp, 3, cmdArgs, TCL_EVAL_GLOBAL); for (i=0; i<3; i++) { Tcl_DecrRefCount(cmdArgs[i]); } - login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [06fb888478] (rid 89306) by sehmann on 2011-01-26 04:36:48:
- icomment:
This works, thanks Miguel! I can see if any Tcl internals do: incr do something decr then the object will get deleted so I need to incr/decr to make sure it survives to the end of the call. Is there any document describing this? All the tcl docs I have looked at so far have not highlighted this sort of point.
- login: "sehmann"
- mimetype: "text/plain"
- status changed to: "Open"
- username: "sehmann"
- icomment:
Ticket change [315aa1905a] (rid 93413) by msofer on 2011-01-26 04:42:15:
- icomment:
The man page http://tcl.tk/man/tcl8.5/TclLib/Eval.htm says: "The caller of Tcl_EvalObjv has to manage the reference count of the elements of objv, insuring that the objects are valid until Tcl_EvalObjv returns." Conceded, the point was not stressed in the 8.4 man page.
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [bdf272a880] (rid 101993) by msofer on 2011-01-26 04:42:32:
- closedate changed to: "2011-01-25T21:42:32"
- closer changed to: "msofer"
- icomment:
allow_comments - 1
- login: "msofer"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "msofer"