diff mbox series

[ovs-dev] daemon.at: Correctly terminate ovsdb process in a backtrace test.

Message ID 20230719103303.392470-1-i.maximets@ovn.org
State Accepted
Commit f5188ff2147517612b410ed607e3843cdf4b51a6
Headers show
Series [ovs-dev] daemon.at: Correctly terminate ovsdb process in a backtrace test. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Ilya Maximets July 19, 2023, 10:33 a.m. UTC
In a backtrace test with monitor the child process will be re-started
after being killed.  The test doesn't wait for that to happen, so it
is possible that during the test cleanup the pid in a pid file is not
updated yet.  Hence, the on-exit hook will not kill the process.

This is causing issues in Cirrus CI, because gmake on FreBSD waits for
all child processes to exit and that never happens.

Fix the issue by waiting for a new process.  It's also better to exit
gracefully instead of relying on the on-exit kill.

Fixes: 759a29dc2d97 ("backtrace: Extend the backtrace functionality.")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 tests/daemon.at | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Eelco Chaudron July 19, 2023, 11:58 a.m. UTC | #1
On 19 Jul 2023, at 12:33, Ilya Maximets wrote:

> In a backtrace test with monitor the child process will be re-started
> after being killed.  The test doesn't wait for that to happen, so it
> is possible that during the test cleanup the pid in a pid file is not
> updated yet.  Hence, the on-exit hook will not kill the process.
>
> This is causing issues in Cirrus CI, because gmake on FreBSD waits for
> all child processes to exit and that never happens.
>
> Fix the issue by waiting for a new process.  It's also better to exit
> gracefully instead of relying on the on-exit kill.
>
> Fixes: 759a29dc2d97 ("backtrace: Extend the backtrace functionality.")
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>

This looks good to me. Thanks for digging into this it will save on the manual re-runs ;)

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Ilya Maximets July 19, 2023, 5:10 p.m. UTC | #2
On 7/19/23 13:58, Eelco Chaudron wrote:
> 
> 
> On 19 Jul 2023, at 12:33, Ilya Maximets wrote:
> 
>> In a backtrace test with monitor the child process will be re-started
>> after being killed.  The test doesn't wait for that to happen, so it
>> is possible that during the test cleanup the pid in a pid file is not
>> updated yet.  Hence, the on-exit hook will not kill the process.
>>
>> This is causing issues in Cirrus CI, because gmake on FreBSD waits for
>> all child processes to exit and that never happens.
>>
>> Fix the issue by waiting for a new process.  It's also better to exit
>> gracefully instead of relying on the on-exit kill.
>>
>> Fixes: 759a29dc2d97 ("backtrace: Extend the backtrace functionality.")
>> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> 
> This looks good to me. Thanks for digging into this it will save on the manual re-runs ;)
> 
> Acked-by: Eelco Chaudron <echaudro@redhat.com>
> 

Thanks, Ales and Eelco!

Applied and backported to 3.2.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/tests/daemon.at b/tests/daemon.at
index 13cb8fc1c..2c7fac57c 100644
--- a/tests/daemon.at
+++ b/tests/daemon.at
@@ -284,4 +284,8 @@  AT_CHECK([kill -SEGV $child])
 OVS_WAIT_UNTIL([grep -q "backtrace(monitor)|WARN|SIGSEGV detected, backtrace:" ovsdb-server.log])
 OVS_WAIT_UNTIL([grep -q "daemon_unix(monitor)|ERR|1 crashes: pid .* died, killed (Segmentation fault)" ovsdb-server.log])
 
+# Wait until a new process is started before exiting, so it will be
+# stopped correctly.
+OVS_WAIT_UNTIL([test -s ovsdb-server.pid && test $(cat ovsdb-server.pid) != $child])
+OVS_APP_EXIT_AND_WAIT([ovsdb-server])
 AT_CLEANUP