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

Refine service to restart SRS for systemd #2552

Closed
wants to merge 1 commit into from
Closed

Refine service to restart SRS for systemd #2552

wants to merge 1 commit into from

Conversation

mawenwu1983
Copy link

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Aug 24, 2021

Codecov Report

Merging #2552 (c7ac1db) into 4.0release (0859fb5) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           4.0release    #2552   +/-   ##
===========================================
  Coverage       59.33%   59.33%           
===========================================
  Files             122      122           
  Lines           51556    51556           
===========================================
  Hits            30592    30592           
  Misses          20964    20964           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data'

Translated to English:

Δ = absolute <relative> (impact), ø = not affected, ? = missing data'
Powered by Codecov. Last update 0859fb5...c7ac1db. Read the comment docs.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Aug 26, 2021

This is restarting the SRS service after SRS exits? I looked at this article, do we need to set RestartSec? I see it is set to the default 100ms.

https://unix.stackexchange.com/a/324297

I would like to extend Rahul's answer a bit.

systemd tries to restart multiple times (StartLimitBurst) and stops trying if the attempt count is reached within StartLimitIntervalSec. Both options belong to the [unit] section.

The default delay between executions is 100ms (RestartSec) which causes the rate limit to be reached very fast.

systemd won't attempt any more automatic restarts ever for units with Restart policy defined:

Note that units which are configured for Restart= and which reach the start limit are not attempted to be restarted anymore; however, they may still be restarted manually at a later point, from which point on, the restart logic is again activated.

Rahul's answer helps, because the longer delay prevents reaching the error counter within the StartLimitIntervalSec time. The correct answer is to set both RestartSec and StartLimitBurst to reasonable values though.

TRANS_BY_GPT3

@winlinvip winlinvip changed the title fix systemd daemon Refine service to restart SRS for systemd Aug 26, 2021
@winlinvip winlinvip self-assigned this Aug 26, 2021
@winlinvip winlinvip added this to the SRS 4.0 release milestone Aug 27, 2021
@mawenwu1983
Copy link
Author

mawenwu1983 commented Aug 27, 2021

Recently, the project used SRS. My colleague encountered a problem where SRS would suddenly stop when testing the push-pull stream (no error logs, the process just disappeared, and a coredump file was generated). My colleague couldn't access SRS, so they contacted me and I found out that SRS had already stopped.

The solution I used was to add the "Restart=always" field in the srs.service file. If SRS crashes, the daemon process can immediately restart.

I didn't use RestartSec because I wanted SRS to start immediately and provide services.

After adding Restart=always in the test, when manually killing the SRS process, systemd will automatically restart SRS. Currently, this can solve the problem with the daemon process.

The downside is that for earlier distributions without systemd, such as CentOS 6 and Ubuntu 14, this file has no effect and the srs script under init.d needs to be rewritten.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

Merged as 54b706d

Thanks a lot 👍 @mawenwu1983

@winlinvip winlinvip closed this Oct 30, 2021
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants