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

nginx service improvements #5846

Merged
merged 1 commit into from
Mar 13, 2015
Merged

nginx service improvements #5846

merged 1 commit into from
Mar 13, 2015

Conversation

arno01
Copy link
Contributor

@arno01 arno01 commented Jan 19, 2015

To address #5832

Adding Restart, RestartSec, StartLimitInterval to ensure that the service
is started in case if it can't assign (bind) the address as often it takes longer
for the network (e.g. dhcpcd) to get the IP assigned.
@lucabrunox
Copy link
Contributor

Can we lower to 1sec? 10 sec is really too much in my opinion.

@arno01
Copy link
Contributor Author

arno01 commented Jan 19, 2015

@lethalman it's not good as it will throw start request repeated too quickly for nginx.service

see as below, just tried:

[root@www:~/nixpkgs]# journalctl -b  |grep -v 'rejected connection' |tail -500 |egrep "emerg|nginx.service"
Jan 19 16:51:15 www nginx[22347]: nginx: [emerg] unknown directive "blablabla" in /nix/store/hash-nginx.conf:24
Jan 19 16:51:15 www systemd[1]: nginx.service: main process exited, code=exited, status=1/FAILURE
Jan 19 16:51:15 www systemd[1]: Unit nginx.service entered failed state.
Jan 19 16:51:15 www systemd[1]: nginx.service failed.
Jan 19 16:51:16 www systemd[1]: nginx.service holdoff time over, scheduling restart.
Jan 19 16:51:16 www nginx[22366]: nginx: [emerg] unknown directive "blablabla" in /nix/store/hash-nginx.conf:24
Jan 19 16:51:16 www systemd[1]: nginx.service: main process exited, code=exited, status=1/FAILURE
Jan 19 16:51:16 www systemd[1]: Unit nginx.service entered failed state.
Jan 19 16:51:16 www systemd[1]: nginx.service failed.
Jan 19 16:51:17 www systemd[1]: nginx.service holdoff time over, scheduling restart.
Jan 19 16:51:17 www nginx[22376]: nginx: [emerg] unknown directive "blablabla" in /nix/store/hash-nginx.conf:24
Jan 19 16:51:17 www systemd[1]: nginx.service: main process exited, code=exited, status=1/FAILURE
Jan 19 16:51:17 www systemd[1]: Unit nginx.service entered failed state.
Jan 19 16:51:17 www systemd[1]: nginx.service failed.
Jan 19 16:51:19 www systemd[1]: nginx.service holdoff time over, scheduling restart.
Jan 19 16:51:19 www nginx[22384]: nginx: [emerg] unknown directive "blablabla" in /nix/store/hash-nginx.conf:24
Jan 19 16:51:19 www systemd[1]: nginx.service: main process exited, code=exited, status=1/FAILURE
Jan 19 16:51:19 www systemd[1]: Unit nginx.service entered failed state.
Jan 19 16:51:19 www systemd[1]: nginx.service failed.
Jan 19 16:51:20 www systemd[1]: nginx.service holdoff time over, scheduling restart.
Jan 19 16:51:20 www nginx[22392]: nginx: [emerg] unknown directive "blablabla" in /nix/store/hash-nginx.conf:24
Jan 19 16:51:20 www systemd[1]: nginx.service: main process exited, code=exited, status=1/FAILURE
Jan 19 16:51:20 www systemd[1]: Unit nginx.service entered failed state.
Jan 19 16:51:20 www systemd[1]: nginx.service failed.
Jan 19 16:51:21 www systemd[1]: nginx.service holdoff time over, scheduling restart.
Jan 19 16:51:21 www systemd[1]: start request repeated too quickly for nginx.service
Jan 19 16:51:21 www systemd[1]: Unit nginx.service entered failed state.
Jan 19 16:51:21 www systemd[1]: nginx.service failed.

5 times tried to restart and gave up with start request repeated too quickly for nginx.service

@arno01
Copy link
Contributor Author

arno01 commented Jan 19, 2015

Might be a good idea to add Use StartLimitBurst= to configure how many starts per interval are allowed
not sure what's the default value of it.

or keep it to at least 5s ..
actually the same should be done in the dovecot commit #5845 where you changed it to 1s

@lucabrunox
Copy link
Contributor

@arno01 we can think of it. It's certainly an improvement over the previous Restart=no default. It's so dependent on the target the system, that after all you can change those values. It's not that we can decide a good value for every system, as this is mainly an hack for a more graceful failure by default.

I have no strong opinion on this, except that 10s is too much.

@arno01
Copy link
Contributor Author

arno01 commented Jan 19, 2015

This delay 5s doesn't generate any friction, but only ensures that the service is started.
If it was anyway started from the first time, then it wasn't delayed at all as it is RestartSec parameter on-failure only.
So when something is wrong, it will give it 5s or 10s before retrying.. and this something is wrong might really need 5s as we know the dhcpd problem now #5832 (comment) ...

with 1s it will try just 4-5 times (takes only 5 seconds before systemd gaves up) which is not enough

@arno01
Copy link
Contributor Author

arno01 commented Jan 19, 2015

@lethalman okay then, 5s should be enough

@thoughtpolice thoughtpolice added 0.kind: enhancement Add something new 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS labels Jan 20, 2015
lucabrunox pushed a commit that referenced this pull request Mar 13, 2015
nginx service improvements
@lucabrunox lucabrunox merged commit f72d1ab into NixOS:master Mar 13, 2015
@lucabrunox
Copy link
Contributor

Merging this, I think it's a good to have default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: enhancement Add something new 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants