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
improvement: get rid of subshell + exec
in helper-functions.sh
#2401
Conversation
The new way of executing `sha512sum` should work as well as the old way but without the clutter and possible problems the usage of subshells + exec incurs. Moreover, there was a misconception about array expansion. Using `""` around an expanding array (`${ARRAY[@]}`) is quite fine (and actually the preffered way), not because it makes the expansion _one_ string (this would be `${ARRAY[*]}`), but it makes sure when elements are expanded, each element has `""` around them so to speak, i.e. there is no re-splitting of these elements.
When this is merged, #2398 can possibly be closed. |
Alright, we have one failing check (which is related as well): not ok 10 checking changedetector: can detect changes & between two containers using same config in 15732ms
# (from function `assert_output' in file test/test_helper/bats-assert/src/assert.bash, line 231,
# in test file test/mail_changedetector.bats, line 58)
# `assert_output --partial "postfix: stopped"' failed
#
# -- output does not contain substring --
# substring (1 lines):
# postfix: stopped
# output (12 lines):
# [[ TASKS ]] 2022-02-08 12:06:26 Start check-for-changes script.
# [[ INF ]] 2022-02-08 12:06:26 Using postmaster address postmaster@my-domain.com
# [[ INF ]] 2022-02-08 12:06:37 check-for-changes is ready
# [[ INF ]] 2022-02-08 12:06:37 Change detected
# [ WARNING ] Lock file /tmp/docker-mailserver/check-for-changes.sh.lock exists. Another check-for-changes.sh execution is happening. Trying again shortly...
# [[ INF ]] Checking file line endings
# [[ INF ]] Regenerating postfix user list
# [[ INF ]] Creating user 'user1' for domain 'localhost.localdomain'
# [[ INF ]] Creating user 'user2' for domain 'otherdomain.tld'
# [[ INF ]] Creating user 'user3' for domain 'localhost.localdomain' with attributes 'userdb_mail=mbox:~/mail:INBOX=~/inbox'
# [[ INF ]] Adding regexp alias file postfix-regexp.cf
# [[ INF ]] Configuring root alias
# --
# To me, it seems as if the restart of Postfix is about to happen because we see that the script says: |
Yes, just tested it - increasing the timeout (by a mere 10s) does the job. I think this is absolutely fine. I will push a fix, and increase the whole script |
0dade9a
Something to consider: sleep values are dependent on a certain state. If heavy load is happening, are these sleep values valid? It's typically much better to check for some sort of state instead of relying on sleep. Especially when you find yourself increasing or decreasing sleep values. |
You're very right. We should consider removing sleeps as much as possible, but I have to admit, my main focus was on removing the |
I will leave this open overnight in case @polarathene has something to add here. If you don't, by all accounts, go ahead and merge this PR @polarathene :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Thanks for the improvement and cleanup!
Due to the changes in #2401 and the chages introduced here, `check-for-changes.sh` needs just a little bit longer.
Description
The new way of executing
sha512sum
should work as well as the old waybut without the clutter and possible problems the usage of subshells +
exec incurs.
Moreover, there was a misconception about array expansion. Using
""
around an expanding array (
${ARRAY[@]}
) is quite fine (and actuallythe preffered way), not because it makes the expansion one string
(this would be
${ARRAY[*]}
), but it makes sure when elements areexpanded, each element has
""
around them so to speak, i.e. there isno re-splitting of these elements.
This PR is trying to a be step in uncluttering the changedetector process to find out what is causing the resource leak described in #2348.
Type of change
Checklist:
docs/
)