Artifacts Associated With Ticket 2724403fffffffffffffffffffffffffffffffff
Ticket change [30c3ea8636] (rid 93312) by venksi on 2009-04-01 03:41:23:
- assignee initialized to: "msofer"
- cmimetype initialized to: "text/plain"
- comment initialized to:
This is on cvs-head as of 4:00 PM Mar. 31, 2009 PDT. The first example aborts. Changing the name of the coroutine from "::y::run" to "run" (as done in the sed command below) makes it pass. (> is my shell prompt). > cat a.tcl puts [info patchlevel] set interp [interp create x] $interp eval { namespace eval ::y {} proc ::y::start {} {yield; puts hello} } $interp alias ::bgerror ::bgerror $interp eval [list coroutine ::y::run ::y::start] interp delete $interp > tclsh8.6 a.tcl 8.6b1.1 Argument location tracking table not empty Abort > sed -e s/::y::run/run/ < a.tcl > b.tcl > tclsh8.6 b.tcl 8.6b1.1 > - foundin initialized to: "obsolete: 8.6b1.1"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "venksi"
- subsystem initialized to: "45. Parsing and Eval"
- title initialized to: "Using namespace'd name causes coroutine to abort."
- type initialized to: "Bug"
Ticket change [d0956b37ff] (rid 113210) by msofer on 2009-04-01 10:47:41:
- priority changed to: "9 Immediate"
Ticket change [e5110017d5] (rid 88069) by dkf on 2009-04-03 20:54:44:
- icomment:
Looks like a finalization order bug. Yuck.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [96d828a385] (rid 106394) by venksi on 2009-04-07 03:48:59:
- icomment:
A note that adding a vwait forever as the last statement still causes it to crash. The crash is not at app exit time.
- login: "venksi"
- mimetype: "text/plain"
- username: "venksi"
- icomment:
Ticket change [102f789707] (rid 94927) by msofer on 2009-04-07 04:24:59:
- icomment:
no no, it is in the interplay between: suspended coroutine deletion, namespace deletion and interp finalization. It has nothing to do with app finalization.
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [bce7436376] (rid 101827) by msofer on 2009-05-01 23:03:58:
- icomment:
This is an incomplete command deletion when triggered by namespce deletion. The proof is that the test script (a) runs ok if we '$interp eval {rename ::y::run {}}' before deleting $interp (b) crashes if we '$interp eval {namespace delete ::y}' before deleting $interp - login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [fbdf2f4487] (rid 108134) by msofer on 2009-05-02 13:03:32:
- icomment:
The problem seems to be that TclTeardownNamespace is never called on ::y The namespace is active when the call to Tcl_DeleteNamespace is called on it, so it is only marked as NS_DYING|NS_KILLED, and is supposed to be torn down (among others, deleting all its commands) when the CallFrame is popped. But the coro's frame is never dropped in this case, so the ns is not torn down and the command ::y::run is never deleted. Nasty.
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [32f66d7f6b] (rid 93706) by msofer on 2009-05-02 21:43:38:
- icomment:
Confirmed leak on namespace deletion: run the following script and monitor the mem growth under top! while 1 { set ns ::y[incr q] namespace eval $ns {} proc ${ns}::start {} {yield; puts hello} coroutine ${ns}::run ${ns}::start namespace delete $ns after 1 } Note that both [run] and [start] need to be in the same namespace for the bug to occur: * [start] has a CallFrame that keeps $ns active: $ns is set to be torn down when [start] returns * [start] will be forced to return when the coro is wound down, which will be triggered by [run]'s deletion * [run] will be deleted when $ns is torn down That is: $ns will be torn down when [run] is deleted, and [run] will be deleted when $ns is torn down: a sort of deadlock. - login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [ed878f4b4c] (rid 103902) by msofer on 2009-05-02 21:45:00:
- title changed to: "Delete NS with active coro -> leak"
Ticket change [baa9cf1aba] (rid 129360) by msofer on 2009-05-03 11:00:06:
- icomment:
see also bu #1655294 (thx dgp)
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [d4858af1df] (rid 123456) by msofer on 2009-05-09 17:23:32:
- icomment:
Possible solutions: (1) change the (undocumented) semantics of namespace deletion: after a call to [namespace delete] all of the namespace's children, commands and vars are immediately gone (and so are unavailable for use in deletion traces). Currently there is a predictable order of category deletion (first vars, then commands, then children) and an unpredictable order within categories. This order can be maintained while proceeding to remove everything immediately. (2) make coroutines special: THEY are killed immediately on [namespace delete]. Currently this is done only for ensembles.
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [a21171f977] (rid 109831) by msofer on 2009-05-09 21:11:31:
- icomment:
File Added - 326338: 2724403.patch
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [506a9e6199] (rid 125959) by msofer on 2009-05-09 22:27:18:
- icomment:
File Deleted - 326338:
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [271d653d5b] (rid 88464) by msofer on 2009-05-09 22:27:41:
- icomment:
File Added - 326349: 2724403.patch
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [d091aec4e3] (rid 113206) by msofer on 2009-05-09 22:29:22:
- icomment:
File Deleted - 326349:
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [325d914b25] (rid 93600) by msofer on 2009-05-09 23:44:42:
- icomment:
Patch attached with new ns deletion policy: everything goes at once! Flag bits NS_DYING and NS_DEAD are removed, nsPtr->activationCount is history too. References are now all kept in nsPtr->refCount: nsName objs, CallFrames, parent namespace. The patch does solve the issues in this bug.
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [b6b1370f9c] (rid 125464) by msofer on 2009-05-09 23:44:43:
- assignee changed to: "dgp"
Ticket change [4f28f4b6d2] (rid 125776) by msofer on 2009-05-09 23:45:08:
- icomment:
File Added - 326361: 2724403.patch
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [bbf3b1135e] (rid 129573) by msofer on 2009-05-09 23:46:54:
- icomment:
Forgot to mention that there are a few failing tests: those that relied on parts of a dying ns being still there
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [9afe793ef4] (rid 111046) by msofer on 2009-05-10 02:21:36:
- icomment:
File Deleted - 326361:
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Add attachment "2724403.patch" [87a7b842bc] (rid 131735) by msofer on 2009-05-10 02:21:55.
Ticket change [6520941330] (rid 92897) by msofer on 2009-05-10 02:21:56:
- icomment:
File Added - 326372: 2724403.patch
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [062d36f4c9] (rid 89174) by msofer on 2009-05-10 11:58:53:
- icomment:
The failing tests are namespace-7.1, 35.1 and 46.8; trace-34.4; var-1.16-18
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
- icomment:
Ticket change [d7dd6b9b61] (rid 107340) by dgp on 2009-12-10 02:19:46:
- assignee changed to: "msofer"
- icomment:
The failure in the original bug report no longer fails on the HEAD. Fixed?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
Ticket change [55c5308f8b] (rid 94206) by dgp on 2009-12-10 02:22:21:
- icomment:
the leak demo in the 2009-05-02 comment still appears leaky though. Prospects?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [a5f22122b6] (rid 98516) by dkf on 2010-01-01 15:55:48:
- icomment:
Thinking through it, I'd favour deleting the coroutines first (solution #2) so that they get a chance to run any teardown code (i.e., deletion/unset traces) first. Like that, it would minimize the number of additional bugs introduced from places where user code is relying on the current deletion order. You only need to scan through for coroutines in the case where the activationCount is non-zero.
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [966a955d8b] (rid 106320) by msofer on 2010-01-04 03:38:38:
- closedate changed to: "2010-01-03T20:38:38"
- closer changed to: "msofer"
- icomment:
allow_comments - 1 fixed in head using solution #2; keeping the #1 patch which yet come in handy if/when we attack [Bug 1655294]
- login: "msofer"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "msofer"