Bug 9331 - tcpudp: daemon leaks fd temporarily; keeping connection open
Summary: tcpudp: daemon leaks fd temporarily; keeping connection open
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Networking (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-05 13:40 UTC by Enrico Scholz
Modified: 2016-10-07 14:00 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
patch (1.64 KB, patch)
2016-10-05 13:40 UTC, Enrico Scholz
Details

Note You need to log in before you can comment on or make changes to this bug.
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!