mirror of
https://repo.or.cz/socat.git
synced 2025-07-26 20:12:56 +00:00
fixed a bug where sub processes would become zombies because the master process caught SIGCHLD but did not wait()
This commit is contained in:
parent
1f5165b765
commit
3b3b004ff8
4 changed files with 84 additions and 1 deletions
50
test.sh
50
test.sh
|
@ -8029,6 +8029,56 @@ PORT=$((PORT+1))
|
|||
N=$((N+1))
|
||||
|
||||
|
||||
# there was a bug with udp-recvfrom and fork: terminating sub processes became
|
||||
# zombies because the master process did caught SIGCHLD but did not wait()
|
||||
NAME=UDP4RECVFROM_SIGCHLD
|
||||
case "$TESTS" in
|
||||
*%functions%*|*%ip4%*|*%udp%*|*%dgram%*|*%$NAME%*)
|
||||
TEST="$NAME: test if UDP4-RECVFROM child becomes zombie"
|
||||
# idea: run a udp-recvfrom process with fork and -T. Sent it one packet, so a
|
||||
# sub process is forked off. Make some transfer and wait until the -T timeout
|
||||
# is over. Now check for the child process: if it is zombie the test failed.
|
||||
# Correct is that child process terminated
|
||||
tf="$td/test$N.stdout"
|
||||
te="$td/test$N.stderr"
|
||||
tdiff="$td/test$N.diff"
|
||||
tsl=$PORT
|
||||
ts="$LOCALHOST:$tsl"
|
||||
da=$(date)
|
||||
CMD1="$SOCAT $opts -T 0.5 UDP4-RECVFROM:$tsl,reuseaddr,fork PIPE"
|
||||
CMD2="$SOCAT $opts - UDP4-SENDTO:$ts"
|
||||
printf "test $F_n $TEST... " $N
|
||||
$CMD1 >"$tf" 2>"${te}1" &
|
||||
pid1=$!
|
||||
waitudp4port $tsl 1
|
||||
echo "$da" |$CMD2 >>"$tf" 2>>"${te}2"
|
||||
rc2=$?
|
||||
sleep 1
|
||||
#read -p ">"
|
||||
l="$(childprocess $pid1)"
|
||||
kill $pid1 2>/dev/null; wait
|
||||
if [ $rc2 -ne 0 ]; then
|
||||
$PRINTF "$NO_RESULT\n" # already handled in test UDP4DGRAM
|
||||
numCANT=$((numCANT+1))
|
||||
elif ! echo "$da" |diff - "$tf" >"$tdiff"; then
|
||||
$PRINTF "$NO_RESULT\n" # already handled in test UDP4DGRAMM
|
||||
numCANT=$((numCANT+1))
|
||||
elif $(isdefunct "$l"); then
|
||||
$PRINTF "$FAILED: $SOCAT:\n"
|
||||
echo "$CMD1 &"
|
||||
echo "$CMD2"
|
||||
cat "${te}1" "${te}2"
|
||||
numFAIL=$((numFAIL+1))
|
||||
else
|
||||
$PRINTF "$OK\n"
|
||||
if [ -n "$debug" ]; then cat "${te}1" "${te}2"; fi
|
||||
numOK=$((numOK+1))
|
||||
fi ;;
|
||||
esac
|
||||
PORT=$((PORT+1))
|
||||
N=$((N+1))
|
||||
|
||||
|
||||
echo "summary: $((N-1)) tests; $numOK ok, $numFAIL failed, $numCANT could not be performed"
|
||||
|
||||
if [ "$numFAIL" -gt 0 ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue