Tcl Library Source Code

View Ticket
Login
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.