Skip to content
Tcl Source Code View Ticket
Login

View Ticket

FinalizeIO makes bad assumption

Closed / Fixed1192047fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 15 years ago
Descriptionplain2005-04-28 22:56:05
A comment from TclFinalizeIOSubsystem:

/*
 * Close it only if the refcount indicates that the
channel is not
 * referenced from any interpreter. If it is, that
interpreter will
 * close the channel when it gets destroyed.
 */

The clear assumption is that later finalization
stages will destroy all existing interpreters
and finish the task of closing channels.

But that's not true, as pointed out in reports
218705 and 227269.  Exit handlers are not
routinely established to destory interps.

This mismatch between assumption and
reality is contributing to Bug 1191344.

Either we should fulfill RFE 227269 and
satisfy the assumptions in TFIOS, or we
should recode TFIOS to not make those
assumptions.
dgpplain2005-04-29 22:45:25
Logged In: YES 
user_id=80530


A related problem should be observed
in any program that calls
Tcl_GetStdChannel, but then never
creates an interp.  That standard
channel will also not be closed during
finalization.
andreas_kupriesplain2005-10-06 03:17:58
Logged In: YES 
user_id=75003

Note: 218705  is a bug in time_t handling and cannot see
that it has relevance here.
dgpplain2005-10-06 07:54:54
Logged In: YES 
user_id=80530

typo.  218075
dgpplain2005-11-22 02:02:40
Logged In: YES 
user_id=80530

hoping to fix this for 8.4.12
dgpplain2006-06-10 02:48:55
Logged In: YES 
user_id=80530


FR 227269 cannot be fulfilled,
so TFIOS needs re-coding to
recognize that it cannot
depend on interp deletion taking
place in later stages of finalization.
dgp Ticket [1192047fff]: 1 change [History diff]2006-06-10 02:48:56
andreas_kupriesplain2006-09-26 05:04:35
Logged In: YES 
user_id=75003

Do we have a place or document which clearly lists the
various stages of finalization and what actions happen when,
i.e. in what order ?

Maybe some general lifecycle document for both interpreters,
and the whole library ? From which we can derive life-cycle
information for dependent structures, like channels.
dgp Ticket [1192047fff]: 2 changes [History diff]2007-12-04 01:48:42
[email protected]plain2008-11-12 14:46:29
Yet another effect of this is 1028264 (socket: failed write prevents read).
I'm ready to dive in, but please lend me your oxygen tanks.
Any material on the harmony of finalizations would be more than welcome.
ferrieuxplain2008-11-12 14:47:59
Sorry, that nobody was me :-}
ferrieuxplain2009-05-07 03:29:41
See also 486399 for yet another criticism of the finalization sequence.
ferrieuxplain2011-09-24 05:21:45
Gone with 2001201 quick exit reform.
Log in (anonymous is fine) to add a comment.