Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rc-service stop deley one second for each service #609

Open
cattyhouse opened this issue Mar 11, 2023 · 3 comments
Open

rc-service stop deley one second for each service #609

cattyhouse opened this issue Mar 11, 2023 · 3 comments

Comments

@cattyhouse
Copy link

cattyhouse commented Mar 11, 2023

issue

both supervise-daemon and start-stop-daemon have the issue.

let's say we have 5 services to stop in a script :

for service in A B C D E ; do rc-service $service stop ; done

A takes 0.09s to stop, but after that, each of B C D E takes about 1 seconds to stop.

tested distro

  • alpine linux, has the issue

alpine 3.11-3.17 and current edge, aarch64 and x86_64, all have the same issue

  • gentoo livecd with openrc 0.45.2, does not have the issue

Gentoo livecd install-arm64-minimal-20230305T233159Z.iso with openrc 0.45.2 , but no issue. every service takes about 0.05s~0.09s to stop

it would be nice if the devs could run below test on your favorite distro and verify, thanks a lot

test script

#!/bin/sh
# what is this for
# well, if we stop multiple services in a script
# the first one is always fast, but after that, it becomes super slow
#

# nc is a good program to test supervise-daemon
# create 5 nc daemons, listen on 5 different port


# prepare
echo '+++ prepare 5 nc daemons +++'
echo

for i in 1 2 3 4 5 ; do

cat <<EOF > /etc/init.d/supervise-daemon_$i
#!/sbin/openrc-run
supervisor="supervise-daemon"
command="/bin/busybox"
command_args="nc -l -s 127.0.0.1 -p 3000$i"
EOF

chmod +x /etc/init.d/supervise-daemon_$i
echo "created /etc/init.d/supervise-daemon_$i"

done
echo


# measure start
echo "+++ measure time to start 5 daemons +++"
echo

for i in 1 2 3 4 5 ; do
    echo "==> starting supervise-daemon_$i"
    time rc-service -q supervise-daemon_$i start
    echo
done

echo "+++ measure time to stop 5 daemons +++"
echo

# measure stop
for i in 1 2 3 4 5 ; do
    echo "==> stopping supervise-daemon_$i"
    time rc-service -q supervise-daemon_$i stop
    echo
done
# clean
for i in 1 2 3 4 5 ; do
    rm -f /etc/init.d/supervise-daemon_$i
    echo "/etc/init.d/supervise-daemon_$i deleted"
done

test result (on alpine linux)

+++ prepare 5 nc daemons +++

created /etc/init.d/supervise-daemon_1
created /etc/init.d/supervise-daemon_2
created /etc/init.d/supervise-daemon_3
created /etc/init.d/supervise-daemon_4
created /etc/init.d/supervise-daemon_5

+++ measure time to start 5 daemons +++

==> starting supervise-daemon_1
real	0m 0.91s
user	0m 0.43s
sys	0m 0.49s

==> starting supervise-daemon_2
real	0m 0.09s
user	0m 0.02s
sys	0m 0.04s

==> starting supervise-daemon_3
real	0m 0.08s
user	0m 0.03s
sys	0m 0.03s

==> starting supervise-daemon_4
real	0m 0.09s
user	0m 0.02s
sys	0m 0.03s

==> starting supervise-daemon_5
real	0m 0.10s
user	0m 0.03s
sys	0m 0.03s

+++ measure time to stop 5 daemons +++

==> stopping supervise-daemon_1
real	0m 0.09s
user	0m 0.03s
sys	0m 0.04s

==> stopping supervise-daemon_2
real	0m 1.00s
user	0m 0.06s
sys	0m 0.33s

==> stopping supervise-daemon_3
real	0m 1.00s
user	0m 0.09s
sys	0m 0.36s

==> stopping supervise-daemon_4
real	0m 0.99s
user	0m 0.09s
sys	0m 0.35s

==> stopping supervise-daemon_5
real	0m 1.00s
user	0m 0.08s
sys	0m 0.39s

/etc/init.d/supervise-daemon_1 deleted
/etc/init.d/supervise-daemon_2 deleted
/etc/init.d/supervise-daemon_3 deleted
/etc/init.d/supervise-daemon_4 deleted
/etc/init.d/supervise-daemon_5 deleted

note : i reported the issue on alpine aport issue, but got closed, they say it is better to report to upstream.

@nekopsykose
Copy link
Contributor

was it fixed?

@cattyhouse
Copy link
Author

was it fixed?

nope. someone who cares can reopen this issue

@nekopsykose
Copy link
Contributor

nope.

then don't close it

@cattyhouse cattyhouse reopened this May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants