Skip to content

fix: postsrsd restart loop#3160

Merged
casperklein merged 6 commits intodocker-mailserver:masterfrom
casperklein:fix-srs-restart-loop
Mar 12, 2023
Merged

fix: postsrsd restart loop#3160
casperklein merged 6 commits intodocker-mailserver:masterfrom
casperklein:fix-srs-restart-loop

Conversation

@casperklein
Copy link
Copy Markdown
Member

@casperklein casperklein commented Mar 5, 2023

Description

Fixes #3128 (comment)

Can be tested with:

docker build -t test .
docker run --rm -it --hostname example.test --env SMTP_ONLY=1 --env ENABLE_SRS=1  --env SUPERVISOR_LOGLEVEL=info test

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (non-breaking change that does improve existing functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md or the documentation under docs/)
  • If necessary I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@casperklein casperklein marked this pull request as ready for review March 5, 2023 23:12
@georglauterbach
Copy link
Copy Markdown
Member

I had really hoped not to see the return of wrappers 🤢 but it may currently be our only option..

@georglauterbach georglauterbach changed the title Fix postsrsd restart loop fix: postsrsd restart loop Mar 6, 2023
@casperklein
Copy link
Copy Markdown
Member Author

Yes, unless someone comes up with a proper solution to run in foreground, this is the only way.

@casperklein casperklein enabled auto-merge (squash) March 6, 2023 11:34
Comment thread target/scripts/wrapper/postsrsd.sh Outdated
@georglauterbach georglauterbach disabled auto-merge March 6, 2023 13:15
georglauterbach
georglauterbach previously approved these changes Mar 6, 2023
Copy link
Copy Markdown
Member

@georglauterbach georglauterbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@polarathene merge this when you're fine with the changes as well :)

@polarathene
Copy link
Copy Markdown
Member

I will review in approx 12 hours.

I found out why I could not reproduce the problem on my system... My current install has a different docker.service config for LimitNOFILE=infinity, causing that ulimit problem with container having over a billion FDs to close.

It appeared like postsrsd was running to me, but it was stalling for 8 minutes to startup as it iterated through all those syscalls 😅 So now I can reproduce 👍

@georglauterbach
Copy link
Copy Markdown
Member

@polarathene I think this PR as absolutely fine to merge even without your review, so if you want to save some time, let us know :)

@polarathene
Copy link
Copy Markdown
Member

Sorry, went on a bit of a detour, I'll get back to this today 😅

@polarathene polarathene mentioned this pull request Mar 9, 2023
7 tasks
@polarathene
Copy link
Copy Markdown
Member

Yes, unless someone comes up with a proper solution to run in foreground, this is the only way.

Tada 🎉 #3128 (comment)

There isn't any tests in place that actually verify postsrsd is working, only config matches expectations, but I'm pretty sure that's working properly now.

What would you like to use?

stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
command=/etc/init.d/postsrsd start
command=/bin/bash -l -c /usr/local/bin/postsrsd.sh
Copy link
Copy Markdown
Member

@polarathene polarathene Mar 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
command=/bin/bash -l -c /usr/local/bin/postsrsd.sh
command=/bin/bash -c 'env $(grep -vE "^(#.*|\s*)$" /etc/default/postsrsd) postsrsd -e -p /var/run/postsrsd.pid'

@georglauterbach
Copy link
Copy Markdown
Member

Yes, unless someone comes up with a proper solution to run in foreground, this is the only way.

Tada 🎉 #3128 (comment)

What would you like to use?

Definitely your solution 🎉🚀

@casperklein
Copy link
Copy Markdown
Member Author

I can confirm this works 🚀

I noticed this difference between the old wrapper and your new foreground solution:

Old:

/usr/sbin/postsrsd -f 10001 -r 10002 -d example.test -s /etc/postsrsd.secret -a = -n 4 -N 4 -u postsrsd -p /var/run/postsrsd.pid -c /var/lib/postsrsd -l 127.0.0.1 -D -X

New:

postsrsd -e -p /var/run/postsrsd.pid

Can you confirm, that this does not introduce any regressions due to missing parameters? Are these all either default values or defined in /etc/default/postsrsd?

@polarathene
Copy link
Copy Markdown
Member

Can you confirm, that this does not introduce any regressions due to missing parameters? Are these all either default values or defined in /etc/default/postsrsd?

You only need to provide the domain and secret I think to run the command, the defaults are shown with the -h command flag and can be compared to the init script and config file we ship (slightly out of date from upstream and init script IIRC).

I provided captured snippets and relevant details for reference a while ago.

There's possibly something missing, I need to sleep but can double check tomorrow to confirm if parity is kept 👍

That said we may want to opt-out of the chroot (along with Dovecot) for v12?

@casperklein
Copy link
Copy Markdown
Member Author

There's possibly something missing, I need to sleep but can double check tomorrow to confirm if parity is kept 👍

👍

That said we may want to opt-out of the chroot (along with Dovecot) for v12?

I see no problem with that. But let's do it separated from this PR.

@polarathene
Copy link
Copy Markdown
Member

polarathene commented Mar 12, 2023

Yep all looks good 👍 (except we would now run in foreground instead of -D daemon mode)

postsrsd 1.x series will take either args to config, or with -e match these ENV, otherwise use the defaults listed via -h (which is the case for anything we don't provide).

I referenced the init script + -h output I shared earlier , the PostSRSd ENV config file we provide and PostSRSd official config (ours is slightly different, but aligns with the modifications Debian package already applies, ours just is outdated missing some added settings, but the defaults are the same).

I see no problem with that. But let's do it separated from this PR.

💯

Copy link
Copy Markdown
Member

@polarathene polarathene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@casperklein casperklein merged commit 6c97a50 into docker-mailserver:master Mar 12, 2023
@casperklein casperklein deleted the fix-srs-restart-loop branch March 12, 2023 23:44
@polarathene polarathene mentioned this pull request Mar 30, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants