Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-10-12
13:54 • Pending ticket [994748ffff]: Tcl_RegisterChannel: duplicate channel names pl... artifact: a2d34d04a3 user: serhiy.storchaka
13:54 • Ticket [994748ffff]: 3 changes artifact: d3027f483e user: serhiy.storchaka
2005-10-10
02:34 • Open ticket [994748ffff]. artifact: 6a819126e2 user: mistachkin
2005-10-06
05:59 • Pending ticket [994748ffff]. artifact: 6ecf0e55c4 user: andreas_kupries
2004-10-29
02:38 • Ticket [994748ffff]: 4 changes artifact: 34fe5e5ff5 user: andreas_kupries
2004-08-03
16:33 • Ticket [994748ffff]: 2 changes artifact: 5fa4a0fd0e user: dkf
2004-07-20
19:25 • New ticket [994748ffff]. artifact: 639e88e179 user: mistachkin

Tcl_RegisterChannel: duplicate channel names

Pending994748ffffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 51 days ago
Descriptionplain2004-07-20 19:25:05
After running TkChat for a long time, the panic
"Tcl_RegisterChannel: duplicate channel names" is seen
upon exiting.  This bug seems to exist in HEAD and
core-8-4-branch.  Here is the stack trace:

NTDLL! DbgBreakPoint address 0x77f7645c
TCL84! Tcl_PanicVA + 201 bytes
TCL84! Tcl_Panic + 31 bytes
TCL84! Tcl_RegisterChannel + 122 bytes
TCL84! Tcl_SocketObjCmd + 1071 bytes
TCL84! TclEvalObjvInternal + 778 bytes
TCL84! Tcl_EvalEx + 577 bytes
TCL84! Tcl_EvalObjEx + 200 bytes
TCL84! Tcl_EvalObjCmd + 123 bytes
TCL84! TclEvalObjvInternal + 778 bytes
TCL84! TclCompEvalObj + 4284 bytes
TCL84! TclCompEvalObj + 405 bytes
TCL84! TclObjInterpProc + 1259 bytes
TCL84! TclEvalObjvInternal + 778 bytes
TCL84! TclCompEvalObj + 4284 bytes
TCL84! TclCompEvalObj + 405 bytes
TCL84! TclObjInterpProc + 1259 bytes
TCL84! TclEvalObjvInternal + 778 bytes
TCL84! TclCompEvalObj + 4284 bytes
TCL84! TclCompEvalObj + 405 bytes
TCL84! TclObjInterpProc + 1259 bytes
TCL84! TclEvalObjvInternal + 778 bytes
TCL84! Tcl_EvalEx + 577 bytes
TCL84! Tcl_Eval + 23 bytes
TCL84! Tcl_GlobalEval + 44 bytes
TK84! Tk_BindEvent + 2510 bytes
TK84! TkBindEventProc + 405 bytes
TK84! Tk_HandleEvent + 1747 bytes
TK84! Tk_DestroyWindow + 762 bytes
TK84! Tk_DestroyWindow + 513 bytes
TK84! Tk_DestroyWindow + 513 bytes
TK84! Tk_GetNumMainWindows + 279 bytes
TCL84! Tcl_Finalize + 105 bytes
TCL84! Tcl_Exit + 8 bytes
TCL84! Tcl_ExitObjCmd + 104 bytes
TCL84! TclEvalObjvInternal + 778 bytes
TCL84! TclCompEvalObj + 4284 bytes
TCL84! TclCompEvalObj + 405 bytes
TCL84! TclObjInterpProc + 1259 bytes
TCL84! TclEvalObjvInternal + 778 bytes
TCL84! Tcl_EvalEx + 577 bytes
TCL84! Tcl_Eval + 23 bytes
TCL84! Tcl_GlobalEval + 44 bytes
TK84! TkWmProtocolEventProc + 174 bytes
TK84! Tk_HandleEvent + 1431 bytes
TK84! TkQueueEventForAllChildren + 216 bytes
TCL84! Tcl_ServiceEvent + 138 bytes
TCL84! Tcl_DoOneEvent + 425 bytes
TK84! Tk_MainLoop + 25 bytes
TK84! Tk_MainEx + 1305 bytes
WISH84! 004010ab()
WISH84! 004015be()
dkf Ticket [994748ffff]: 2 changes [History diff]2004-08-03 16:33:30
andreas_kupriesplain2004-10-29 02:38:06
Logged In: YES 
user_id=75003

Could it be that the generator for channel names wrapped
around ?  I.e could it be that socket created a new channel,
and the name it created for it was the name of an existing
channel which had not been closed ? This would also imply
that tkchat is leaking socket channel handles. 

Looking deeper at the stack - It seems that some code tries
to _create_ a new socket while the core is in the
finalization (exit -> finalization -> destroy window ->
event -> event handler = eval -> .... -> socket -> boom).

Were you able to reproduce this, with a stack telling us
more about the program state ?

How long had you let tkchat run to get this ?
andreas_kupriesplain2005-10-06 05:59:05
Logged In: YES 
user_id=75003

Is this still reproducible with the current heads of 8.4 and
main branch ?
mistachkinplain2005-10-10 02:34:07
Logged In: YES 
user_id=113501


I believe that this bug still exists in at least 8.4 and
possibly HEAD.  TkChat was changed to use Jabber, so I'm not
sure if you can repro this bug using TkChat any more;
however, I do not believe that this bug was ever "fixed".  I
think that some of the other IO finalization bugs may be
related.
serhiy.storchakawiki2026-10-12 13:54:02

I cannot reproduce this with 8.6.18 and 9.1 on Windows and Linux: a script which leaves 300 sockets open and creates 300 more from a <Destroy> binding of . during exit exits cleanly. Socket channel names are now derived from the address of the channel state, so a new socket cannot get the name of a channel that is still registered.

serhiy.storchaka Pending ticket [994748ffff]. [History diff]2026-10-12 13:54:02
Log in (anonymous is fine) to add a comment.