Skip to contentSkip to conversation

Change in openvpn[master]: t_server_null: use wait instead of marker files

Openvpn-devel In review mattock (Code Review) 2 participants 6 messages Oct 25, 2024 – Oct 26, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1729861210000.Ib385080e1dd1c3046c54e6267db8aa7d5c09e2fb@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/786?usp=email

to review the following change.

Change subject: t_server_null: use wait instead of marker files
......................................................................

t_server_null: use wait instead of marker files

By using wait in a more inventive way we can avoid using a marker file to detect the "server could not be killed gracefully" situation.

Change-Id Ib385080e1dd1c3046c54e6267db8aa7d5c09e2fb

---
M tests/t_server_null.sh
M tests/t_server_null_server.sh

2 files changed, 10 insertions(+), 8 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/86/786/1

tests/t_server_null.sh +4 -4
index 3c0fc4b..74ffd52 100755
@@ -62,6 +62,8 @@
 mkdir $t_server_null_logdir
 
 "${srcdir}/t_server_null_server.sh" &
+T_SERVER_NULL_SERVER_PID=$!
+
 "${srcdir}/t_server_null_client.sh"
 retval=$?
 
@@ -69,11 +71,9 @@
 # that this script does not exit before all --dev null servers are dead and
 # their network interfaces are gone. Otherwise t_client.sh will fail because
 # pre and post ifconfig output does not match.
-wait
+wait $T_SERVER_NULL_SERVER_PID
 
-. ./t_server_null_default.rc
-
-if [ -e $SERVER_KILL_FAIL_FILE ]; then
+if [ $? -ne 0 ]; then
     exit 1
 else
     exit $retval
tests/t_server_null_server.sh +6 -4
index ab01dd2..acf8479 100755
@@ -37,8 +37,9 @@
 # Load local configuration, if any
 test -r ./t_server_null.rc && . ./t_server_null.rc
 
-# Remove server kill failure marker file, if any
-rm -f $SERVER_KILL_FAIL_FILE
+# We can't exit immediately on the first failure as that could leave processes
+# lying around.
+retval=0
 
 # Launch test servers
 for SUF in $TEST_SERVER_LIST
@@ -81,7 +82,6 @@
 # Make sure that the server processes are truly dead before exiting.  If a
 # server process does not exit in 15 seconds assume it never will, move on and
 # hope for the best.
-
 echo "Waiting for servers to exit"
 for PID_FILE in $server_pid_files
 do
@@ -111,6 +111,8 @@
         echo "ERROR: had to send SIGKILL to server ${SERVER_NAME} with pid ${SERVER_PID}!"
         echo "Tail of server log:"
         tail -n 20 "${t_server_null_logdir}/${SERVER_NAME}.log"
-        touch $SERVER_KILL_FAIL_FILE
+        retval=1
     fi
 done
+
+exit $retval

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/786?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib385080e1dd1c3046c54e6267db8aa7d5c09e2fb
Gerrit-Change-Number: 786
Gerrit-PatchSet: 1
Gerrit-Owner: mattock <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, mattock, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/786?usp=email )

Change subject: t_server_null: use wait instead of marker files
......................................................................

Patch Set 1: Code-Review+2

(1 comment)

Patchset:

PS1:
Tested on FreeBSD with the "break server signal handling" patch, and it does what it says

```
ERROR: had to send SIGKILL to server t_server_null_server-1195_tcp with pid 10997!
Tail of server log:
...
2024-10-26 11:23:27 MPS: ignore signal
FAIL: t_server_null.sh
```

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/786?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib385080e1dd1c3046c54e6267db8aa7d5c09e2fb
Gerrit-Change-Number: 786
Gerrit-PatchSet: 1
Gerrit-Owner: mattock <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mattock <[email protected]...>
Gerrit-Comment-Date: Sat, 26 Oct 2024 09:24:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw

PATCH 1/1 t_server_null: use wait instead of marker files

In reply to a message not in the archive

From: Samuli Seppänen <[email protected]...>

By using wait in a more inventive way we can avoid using a marker file to detect the "server could not be killed gracefully" situation.

Change-Id Ib385080e1dd1c3046c54e6267db8aa7d5c09e2fb

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/786
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

tests/t_server_null.sh +4 -4
index 3c0fc4b..74ffd52 100755
@@ -62,6 +62,8 @@
 mkdir $t_server_null_logdir
 
 "${srcdir}/t_server_null_server.sh" &
+T_SERVER_NULL_SERVER_PID=$!
+
 "${srcdir}/t_server_null_client.sh"
 retval=$?
 
@@ -69,11 +71,9 @@
 # that this script does not exit before all --dev null servers are dead and
 # their network interfaces are gone. Otherwise t_client.sh will fail because
 # pre and post ifconfig output does not match.
-wait
+wait $T_SERVER_NULL_SERVER_PID
 
-. ./t_server_null_default.rc
-
-if [ -e $SERVER_KILL_FAIL_FILE ]; then
+if [ $? -ne 0 ]; then
     exit 1
 else
     exit $retval
tests/t_server_null_server.sh +6 -4
index ab01dd2..acf8479 100755
@@ -37,8 +37,9 @@
 # Load local configuration, if any
 test -r ./t_server_null.rc && . ./t_server_null.rc
 
-# Remove server kill failure marker file, if any
-rm -f $SERVER_KILL_FAIL_FILE
+# We can't exit immediately on the first failure as that could leave processes
+# lying around.
+retval=0
 
 # Launch test servers
 for SUF in $TEST_SERVER_LIST
@@ -81,7 +82,6 @@
 # Make sure that the server processes are truly dead before exiting.  If a
 # server process does not exit in 15 seconds assume it never will, move on and
 # hope for the best.
-
 echo "Waiting for servers to exit"
 for PID_FILE in $server_pid_files
 do
@@ -111,6 +111,8 @@
         echo "ERROR: had to send SIGKILL to server ${SERVER_NAME} with pid ${SERVER_PID}!"
         echo "Tail of server log:"
         tail -n 20 "${t_server_null_logdir}/${SERVER_NAME}.log"
-        touch $SERVER_KILL_FAIL_FILE
+        retval=1
     fi
 done
+
+exit $retval
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: t_server_null: use wait instead of marker files

Tested on FreeBSD with the "this server is intentionally ignoring signals" patch, to make it fail. BB tested all the other platforms with well-behaved openvpn binaries.

Your patch has been applied to the master branch.

commit 5dd1b8b06335831206077a1eb4aa81c3ceb3f3ee

Author: Samuli Seppänen
Date:   Sat Oct 26 11:25:14 2024 +0200
     t_server_null: use wait instead of marker files

     Signed-off-by: Samuli Seppänen <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg29664.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by mattock. ( http://gerrit.openvpn.net/c/openvpn/+/786?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: t_server_null: use wait instead of marker files
......................................................................

t_server_null: use wait instead of marker files

By using wait in a more inventive way we can avoid using a marker file to detect the "server could not be killed gracefully" situation.

Change-Id Ib385080e1dd1c3046c54e6267db8aa7d5c09e2fb

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29664.html

---
M tests/t_server_null.sh
M tests/t_server_null_server.sh

2 files changed, 10 insertions(+), 8 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/86/786/2

tests/t_server_null.sh +4 -4
index 3c0fc4b..74ffd52 100755
@@ -62,6 +62,8 @@
 mkdir $t_server_null_logdir
 
 "${srcdir}/t_server_null_server.sh" &
+T_SERVER_NULL_SERVER_PID=$!
+
 "${srcdir}/t_server_null_client.sh"
 retval=$?
 
@@ -69,11 +71,9 @@
 # that this script does not exit before all --dev null servers are dead and
 # their network interfaces are gone. Otherwise t_client.sh will fail because
 # pre and post ifconfig output does not match.
-wait
+wait $T_SERVER_NULL_SERVER_PID
 
-. ./t_server_null_default.rc
-
-if [ -e $SERVER_KILL_FAIL_FILE ]; then
+if [ $? -ne 0 ]; then
     exit 1
 else
     exit $retval
tests/t_server_null_server.sh +6 -4
index ab01dd2..acf8479 100755
@@ -37,8 +37,9 @@
 # Load local configuration, if any
 test -r ./t_server_null.rc && . ./t_server_null.rc
 
-# Remove server kill failure marker file, if any
-rm -f $SERVER_KILL_FAIL_FILE
+# We can't exit immediately on the first failure as that could leave processes
+# lying around.
+retval=0
 
 # Launch test servers
 for SUF in $TEST_SERVER_LIST
@@ -81,7 +82,6 @@
 # Make sure that the server processes are truly dead before exiting.  If a
 # server process does not exit in 15 seconds assume it never will, move on and
 # hope for the best.
-
 echo "Waiting for servers to exit"
 for PID_FILE in $server_pid_files
 do
@@ -111,6 +111,8 @@
         echo "ERROR: had to send SIGKILL to server ${SERVER_NAME} with pid ${SERVER_PID}!"
         echo "Tail of server log:"
         tail -n 20 "${t_server_null_logdir}/${SERVER_NAME}.log"
-        touch $SERVER_KILL_FAIL_FILE
+        retval=1
     fi
 done
+
+exit $retval
Signature · 14 lines
To view, visit http://gerrit.openvpn.net/c/openvpn/+/786?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib385080e1dd1c3046c54e6267db8aa7d5c09e2fb
Gerrit-Change-Number: 786
Gerrit-PatchSet: 2
Gerrit-Owner: mattock <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/786?usp=email )

Change subject: t_server_null: use wait instead of marker files
......................................................................

t_server_null: use wait instead of marker files

By using wait in a more inventive way we can avoid using a marker file to detect the "server could not be killed gracefully" situation.

Change-Id Ib385080e1dd1c3046c54e6267db8aa7d5c09e2fb

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29664.html

---
M tests/t_server_null.sh
M tests/t_server_null_server.sh

2 files changed, 10 insertions(+), 8 deletions(-)
tests/t_server_null.sh +4 -4
index 3c0fc4b..74ffd52 100755
@@ -62,6 +62,8 @@
 mkdir $t_server_null_logdir
 
 "${srcdir}/t_server_null_server.sh" &
+T_SERVER_NULL_SERVER_PID=$!
+
 "${srcdir}/t_server_null_client.sh"
 retval=$?
 
@@ -69,11 +71,9 @@
 # that this script does not exit before all --dev null servers are dead and
 # their network interfaces are gone. Otherwise t_client.sh will fail because
 # pre and post ifconfig output does not match.
-wait
+wait $T_SERVER_NULL_SERVER_PID
 
-. ./t_server_null_default.rc
-
-if [ -e $SERVER_KILL_FAIL_FILE ]; then
+if [ $? -ne 0 ]; then
     exit 1
 else
     exit $retval
tests/t_server_null_server.sh +6 -4
index ab01dd2..acf8479 100755
@@ -37,8 +37,9 @@
 # Load local configuration, if any
 test -r ./t_server_null.rc && . ./t_server_null.rc
 
-# Remove server kill failure marker file, if any
-rm -f $SERVER_KILL_FAIL_FILE
+# We can't exit immediately on the first failure as that could leave processes
+# lying around.
+retval=0
 
 # Launch test servers
 for SUF in $TEST_SERVER_LIST
@@ -81,7 +82,6 @@
 # Make sure that the server processes are truly dead before exiting.  If a
 # server process does not exit in 15 seconds assume it never will, move on and
 # hope for the best.
-
 echo "Waiting for servers to exit"
 for PID_FILE in $server_pid_files
 do
@@ -111,6 +111,8 @@
         echo "ERROR: had to send SIGKILL to server ${SERVER_NAME} with pid ${SERVER_PID}!"
         echo "Tail of server log:"
         tail -n 20 "${t_server_null_logdir}/${SERVER_NAME}.log"
-        touch $SERVER_KILL_FAIL_FILE
+        retval=1
     fi
 done
+
+exit $retval

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/786?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib385080e1dd1c3046c54e6267db8aa7d5c09e2fb
Gerrit-Change-Number: 786
Gerrit-PatchSet: 2
Gerrit-Owner: mattock <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged