Artifacts Associated With Ticket 2270477
Ticket change [a3508b5c83] (rid 110027) by nobody on 2008-11-12 16:34:46:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
TclFinalizeIOSubsystem contains a loop which runs until all channels in the linked list have the CHANNEL_DEAD flag set. If any channels are not referenced by interpreters, the loop calls Tcl_Close() to close the channel and, presumably, remove it from the linked list. However, under some circumstances, Tcl_Close does not remove the channel from the list, and instead schedules it for removal at a later time. If this happens, TclFinalizeIOSubsystem will spin forever. I have seen this happen when expect exits while running a test suite under dejagnu. Unfortunately, I do not have a simple reproduction case. But perhaps the loop should guard against this case by checking for CHANNEL_CLOSED as well as CHANNEL_DEAD? I really don't understand the design well enough to be sure.
- foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "None"
- title initialized to: "TclFinalizeIOSubsystem can loop endlessly"
- type initialized to: "Bug"
Ticket change [73a3716892] (rid 105070) by dgp on 2008-11-12 23:57:51:
- assignee changed to: "andreas_kupries"
- foundin changed to: "obsolete: 8.5.5"
- priority changed to: "8"
- subsystem changed to: "25. Channel System"
Add attachment "iofinloop.patch" [e525457fa7] (rid 88082) by ferrieux on 2008-11-17 07:48:19.
Ticket change [092589a5d0] (rid 89669) by ferrieux on 2008-11-17 07:48:19:
- icomment:
File Added - 301722: iofinloop.patch Indeed I'm wondering how the loop is supposed to break out when that branch is activated. It would seem that the attached patch, setting the CHANNEL_DEAD flag also in this case, would fix the bug. It does pass the test suite, though I don't know whether finalization is really covered in today's tests. Andreas, please review. File Added: iofinloop.patch
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [6b46390059] (rid 128294) by andreas_kupries on 2008-11-26 05:18:49:
- icomment:
Accepted, and committed to 8.4, 8.5, and head branches.
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [44a2f11ded] (rid 116740) by andreas_kupries on 2008-11-26 05:18:51:
- closedate changed to: "2008-11-25T22:18:51"
- closer changed to: "andreas_kupries"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [1590189d58] (rid 124587) by ferrieux on 2008-12-01 23:19:37:
- icomment:
Reopening because the patch breaks some tests on unix, see [Bug 2371600]. Andreas, can you revert on all branches ?
- login: "ferrieux"
- mimetype: "text/plain"
- status changed to: "Open"
- username: "ferrieux"
- icomment:
Ticket change [e5bea8cc40] (rid 104181) by ferrieux on 2008-12-02 00:08:24:
- icomment:
File Added - 303625: iofinloop2.patch
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Add attachment "iofinloop2.patch" [c7840dd818] (rid 121943) by ferrieux on 2008-12-02 00:08:24.
Ticket change [b3045e703a] (rid 98444) by ferrieux on 2008-12-02 00:08:25:
- icomment:
The attached patch, now done after a more careful review of the code ;-), should do the job. Indeed the previous one was dangerous, in that it could truly demote channels from already-closed to pending-close... This one, as suggested by the OP in fact, skips any of: CHANNEL_CLOSED,CHANNEL_INCLOSE,CHANNEL_DEAD. It does pass the unix test suite ! File Added: iofinloop2.patch
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [ccda906c69] (rid 95775) by andreas_kupries on 2008-12-02 00:15:36:
- icomment:
I can certainly revert ... Ah, I see a new patch was done. The interesting thing is that I ran the test suite here (linux) after applying the patch and had no errors at all. For all branches. I am guessing that you (Don) are either on a different platform, or copiled the core with different settings than I did. Which also means that right I am not a good place to check the new patch. I will not know if my error-less state is because the new patch fixed anything or because whatever else. Don, can you please try Alexandre's new patch and report if that fixes the issue for you ?
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [220437c11b] (rid 130683) by andreas_kupries on 2008-12-02 00:15:38:
- priority changed to: "9 Immediate"
Ticket change [81825b97db] (rid 117049) by dgp on 2008-12-02 04:21:50:
- icomment:
Something's wrong, or I'm missing something. These patches don't appear to apply to Tcl 8.4.19+, which is where I have the crashes.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [af2d70315a] (rid 97763) by andreas_kupries on 2008-12-02 04:26:22:
- icomment:
AFAIK the original patch was for 8.6, and applied to 8.5 as well. Both branches use macros to handle flag modifications. In 8.4 the flag modifications are written out. Manual application is needed :(
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [e597e064ba] (rid 104144) by andreas_kupries on 2008-12-02 04:40:27:
- icomment:
File Added - 303654: iofinloop84.patch
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Add attachment "iofinloop84.patch" [81fbb10267] (rid 117141) by andreas_kupries on 2008-12-02 04:40:27.
Ticket change [c1719acb3f] (rid 111322) by ferrieux on 2008-12-02 05:04:23:
- icomment:
Yes :) Notice that the second hunk of Andreas' modified patch only applies to the latest 8.4.x (where he had applied my unfortunate first trial). If you want to apply to 8.4.19, remove that second hunk. The only thing left is: --- tcl84.orig/generic/tclIO.c2008-12-01 13:36:03.000000000 -0800 +++ tcl84/generic/tclIO.c2008-12-01 13:32:36.000000000 -0800 @@ -235,7 +235,7 @@ statePtr != NULL; statePtr = statePtr->nextCSPtr) { chanPtr = statePtr->topChanPtr; - if (!(statePtr->flags & CHANNEL_DEAD)) { + if (!(statePtr->flags & (CHANNEL_INCLOSE|CHANNEL_CLOSED|CHANNEL_DEAD))) { active = 1; break; } - login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [94c13c2577] (rid 106046) by andreas_kupries on 2008-12-02 05:32:27:
- icomment:
Alexandre's, from your comments I infer that we should apply iofinloop2.patch to the 8.5 and 8.6 branches as well, despite them not crashing, at least not right now. Right ? If yes, can you do that ?
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [92dd87c8ce] (rid 105717) by ferrieux on 2008-12-02 06:29:44:
- icomment:
You inferred correctly. In hindsight, that first attempt of mine was terrible. The second attempt is after spending some time reverse engineering that stuff, so I _think_ it is much more gentle. To be sure that it fixes the original issue is another story though (suggestions welcome to repro). However I'd prefer that you do the commit, because I have only a 8.6 sandbox ready, and it is cluttered with other patches (notably the half close)... and it's being late :-)
- login: "ferrieux"
- mimetype: "text/plain"
- username: "ferrieux"
- icomment:
Ticket change [b8704bbef8] (rid 128968) by andreas_kupries on 2008-12-02 06:36:40:
- icomment:
Ok, I will, albeit tomorrow as well.
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [55011a7ba3] (rid 94054) by andreas_kupries on 2008-12-03 01:25:15:
- icomment:
Done now.
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [8ff4340812] (rid 120361) by andreas_kupries on 2008-12-03 01:25:18:
- closedate changed to: "2008-12-02T18:25:18"
- closer changed to: "andreas_kupries"
- status changed to: "Closed"