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

defining an extra_daemon into an mfdata plugin avoids nominal stop of plugin step with SIGTERM #1599

Open
matthieumarrast opened this issue Jun 21, 2023 · 0 comments

Comments

@matthieumarrast
Copy link
Contributor

  1. Switch to mfdata and start it.
su - mfdata
mfdata.start
  1. Make a test plugin with command: bootstrap_plugin.py create test --no-input
    cd test

  2. Update plugin's config.ini by adding an extra_daemon:

[extra_daemon_test]
_cmd_and_args = ./test.sh
numprocesses=1
graceful_timeout = 30
rlimit_as = 1000000000
rlimit_nofile = 1000
rlimit_stack = 10000000
rlimit_fsize = 100000000
log_split_stdout_stderr=AUTO
log_split_multiple_workers=AUTO
max_age=0
  1. Add an executable script test.sh in plugin's dir:
#!/bin/bash
wait_100s () {
    i=1
    while [ $i -le 100 ]
    do
        echo $i
        sleep 1
        i=$((i+1))
    done
}

cleanup() {
    echo "Signal SIGTERM received..."
    echo "Waiting (100s) more than graceful timeout (60s)"
    wait_100s
    echo "End of sleep after SIGTERM"
    exit 0
}

trap cleanup SIGTERM

echo "-----------------"
echo "start test script"
wait_100s
echo "end test script"
exit 0

chmod +x test.sh

  1. Install plugin with make develop
    (step and extra_daemon will be launched by circus worker)

  2. Try to stop plugin (with command mfdata.stop or plugins.stop never mind):
    plugins.stop test

[mfdata:~/test] $ plugins.stop test
- Collecting infos about plugins...                        [ OK ]              
- Scheduling stop of plugin: test
    - Scheduling stop of extra.test.test                   [ OK ]  
    - Scheduling stop of step.test.main                    [ ERROR ]    (???)
- Waiting for stop of plugin: test
    - Waiting for stop of extra.test.test...               [ OK ]    (it will be 'OK' after 30 seconds)
    - Waiting for stop of step.test.main...                [ RUNNING] 00:09:59

=> BUG: scheduling of the step ends with error and stop is waiting for 10 minutes, as per step timeout settings (600s)
=> if no extra daemon defined step is stopped immediately, without errors -> OK
=> if extra_daemon does not stop after SIGTERM it well waits for 60 seconds before stopping (SIGKILL) -> OK
=> note: command circustl stop step.test.main does not raise any problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant