dbclient using 100% CPU
Jamie Lokier
jamie at shareable.org
Tue Oct 4 20:34:36 WST 2005
I'm using dbclient on an ARM + uClinux device, and I see that it's
using 100% CPU although it has nothing to do.
The command looks like this:
dbclient -T -i /root/.ssh/id_rsa.db 192.168.0.100 -R 10136:127.0.0.1:23 'while :; do echo keepalive; sleep 20; done'
The standard input and standard output are both /dev/null. ( If
standard output is not /dev/null, I don't see 100% CPU, but the same
"select for read on standard output" behaviour described below occurs. )
The output of strace explains the 100% CPU:
select(4, [1 3], [], NULL, {20, 0}) = 1 (in [1], left {20, 0})
gettimeofday({1105499730, 917033}, NULL) = 0
write(1, NULL, 0) = 0
select(4, [1 3], [], NULL, {20, 0}) = 1 (in [1], left {20, 0})
gettimeofday({1105499731, 117149}, NULL) = 0
write(1, NULL, 0) = 0
... repeating ...
Why is it selecting for _read_ on the standard _output_ file
descriptor? That looks like a bug to me.
The function setchannelfds() in common-channel.c may be the culprit.
The code and comments in setchannelfds() contradict the comments in
channel.h, concerning roles of channel->infd and channel->outfd:
/* Stuff to put over the wire */
if (channel->transwindow > 0) {
if (channel->outfd >= 0) {
FD_SET(channel->outfd, readfd);
/* Stuff from the wire, to local program/shell/user etc */
if ((channel->infd >= 0 && cbuf_getused(channel->writebuf) > 0 )
|| channel->initconn) {
FD_SET(channel->infd, writefd);
but:
int infd; /* data to send over the wire */
int outfd; /* data for consumption, what was in writebuf */
Thanks,
-- Jamie
More information about the Dropbear
mailing list