Bug 9331

Summary: tcpudp: daemon leaks fd temporarily; keeping connection open
Product: Busybox Reporter: Enrico Scholz <enrico.scholz>
Component: NetworkingAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:
Attachments: patch

Description Enrico Scholz 2016-10-05 13:40:29 UTC
Created attachment 6741 [details]
patch

When the concurrency feature (-c) is used, the 'tcpsvd' parent process
will keep the last connection open until slots are free.

This is unwanted, especially in '-c 1' cases.  E.g.

$ cat <<EOF > /tmp/test
#! /bin/sh

# do something
sleep 10

# close file descriptor
exec 0<&-
exec 1>&-

# do some other thing
exec sleep 3600
EOF

$ chmod a+x /tmp/test

$ tcpsvd -v -c 2 0 8001 /tmp/test

----

$ nc <ip> 8001 < /dev/null &
$ nc <ip> 8001 < /dev/null &


-->  The first 'nc' will return after 10 seconds, but the second will wait until '/tmp/test' finishes (--> 3600s).

Attached patch fixes this.
Comment 1 Denys Vlasenko 2016-10-07 14:00:29 UTC
Fixed in git. Thanks!