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

After the HLS streaming stops, the number of online clients slowly decreases and takes a long time to reach 0. #3009

Closed
lbli opened this issue Apr 15, 2022 · 2 comments
Assignees
Labels
TransByAI Translated by AI/GPT. Won't fix We won't fix it.
Milestone

Comments

@lbli
Copy link

lbli commented Apr 15, 2022

Note: Before asking a question, please read the FAQ (Please read FAQ before filing an issue) #2716

Description
After stopping the HLS streaming, the number of online clients decreases slowly and takes a long time to reach 0.

Please description your issue here
I am using srs-bench for load testing. When pulling streams using http-flv with sb_http_load for 1000 streams, after stopping the streams, the number of clients instantly decreases to 0 when using the /api/v1/clients?start=0&count=10000 API to get the client count. However, when pulling streams using hls with sb_hls_load for 1000 streams, after stopping the streams, it takes a long time for the client count to decrease to 0 when using the /api/v1/clients?start=0&count=10000 API.

SRS Version: xxxxxx
4.0.199

SRS Configuration:

vhost defaultVhost {
tcp_nodelay on;
min_latency on;
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
hls {
enabled on;
hls_path ./objs/nginx/html/raw;
hls_fragment 10;
hls_window 60;
hls_dispose 30;
hls_wait_keyframe on;
hls_m3u8_file [app]/[stream].m3u8;
hls_ts_file [app]/[stream]-[seq].ts;
hls_cleanup on;
}
publish {
mr off;
firstpkt_timeout 20000;
normal_timeout 7000;
}
play {
mw_latency 100;
gop_cache on;
queue_length 10;
}
http_hooks {
enabled off;
}

Steps to Reproduce the Bug:

Step 1: Start OBS streaming. rtmp://172.24.0.75:1935/live/livestream
Step 2: Start HTTP-FLV playback: ./objs/sb_http_load -c 1000 -r http://172.24.0.75:9080/live/livestream.flv. Retrieve client information through /api/v1/clients?start=0&count=10000.
Step 3: Start HLS playback: ./objs/sb_hls_load -c 1000 -r http://172.24.0.75:9080/raw/live/livestream.m3u8. Retrieve client information through /api/v1/clients?start=0&count=10000.

Comparison of the time it takes for the client information to decrease to 0 between Step 2 and Step 3.

Expected Behavior (Expect)

After stopping the streaming, HLS streaming should be able to reflect the client information in real-time.

Description of your expectation

Please describe what you expect to happen.

TRANS_BY_GPT3

@lbli
Copy link
Author

lbli commented Apr 15, 2022

#2578 Enhance HLS: support http callback on_play/stop, support statistic #2578
I have reviewed the existing code and incorporated the modifications mentioned above for HLS. I have also verified it with the latest code, but the aforementioned issues still persist.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Apr 29, 2022

This is not a problem, but a characteristic of HLS, which can only be counted when relying on timeouts.

For example, if HLS has a segment every 10 seconds, the client may only request the server every 10 seconds. If there is no request within 10 seconds, it cannot be assumed that the client is no longer active. Instead, it is still alive until a certain timeout period.

So, when you see the number of connections slowly decreasing, it is because the server still considers these clients to be active. This is a characteristic of the segment protocol. Unlike RTMP or FLV streaming protocols, where the server immediately knows when a client disconnects.

TRANS_BY_GPT3

@winlinvip winlinvip self-assigned this Apr 29, 2022
@winlinvip winlinvip added the Won't fix We won't fix it. label Apr 29, 2022
@winlinvip winlinvip added this to the 4.0 milestone Apr 29, 2022
@winlinvip winlinvip changed the title hls拉流停止拉流后,在线客户端数缓慢减少,很久才减到0 After the HLS streaming stops, the number of online clients slowly decreases and takes a long time to reach 0. Jul 29, 2023
@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. Won't fix We won't fix it.
Projects
None yet
Development

No branches or pull requests

2 participants