Artifacts Associated With Ticket 730244ffffffffff
Ticket change [cc65b7873f] (rid 95690) by dgp on 2003-04-30 15:34:56:
- assignee initialized to: "msofer"
- cmimetype initialized to: "text/plain"
- comment initialized to:
This script panics: interp create i proc test args {puts $args} trace add execution test enter {interp alias i alias {} ;#} interp alias i alias {} test this i eval alias The problem is that TEOVI does not use refCounting to protect the elements of the objv array. So if a trace frees an argument value, that value is not available for command procedure execution. Most TEOVI callers manage refCounts, but Tcl_EvalObjv does not; thus interp alias calls do not. A fix is to add objv refCounting to Tcl_EvalObjv, at an unknown performance cost. Thoughts? - foundin initialized to: "obsolete: 8.4.2"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "dgp"
- subsystem initialized to: "45. Parsing and Eval"
- title initialized to: "missing refCount management in Tcl_EvalObjv"
- type initialized to: "Bug"
Ticket change [021a050bcd] (rid 119589) by msofer on 2003-04-30 22:40:40:
- icomment:
Logged In: YES user_id=148712 Another fix is to document that TEOV requires that the caller hold a counted reference to its arguments, and insure that all core calls respect this. No performance cost for bytecodes (which do not suffer this problem), more complexity ...
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [c7860f769b] (rid 121944) by dgp on 2003-04-30 22:51:35:
- icomment:
Logged In: YES user_id=80530 there's any number of solutions, but it's best not to get too tricky, and expecially best not to let the trickiness escape to the public interface. Would be best if each routine in the core managed refCounts according to its own needs rather than serving callers, or called routines. TEOVI is what needs refCounts, to preserve objs across trace and normal execution calls. Tcl_EvalEx, for example, currently does incr/decr of refcounts, even though it doesn't really need to. It does only one thing with objv, pass it in to TEOVI.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [99d677221b] (rid 110856) by dgp on 2003-04-30 23:26:28:
- icomment:
Logged In: YES user_id=80530 this issue combined with TclInterpReady checks and numLevels management suggest that the TEOVI callers in tclBasic.c really have different needs from the caller in tclExecute.c. Another level of wrapping could help here.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [628979c900] (rid 92422) by msofer on 2003-04-30 23:49:58:
- icomment:
Logged In: YES user_id=148712 The TclInterpReady difference may actually be a bug in TEBC: [Bug 495830]
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [d1ec20146b] (rid 113435) by dgp on 2003-05-01 00:58:48:
- icomment:
Logged In: YES user_id=80530 my comment about Tcl_EvalEx's need for refCounts was incorrect. Since it pulls values from the interp result, it needs to claim each one before moving on to do substitutions for the next one.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [cd5788d4bd] (rid 95875) by dkf on 2003-05-13 04:41:03:
- icomment:
Logged In: YES user_id=79902 Looks like a bug in alias handling to me.The problem is that the deleting of the alias makes the refcounts on the (leading) arguments decrease at an unexpected time, resulting in the refcounts for the command obj dropping to zero before the return of Tcl_EvalObjv (so violating the general contractural principle of Tcl_Eval* functions.) Traces are the most obvious way of triggering this, yes, but I'd hate to swear that that's the only way it could happen. Two ways to fix this: 1) incr the refcounts of the prefix part of the alias command for the duration of the alias call 2) decouple the Alias structure from the alias command lifespan, and use refcounting to delete *that* only when the last reference to it (whether from the command or from the executing instances) goes away. I prefer the second way, but the first would do too. I don't think either will be too expensive in practice. - login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [453efcaa01] (rid 99319) by dgp on 2003-05-13 05:36:17:
- icomment:
Logged In: YES user_id=80530 Fix committed for 8.4.3 and to the HEAD for the panic in the example script. Fix does refCounting on the words of the target of an interp alias, to make up for the fact that Tcl_EvalObjv doesn't take care of itself. Leaving this report open until we get Tcl_EvalObjv itself changed, or good documentation on what callers must do to protect themselves.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [38bcb7b153] (rid 112259) by msofer on 2005-02-10 08:15:54:
- icomment:
Logged In: YES user_id=148712 I tend to agree with donal: refcount the Alias structure.
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [9cbdafa0bd] (rid 96198) by msofer on 2005-02-10 08:18:26:
- icomment:
Logged In: YES user_id=148712 The general rule should be: any objv array passed to a Tcl function should be guaranteed (by the caller) to be valid until the function returns. Thisbug is related to 1119369, as noted by dgp
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [9ea0d48912] (rid 96511) by dgp on 2005-02-10 08:26:16:
- icomment:
Logged In: YES user_id=80530 That judgment is reasonable; from that perspective, this is a documentation bug.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [0271e67592] (rid 119649) by msofer on 2006-10-01 02:37:23:
- closedate changed to: "2006-09-30T19:37:23"
- closer changed to: "msofer"
- icomment:
Logged In: YES user_id=148712 Doc bug seems reasonable. What's the place to document these general features? Should we add a special man page or README file for extenders?
- login: "msofer"
- mimetype: "text/plain"
- status changed to: "Pending"
- username: "msofer"
Ticket change [0742b7871f] (rid 89360) by dgp on 2006-10-01 09:39:42:
- icomment:
Logged In: YES user_id=80530 Unless I'm missing something, it's callers of Tcl_EvalObjv() that need to take precautions so the docs for Tcl_EvalObjv() are where the issue needs to be made clear.
- login: "dgp"
- mimetype: "text/plain"
- status changed to: "Open"
- username: "dgp"
- icomment:
Ticket change [a915da6354] (rid 99096) by msofer on 2006-10-01 20:35:39:
- closedate changed to: "2006-10-01T13:35:39"
- closer changed to: "msofer"
- icomment:
Logged In: YES user_id=148712 Added the comment to doc/Eval.3. My point was: the elements of every objv array passed to Tcl should be valid until return, not only in the case of TEOVI. Where are such "general rules" documented?
- login: "msofer"
- mimetype: "text/plain"
- status changed to: "Pending"
- username: "msofer"
Ticket change [fbf38336c3] (rid 108148) by sf-robot on 2006-10-16 09:20:05:
- closedate changed to: "2006-10-16T02:20:05"
- closer changed to: "sf-robot"
- icomment:
Logged In: YES user_id=1312539 This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker).
- login: "sf-robot"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "sf-robot"