Prevent race condition on supervisorctl reload #2343
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When setting
SUPERVISOR_LOGLEVEL
e.g. toinfo
, supervisord will be restarted (don't get fooled by the term 'reload'):docker-mailserver/target/scripts/startup/setup-stack.sh
Lines 12 to 23 in 701037d
The restart however, can take some time. While this time period,
start-mailserver.sh
continues to run until terminated by supervisord. This can lead to errors, if files are modified (by our numerous sed-operations).When supervisord is completely restarted, also
start-mailserver.sh
is started again. Files that already have been modified by the first run, will now be reported as errors.This is how a problematic log looks like (empty lines added for readability):
1st part:
start-mailserver.sh
is running and restarts supervisord2nd part:
start-mailserver.sh
keeps running for a bit3rd/4th part:
start-mailserver.sh
started again (see the 'Welcome to docker-mailserver 10.4.0' message). Notice the sed errors, because sed was run a second time.To prevent this,
start-mailserver.sh
should exit after callingsupervisorctl reload
.After applying this fix, the log looks like this:
Fixes #
Type of change
Checklist:
docs/
)