Tcl Library Source Code

View Ticket
Login
2026-11-16
00:06 • Ticket [4811399edc] comm disconnect after race condition status still Open with 3 other changes artifact: 4447039aa4 user: serhiy.storchaka
00:06 • Ticket [1491894fff] comm "-listen 0" causes race conditions status still Open with 3 other changes artifact: 37049016dd user: serhiy.storchaka
2026-11-15
23:35
Fix [4811399edc], [1491894fff]: comm raised an error when a client disconnected after the "commIncoming race condition" warning. commLostConn now clears the pending sends and the peer entry only when the lost connection is the registered one, and the warning is no longer printed for remote id 0, which all non-listening clients share. leaf check-in: 09fc83dd5b user: serhiy.storchaka tags: comm-lost-conn-peer
2006-05-19
22:27 • New ticket [1491894fff] comm "-listen 0" causes race conditions. artifact: 7381d2c991 user: nobody

Ticket UUID: 1491894
Title: comm "-listen 0" causes race conditions
Type: Bug Version: None
Submitter: nobody Created on: 2006-05-19 22:27:46
Subsystem: comm Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Open Last Modified: 2026-11-16 00:06:14
Resolution: None Closed By:
    Closed on:
Description:
I observed this behavior using comm 4.3 as delivered with ActiveTcl 
8.4.11.

Today for the first time I tried creating multiple comm channels in
one program.  (Hitherto I'd just used comm::comm directly.)  According
to the man page, if you do this:

    comm::comm new mychan -listen 0

you get a channel with an ID of "0".  You can send out with it, but
there's no listening socket, so you can't connect to it; it has to
connect out.  Well and good; I thought that was what I wanted.

So suppose I send a command to a comm(n) channel at port 10001:

   mychan send 10001 {some command}

The receiver sees the command as coming from sender with id 0.  In
short, the receiver can't distinguish between commands coming from
multiple senders which specify -listen 0 (assuming they are all on
the same host).

This is a problem for me at the application level, because I want to
distinguish between the different clients who connect to my server.
But it also appears to be a problem for comm as well: if I
start up several clients with channels that use -listen 0, my server
starts outputting ugly messages like "commIncoming race condition: 
0".

The work around is simply to use "-listen 1"....but it makes me
wonder whether "-listen 0" is actually useful for anything.

[email protected]
User Comments: serhiy.storchaka added on 2026-11-16 00:06:14:

The same bug as [4811399edc]; proposed fix in branch comm-lost-conn-peer.