#599502 telnetd enters busy waiting loop when login program exits too quickly

Package:
telnetd
Source:
netkit-telnet
Description:
basic telnet server
Submitter:
Marc Lehmann
Date:
2015-01-17 20:54:15 UTC
Severity:
normal
Tags:
#599502#5
Date:
2010-10-08 07:11:52 UTC
From:
To:
I have the following line in my inetd.conf:

   telnet          stream  tcp4    nowait          nobody  /usr/sbin/in.telnetd    in.telnetd      -hL /etc/rc.telnet

If /etc/rc.telnet contains this:

   #!/bin/sh
   echo hi

And I telnet to the machine, I get "hi" as output and the connection stays
open, with in.telnetd using a lot of cpu time and having a zombie child
(rc.telnet).

Strace shows it is calling select and read in a tight loop:

   select(4, [0 3], [], [0], NULL)         = 1 (in [3])
   read(3, 0x60b5e0, 8192)                 = -1 EIO (Input/output error)
   select(4, [0 3], [], [0], NULL)         = 1 (in [3])
   read(3, 0x60b5e0, 8192)                 = -1 EIO (Input/output error)
   select(4, [0 3], [], [0], NULL)         = 1 (in [3])
   read(3, 0x60b5e0, 8192)                 = -1 EIO (Input/output error)
   select(4, [0 3], [], [0], NULL)         = 1 (in [3])
   read(3, 0x60b5e0, 8192)                 = -1 EIO (Input/output error)

If I add a "sleep 1" to rc.telnet, then the connection is closed properly,
so there seems to be a race condition somewhere.

#599502#12
Date:
2015-01-17 20:29:11 UTC
From:
To:
package telnetd
tag 599502 + moreinfo
thanks

I am not able to reproduce this error with telnet_0.17-36
on a physical i386 system and on a virtual amd64 system.
The first still uses the old init system, whereas the latter
is running systemd. Both machines use xinetd as superserver.
The disturbance does not appear with the experimental 0.17-37.

Regards,
  Mats Erik Andersson