-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Gracefully quit does not work for SRS 5.0 #3805
Comments
Right now, only SrsServer can receive the 'sigquit' message from the signal manager. RtcServer doesn't have this feature, so when we send SIGQUIT to SRS, only the services in srsServer can be stopped. The UDP servers in rtcServer don't stop. So, new webrtc stream requests for 'stun' still go to the old process.
|
I guess SRT and GB haven't implemented this Graceful QUIT feature yet.
|
It's not easy to implement Gracefully Quit in the UDP protocol because UDP doesn't have a state. Also, the whole WebRTC system reuses UDP ports. Right now, it seems to be reusing FD, so it needs special handling. As for SRT, its UDP is managed by the underlying library. To implement it, we might need to take a closer look at how the underlying system works.
|
Just to add: You don't really need to worry about WebRTC's UDP. All you need to do is turn off the HTTP API, and it will be supported by default. This is because the main point of Gracefully Quit is to stop accepting new connections and then force an exit after a certain period of time. SRT might be a bit more challenging because its new connections are also on UDP. Currently, GB only supports TCP, so you can just close the Listener.
|
To gracefully shut down SRT, you just need to close the listener.
|
I have test this patch. TCP seems work well. |
A relatively straightforward implementation would be that upon receiving a kill signal, both UDP and TCP cease to listen, and the program initiates an actual exit through another signal. The practical steps are as follows:
|
This mechanism has issues that need to be examined when time permits. It would be even better if you could submit a pull request to resolve them.
|
I will work on this and try to open a PR soon. Thanks for providing this good-first-issue. |
Description
Please description your issue here
Replay
Please describe how to replay the bug?
Step 1: Run SRS
Step 2: Publish a stream by FFmpeg
Step 3: Gracefully quit SRS
Expect
SRS should ideally wait for the RTMP connection to close or time out before quitting. However, it seems that SRS quits right away without waiting for the connection to close.
Solution
See https://gitee.com/ossrs/srs/pulls/2/files
The text was updated successfully, but these errors were encountered: