Artifacts Associated With Ticket 1482718fffffffffffffffffffffffffffffffff
Ticket change [dfc5ed2d89] (rid 115067) by eugene_cdn on 2006-05-05 19:57:21:
- assignee initialized to: "dgp"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OS: Solaris 5.8. Removing trace on second level of recursive call can corrupt or substitute wrong number of compiled variables for first level of recursion. Then, on return, TclLookupSimpleVar() will have two different values of number of compiled variables in procPtr->numCompiledLocals (5) and varFramePtr->numCompiledLocals (3) at tclVar.c, line 818. Then loop for all variables (line 823) will use bigger value, procPtr->numCompiledLocals, and it will crash on accessing varFramePtr->compiledLocals out of bound. Please use attached testcase for reproducing the bug.
- foundin initialized to: "obsolete: 8.4.11"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "eugene_cdn"
- subsystem initialized to: "46. Traces"
- title initialized to: "crash after removing trace in recursive call"
- type initialized to: "Bug"
Ticket change [e36d383bf6] (rid 87798) by eugene_cdn on 2006-05-06 02:57:21:
- icomment:
File Added - 176972: trace.tgz
- login: "eugene_cdn"
- mimetype: "text/plain"
- username: "eugene_cdn"
- icomment:
Add attachment "trace.tgz" [39bba61d3b] (rid 112442) by eugene_cdn on 2006-05-06 02:57:21.
Ticket change [79205034ae] (rid 90071) by dgp on 2006-05-06 11:30:56:
- foundin changed to: "obsolete: 8.4.14"
- icomment:
Logged In: YES user_id=80530 looks like it's still there in 8.4.13. Upping priority to see if it can get resolved before 8.4.14.
- login: "dgp"
- mimetype: "text/plain"
- priority changed to: "9 Immediate"
- username: "dgp"
Ticket change [e0262e83f3] (rid 115144) by dgp on 2006-05-09 02:32:23:
- subsystem changed to: "07. Variables"
Ticket change [fee37d9eaf] (rid 108662) by dgp on 2006-05-09 02:32:24:
- assignee changed to: "msofer"
- icomment:
Logged In: YES user_id=80530 Traces are probably involved, but the root cause of the crash appears to be corruption of a Var struct, so let's bring the Var expert in on this. Miguel, the crash happens at line 828 of tclVar.c where localVarPtr->name has a bogus value, even though localVarPtr->refCount is 19. Any hints?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
Ticket change [c67e2c2c57] (rid 121782) by dgp on 2006-05-09 03:01:26:
- icomment:
Logged In: YES user_id=80530 ok, as original report already observed, root cause is that procPtr->numCompiledLocals and varFramePtr->numCompiledLocals do not agree. Since the for loop at line 825 fundamentally loops over varFramePtr->compiledLocals, it would make more sense to use varFramePtr->numCompiledLocals to set the loop limit. Simply making that change appears to fix this bug. But leaves several questions raised. Why do we need to store the same info in two places? And once we've done that, just what corruption is forcing them to get out of sync?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [7e1d32042a] (rid 97353) by dgp on 2006-05-09 04:16:35:
- icomment:
Logged In: YES user_id=80530 oops! the loop traverses data from both structs, so the two numCompiledLocals simply must agree. miguel reports: miguelthe CallFrame's is set from the Proc's at tclProc.c line 979. Should not be modified, ever
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [47267eaedd] (rid 99643) by dgp on 2006-05-09 11:21:42:
- icomment:
Logged In: YES user_id=80530 I added a test that the two numCompiledLocals values were the same, and a Tcl_Panic() when they are not. This let me detect the problem directly without needing lots of other things "just so" to force a segfault. This let me simplify the demo script to: load libtrace.so proc Console:Eval {cmd} { set enterx 0 set ret [uplevel #0 $cmd] if {$enterx} {} return $ret } Console:Eval { closeTrace Console:Eval {} } The value mismatch happens because [closeTrace] calls Tcl_DeleteTrace() which advances the bytecode compile epoch (line 5208 of tclBasic.c). This means the nested [Console:Eval] call is a different compile from the outer one, and the two compiles are done under different settings of the DONT_COMPILE_CMDS_INLINE flag. The different compile rules may well explain the different number of compiledLocals. The remaining bug here appears to be that the CallFrame of the outer call now has a procPtr field pointing to a Proc corresponding to the re-compile? Either that should not happen, or if it's ok for that to happen, then the TclLookupSimpleVar needs a rewrite to not assume the CallFrame and Proc agree about their compiledLocals lists. - login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [38cc6be9ae] (rid 112271) by dgp on 2006-05-10 21:06:00:
- assignee changed to: "dgp"
- icomment:
Logged In: YES user_id=80530 Based on a plan laid out by miguel, I have a fix for this in my development sources. I'll post a patch for testing after access to CVS is restored.
- login: "dgp"
- mimetype: "text/plain"
- subsystem changed to: "22. [proc] and [uplevel]"
- username: "dgp"
Ticket change [bae88491f6] (rid 129393) by dgp on 2006-05-10 22:06:49:
- icomment:
File Added - 177474: 1482718.patch Logged In: YES user_id=80530 Here's the patch against 8.4.13. Note the patch leaves the bug unfixed when the routine getting recompiled is due to a call to TclProcCompileProc() from an extension intruding on internals.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [b0ca310598] (rid 98041) by dgp on 2006-05-10 23:02:15:
- icomment:
Logged In: YES user_id=80530 Patch is flawed; examining...
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [f56df319f1] (rid 130103) by dgp on 2006-05-10 23:18:33:
- icomment:
Logged In: YES user_id=80530 Here's the corrected patch for 8.4.13.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Add attachment "1482718.patch" [ecc7106440] (rid 103764) by dgp on 2006-05-10 23:18:34.
Ticket change [4227dc1dc6] (rid 116316) by dgp on 2006-05-10 23:18:34:
- icomment:
File Deleted - 177474: File Added - 177485: 1482718.patch
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [acb0ad7bf1] (rid 101338) by dgp on 2006-05-10 23:23:53:
- icomment:
Logged In: YES user_id=80530 And the corresponding patch for 8.5a4
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Add attachment "1482718-85.patch" [c14e0c125b] (rid 111301) by dgp on 2006-05-10 23:23:53.
Ticket change [9fca4d36aa] (rid 96702) by dgp on 2006-05-10 23:23:54:
- icomment:
File Added - 177487: 1482718-85.patch
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [84fce49296] (rid 131245) by dgp on 2006-05-14 00:16:53:
- status changed to: "Closed"
Ticket change [1a71b4faba] (rid 122979) by dgp on 2006-05-14 00:16:54:
- closedate changed to: "2006-05-13T17:16:54"
- closer changed to: "dgp"
- icomment:
Logged In: YES user_id=80530 fixed for 8.4.14 and 8.5a5
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- username: "dgp"
Ticket change [e70d7f94f9] (rid 104390) by msofer on 2008-08-10 22:38:01:
- icomment:
Logged In: YES user_id=148712 Originator: NO Removed the fix in HEAD: this is not needed at least since varReform, where the local variable data at runtime is read from the CallFrame and/or the LocalCache. Reopened to consider this for backporting to 8.5, although my inclination is to leave the stable branch alone: this is removing unneeded code, not a bugfix.
- login: "msofer"
- mimetype: "text/plain"
- status changed to: "Open"
- username: "msofer"
- icomment:
Ticket change [410d82b421] (rid 116110) by dgp on 2008-08-13 21:32:16:
- assignee changed to: "msofer"
Ticket change [573a883bda] (rid 94447) by msofer on 2008-08-14 03:37:59:
- closedate changed to: "2008-08-13T20:37:59"
- closer changed to: "msofer"
- status changed to: "Pending"
Ticket change [0752eb27ab] (rid 89376) by sf-robot on 2008-08-29 09:20:18:
- closedate changed to: "2008-08-29T02:20:18"
- closer changed to: "sf-robot"
- icomment:
Logged In: YES user_id=1312539 Originator: NO 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"