Menu

#805 comm "-listen 0" causes race conditions

open
comm (23)
5
2006-05-19
2006-05-19
Anonymous
No

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.

William.H.Duquette@jpl.nasa.gov

Discussion