Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-14
02:27 • Ticket [218495ffff] tcl 8.0.3 incompatibility in Tcl_CreateChannelHandler st... artifact: 16f4b7bb96 user: dgp
2000-10-26
08:23 • Closed ticket [218495ffff]. artifact: 9863e62f91 user: welch
01:01 • New ticket [218495ffff]. artifact: 1ce8f5711c user: nobody

tcl 8.0.3 incompatibility in Tcl_CreateChannelHandler

Closed / Fixed218495ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:01:19
OriginalBugID: 714 Bug
Version: 8.0.3
SubmitDate: '1998-10-13'
LastModified: '1999-10-21'
Severity: SER
Status: Released
Submitter: admin
ChangedBy: hobbs
OS: All
OSVersion: NA
Machine: NA
FixedDate: '1999-10-21'
FixedInVersion: 8.2.1
ClosedDate: '2000-10-25'


 > I've been fighting with a bug/feature of Tcl 8.0.3 until I read the solution
 > on comp.lang.tcl.  The problem is that I've been using some Tcl channels
 > that I never register with an interpreter.  I register a channel handler 
 > which only works for one event under 8.0.3 whereas it worked without fail
 > under 8.0p2 and ealier.
 > 
 > I understand that you've changed Tcl_CreateChannelHandler internally so
 > that it now requires you to have registered the channel or it will be closed
 > on the first event.  Since this is a SIGNIFICANT CHANGE, I think this should
 > be noted somewhere as either a known bug or at least an incompatibility
 > introduced in the 8.0.3 release to save others the waste of time that I
 > experienced.  Adding a call to Tcl_RegisterChannel is simple enough, but it
 > should be posted somewhere visisble, IMHO.  :-)
 > 
 > -- Mike

Colin and Jacob made this fix.  It seems there is a possibility
that a channel structure can get garbage collected out from under
Tcl_NotifyChannel if the channel is closed during the notify callback.
In particular, a fileevent script that closes its handle seems to
have triggered this bug in some plug-in context.

The fix they made is just wrong, however, as it precludes the close
from having any effect, so if you wanted to see error codes from
the Tcl close command, they would be lost.  I believe the fix is
to use TclPreserve instead of Tcl_RegisterChannel.

--Brent


As of 8.2.1, Tcl_NotifyChannel uses Tcl_Preserve/Tcl_Release
(fix made sometime before 8.2). 
-- 10/21/1999 hobbs
welch Closed ticket [218495ffff]. [History diff]2000-10-26 08:23:18
dgp Ticket [218495ffff]: 3 changes [History diff]2001-04-14 02:27:18
Log in (anonymous is fine) to add a comment.