Artifacts Associated With Ticket 3006741fffffffff
Ticket change [bedb7d2ff0] (rid 102156) by coldstore on 2010-05-25 03:28:58:
- assignee initialized to: "ferrieux"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Tcl_LogCommandInfo crashes Program received signal SIGSEGV, Segmentation fault. Tcl_LogCommandInfo (interp=0x804da18, script=0x88ecae8 "::apply {r {\n variable pending 0\n variable starting 1\n set r [::yield]\n \n while {$starting || $pending > 0} {\n\tset starting 0\t;# one shot at starting\n\t# this coroutine loops around acce"..., command=0x88ecae8 "::apply {r {\n variable pending 0\n variable starting 1\n set r [::yield]\n \n while {$starting || $pending > 0} {\n\tset starting 0\t;# one shot at starting\n\t# this coroutine loops around acce"..., length=3142) at /home/colin/Desktop/packages/tcl/generic/tclNamesp.c:4964 CVS checkin dates tested: 2010.04.05.14.00.00 - OK 2010.04.06.14.00.00 - breaks Stack backtrace and relevant inspection attached. - foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "8"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "coldstore"
- subsystem initialized to: "45. Parsing and Eval"
- title initialized to: "SIGSEGV in Tcl_LogCommandInfo"
- type initialized to: "Bug"
Add attachment "gdb" [372077ebd9] (rid 107225) by coldstore on 2010-05-25 10:29:16.
Ticket change [2aeec3dd23] (rid 118652) by coldstore on 2010-05-25 10:29:20:
- icomment:
File Added - 375048: gdb
- login: "coldstore"
- mimetype: "text/plain"
- username: "coldstore"
- icomment:
Ticket change [29022788db] (rid 88800) by nijtmans on 2010-05-25 17:52:19:
- icomment:
Without an example script which causes this SIGSEGV, it's almost impossible to reproduce this. Sure, it's related to the TIP #348 Implementation.
- login: "nijtmans"
- mimetype: "text/plain"
- username: "nijtmans"
- icomment:
Ticket change [520cbc16c5] (rid 126242) by ferrieux on 2010-05-25 19:03:46:
- icomment:
Don't worry Jan, Colin did this because of an SF shortage. He sent me additional info by e-mail. We'll be bringing those data here now that SF seems to be back up.
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [9ac2f9f66f] (rid 111011) by coldstore on 2010-05-25 19:49:06:
- icomment:
I can reproduce it perfectly reliably. The problem arises in tclNamesp.c:4958 where you have 'if (iPtr->varFramePtr != iPtr->framePtr', and then traverse a chain of links following frame->callerVarPtr when one of those links (the second, in this case) wasn't in fact a frame, but a string, and interestingly always the same string. I note that when the crash was occurring iPtr->varFramePtr == iPtr->rootFramePtr I also note that the crash is occurring in the top-most level of a coroutine. Is it possible that coroutines' top level frame (that is, #1 within the coro) doesn't have its frame initialized to correctly point to rootFramePtr as its caller var frame? It's also worth noting that the error is occurring in an ::apply which is running as the command of a coro, and both the ::apply namespace and the coro's namespace are not what you would sort of normally expect. It's a pretty complex case.
- login: "coldstore"
- mimetype: "text/plain"
- username: "coldstore"
- icomment:
Ticket change [216bf93c3d] (rid 130581) by coldstore on 2010-05-25 20:15:53:
- icomment:
I spent approximately 4 hours today looking for ways to trap this bug under gdb and valgrind, and tracing the fault to these patches. The problem is that in some circumstances the interp->framePtr->callerVarPtr chain is broken. Is there a case in which a frame can be created containing an uninitialized callerVarPtr? I certainly could not observe callerVarPtr being explicitly set to the value which I consistently observed to be the bogus pointer. Given the context within which the segv occurred, I suggest that these cases may be associated with ::apply or with ::coroutine, but defer to Alexandre's specific knowledge of the patches and what they seek to achieve. I avoided the crash by testing for the condition 'iPtr->varFramePtr != iPtr->rootFramePtr' in addition to the existing test 'iPtr->varFramePtr != iPtr->framePtr'. I note that this condition normally terminates the function in which the crash occurs, except in the case that varFramePtr != rootFramePtr, which is (I believe incorrectly) interpreted by the code as meaning that there's an uplevel in play. I do not know under which conditions both of these predicates might be true, nor the accurate and complete interpretation of varFramePtr != framePtr, but something smells wrong about the interpretation being placed upon it, and I suspect the assumption that it strongly implies [uplevel] is false in the case of either ::coroutine or ::apply, or both.
- login: "coldstore"
- mimetype: "text/plain"
- username: "coldstore"
- icomment:
Ticket change [241bdb687a] (rid 131055) by ferrieux on 2010-05-25 21:17:40:
- icomment:
Thank you very much for all this work Colin. Now my knowledge of this is currently restricted to that of a mere user of the xxxFramePtrs's. The patches in question (TIP 348) indeed crawl the linked list of frames in order to report the objv[] at each level (CALL elements of errorstack). A secondary task (which wasn't initially intended) is to detect [uplevel] shifts and report them (UP elements). At some point during the development I had noticed that shunning the root frame helped avoiding artifacts at the end of the list; but dgp chimed in and offered a different logic, which is in HEAD now. Donald, maybe you have an insight on the present issue ? Clearly, all this critically depends on the invariants of the xxxFramePtr graph, which I'd love to get my hands on :} I asked Miguel for a bit of help.
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [a205d9f96b] (rid 109823) by coldstore on 2010-05-28 10:14:00:
- closedate changed to: "2010-05-28T03:14:00"
- closer changed to: "coldstore"
- icomment:
allow_comments - 1 The cause of this SEGV was found to be stack corruption caused by a bug in coroutines. It's good that the error-time collection of frame information flushed this out, but I think it may be worth adding some conditional debuggin narrative to explicitly perform this kind of forensic inspection.
- login: "coldstore"
- mimetype: "text/plain"
- status changed to: "Closed"
- username: "coldstore"
Ticket change [54562f6683] (rid 93930) by ferrieux on 2010-05-28 15:15:05:
- icomment:
allow_comments - 0 For reference, let's spell out the better circumscribed bugreport that you've just created on the issue: 3008307 . As a an aside, how would you "perform this kind of forensic inspection" ? static int IsCorrupted(CallFrame * frame) { /* magical code here */ } ? - login: "ferrieux"
- mimetype: "text/plain"
- resolution changed to: "Duplicate"
- username: "ferrieux"
- icomment:
Ticket change [2a54b59a3f] (rid 118541) by coldstore on 2010-05-28 15:20:21:
- icomment:
I would recommend conditional narrative debugging emitted on Callframe POP and PUSH and on CONTEXT_SAVE and _RESTORE. The narrative would consist of a dump of the stack's contents in hex. I've got the code, and could throw some #ifdefs around it, and roll it into the core, if that's broadly considered acceptable.
- login: "coldstore"
- mimetype: "text/plain"
- username: "coldstore"
- icomment: