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

[bug] The agent may be stopped and started while the configuration is applied #172

Open
nemesifier opened this issue Apr 25, 2022 · 0 comments
Labels

Comments

@nemesifier
Copy link
Member

nemesifier commented Apr 25, 2022

In some cases it may happen that the agent is stopped and started again while the configuration is being applied.

If this happens, the configuration or config status of the device may remain in an inconsistent state (either the configuration may not be fully applied or it may not report that it has been applied to the OpenWISP server).

I am not able to replicate right now the steps which cause the agent to stop and start itself automatically.

Something like this was happening for the "reload" which we are already handling.

If we can confirm this issue, we could introduce a mechanism which delays the stop of the agent until the configuration has been applied, like we are doing in the reload:

reload_service() {
logger -s "$PROG_NAME received reload trigger" -t openwisp -p daemon.info
# avoid reloading while configuration is being applied
# will wait for a maximum of 30 seconds
for _ in $(seq 1 30); do
if [ -f "$CONTROL_FILE" ]; then
sleep 1
else
break
fi
done
rm -f "$CONTROL_FILE"
start
}

We can turn that code into a function and reuse in stop_service too.

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

No branches or pull requests

1 participant