Race condition in Tcl_WriteChars?

Russell Harrison rc.harrison at gmail.com
Fri Aug 12 04:35:16 UTC 2005


I am running rancid 2.3.1 with expect 5.42.1 and tcl 8.4.7 and Linux
kernel 2.6.10.  clogin has exhibited a problem when running
interactively, particularly when executing a command that generates a
large amount of output (show run, show access-list, show cry map, show
cry ips sa, etc).

It appears that a buffer is getting stuck somewhere along the way, as
the same 4095 byte chunk of text is repeatedly written to stdout.  In
some cases this eventually clears and the output moves on (only to get
stuck on another chunk of text later).  Strace shows that write is
returning -1 with errno set to EAGAIN.  It is interesting to note that
this still happens when the

if ((rc == -1) && (errno == EAGAIN) goto retry;

line of exp_chan.c is commented out.

I've run expect through a debugger with breakpoints set in the
expWriteChars function - this behaviour is not exhibited when the
program is run in this way.  This leads me to believe that it is a
race condition of some sort.  The easy solution to this issue is
probably using a different version of expect and tcl - however if
there is an existing patch which would resolve this issue that would
be preferable.

Thanks,

Russell



More information about the Rancid-discuss mailing list