ossrs / srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
25.46k stars 5.35k forks source link

SRS integrates with the HLS slicing management system through HTTP Callback, encountering an error on_hls. #2427

Closed NangenX closed 3 years ago

NangenX commented 3 years ago

Description The company has developed a playback system that reads the on_hls sent by the HTTP Callback of the SRS. When the slicing system receives the Post information, it will download the slicing information sent by on_hls.

> Description of the issue encountered After a period of time, SRS throws an error and the HLS slicing management system is unable to download the slices from on_hls. The download prompts a 404 error.

SRS Version: Docker Version: ossrs/srs:v4.0.117

SRS Log:

[2021-06-21 21:00:30.945][Warn][1][2u5u5jq0][62] ignore task failed code=1011 : callback on_hls http://192.168.2.136:5000/api/srs/on_hls : http: post http://192.168.2.136:5000/api/srs/on_hls with {"action":"on_hls","client_id":"2u5u5jq0","ip":"192.168.2.138","vhost":"defaultVhost","app":"live/cctv10","stream":"1080p/index","param":"","duration":5.98,"cwd":"/usr/local/srs","file":"./objs/nginx/html/live/cctv10/1080p/index-1624309194955-11156.ts","url":"live/cctv10/1080p/index-1624309194955-11156.ts","m3u8":"./objs/nginx/html/live/cctv10/1080p/index.m3u8","m3u8_url":"live/cctv10/1080p/index.m3u8","seq_no":11156}, status=0, res= : http: client post : http: parse response : parse message : grow buffer : read bytes : timeout 30000 ms thread [1][2u5u5jq0]: call() [src/app/srs_app_hls.cpp:128][errno=62] thread [1][2u5u5jq0]: on_hls() [src/app/srs_app_http_hooks.cpp:341][errno=62] thread [1][2u5u5jq0]: do_post() [src/app/srs_app_http_hooks.cpp:492][errno=62] thread [1][2u5u5jq0]: post() [src/protocol/srs_service_http_client.cpp:362][errno=62] thread [1][2u5u5jq0]: parse_message() [src/protocol/srs_service_http_conn.cpp:115][errno=62] thread [1][2u5u5jq0]: parse_message_imp() [src/protocol/srs_service_http_conn.cpp:177][errno=62] thread [1][2u5u5jq0]: grow() [src/protocol/srs_protocol_stream.cpp:179][errno=62] thread [1][2u5u5jq0]: read() [src/protocol/srs_service_st.cpp:517][errno=62] [2021-06-21 21:00:30.946][Warn][1][22x2rr3e][62] ignore task failed code=1011 : callback on_hls http://192.168.2.136:5000/api/srs/on_hls : http: post http://192.168.2.136:5000/api/srs/on_hls with {"action":"on_hls","client_id":"22x2rr3e","ip":"192.168.2.138","vhost":"defaultVhost","app":"live/cctv10","stream":"480p/index","param":"","duration":5.98,"cwd":"/usr/local/srs","file":"./objs/nginx/html/live/cctv10/480p/index-1624309194918-11156.ts","url":"live/cctv10/480p/index-1624309194918-11156.ts","m3u8":"./objs/nginx/html/live/cctv10/480p/index.m3u8","m3u8_url":"live/cctv10/480p/index.m3u8","seq_no":11156}, status=0, res= : http: client post : http: parse response : parse message : grow buffer : read bytes : timeout 30000 ms thread [1][22x2rr3e]: call() [src/app/srs_app_hls.cpp:128][errno=62] thread [1][22x2rr3e]: on_hls() [src/app/srs_app_http_hooks.cpp:341][errno=62] thread [1][22x2rr3e]: do_post() [src/app/srs_app_http_hooks.cpp:492][errno=62] thread [1][22x2rr3e]: post() [src/protocol/srs_service_http_client.cpp:362][errno=62] thread [1][22x2rr3e]: parse_message() [src/protocol/srs_service_http_conn.cpp:115][errno=62] thread [1][22x2rr3e]: parse_message_imp() [src/protocol/srs_service_http_conn.cpp:177][errno=62] thread [1][22x2rr3e]: grow() [src/protocol/srs_protocol_stream.cpp:179][errno=62] thread [1][22x2rr3e]: read() [src/protocol/srs_service_st.cpp:517][errno=62] [2021-06-21 21:00:30.946][Warn][1][032792d8][62] ignore task failed code=1011 : callback on_hls http://192.168.2.136:5000/api/srs/on_hls : http: post http://192.168.2.136:5000/api/srs/on_hls with {"action":"on_hls","client_id":"032792d8","ip":"192.168.2.138","vhost":"defaultVhost","app":"live/cctv2","stream":"480p/index","param":"","duration":5.98,"cwd":"/usr/local/srs","file":"./objs/nginx/html/live/cctv2/480p/index-1624309194948-11156.ts","url":"live/cctv2/480p/index-1624309194948-11156.ts","m3u8":"./objs/nginx/html/live/cctv2/480p/index.m3u8","m3u8_url":"live/cctv2/480p/index.m3u8","seq_no":11156}, status=200, res= : http: client post : http: parse response : parse message : grow buffer : read bytes : timeout 30000 ms thread [1][032792d8]: call() [src/app/srs_app_hls.cpp:128][errno=62] thread [1][032792d8]: on_hls() [src/app/srs_app_http_hooks.cpp:341][errno=62] thread [1][032792d8]: do_post() [src/app/srs_app_http_hooks.cpp:492][errno=62] thread [1][032792d8]: post() [src/protocol/srs_service_http_client.cpp:362][errno=62] thread [1][032792d8]: parse_message() [src/protocol/srs_service_http_conn.cpp:115][errno=62] thread [1][032792d8]: parse_message_imp() [src/protocol/srs_service_http_conn.cpp:177][errno=62] thread [1][032792d8]: grow() [src/protocol/srs_protocol_stream.cpp:179][errno=62] thread [1][032792d8]: read() [src/protocol/srs_service_st.cpp:517][errno=62]

HLS Slice Management Error Log: Time: 2021-06-22 05:03:04,807 Description: [06-22 05:03:04.807] Failed to download file, re-added to the queue for the 1st time. Time: 2021-06-22 05:03:04,807 Description: [06-22 05:03:04.807] Remote file: http://192.168.2.120/live/cctv1/360p/index-1624309234829-11161.ts Time: 2021-06-22 05:03:04,807 Description: [06-22 05:03:04.807] Storage path: D:\inetpub\wwwroot\Ott.FileSync\streams\replays\cctv1\360p\2021_06_22\05\index-1624309234829-11161.ts Time: 2021-06-22 05:03:04,807 Description: [06-22 05:03:04.807] Error message: The remote server returned an error: (404) Not Found. Time: 2021-06-22 05:03:05,945 Description: [06-22 05:03:05.945] Redis Pipeline dump successful. Time: 2021-06-22 05:03:12,485 Description: [06-22 05:03:12.485] Failed to download file, re-added to the queue for the 1st time. Time: 2021-06-22 05:03:12,485 Description: [06-22 05:03:12.485] Remote file: http://192.168.2.120/live/cctv2/720p/index-1624309238278-11163.ts Time: 2021-06-22 05:03:12,485 Description: [06-22 05:03:12.485] Storage path: D:\inetpub\wwwroot\Ott.FileSync\streams\replays\cctv2\720p\2021_06_22\05\index-1624309238278-11163.ts Time: 2021-06-22 05:03:12,485 Description: [06-22 05:03:12.485] Error message: The remote server returned an error: (404) Not Found. Time: 2021-06-22 05:03:12,486 Description: [06-22 05:03:12.486] Failed to download file, re-added to the queue for the 1st time. Time: 2021-06-22 05:03:12,486 Description: [06-22 05:03:12.486] Failed to download file, re-added to the queue for the 1st time. Time: 2021-06-22 05:03:12,486 Description: [06-22 05:03:12.486] Failed to download file, re-added to the queue for the 1st time. Time: 2021-06-22 05:03:12,486 Description: [06-22 05:03:12.486] Remote file: http://192.168.2.120/live/cctv1/480p/index-1624309238274-11163.ts Time: 2021-06-22 05:03:12,486 Description: [06-22 05:03:12.486] Remote file: http://192.168.2.120/live/cctv4/720p/index-1624309238285-11163.ts Time: 2021-06-22 05:03:12,486 Description: [06-22 05:03:12.486] Remote file: http://192.168.2.120/live/cctv8/1080p/index-1624309238296-11163.ts Time: 2021-06-22 05:03:12,486 Description: [06-22 05:03:12.486] Storage path: D:\inetpub\wwwroot\Ott.FileSync\streams\replays\cctv1\480p\2021_06_22\05\index-1624309238274-11163.ts Time: 2021-06-22 05:03:12,486 Description: [06-22 05:03:12.486] Storage path: D:\inetpub\wwwroot\Ott.FileSync\streams\replays\cctv4\720p\2021_06_22\05\index-1624309238285-11163.ts Time: 2021-06-22 05:03:12,486 Description: [06-22 05:03:12.486] Storage path: D:\inetpub\wwwroot\Ott.FileSync\streams\replays\cctv8\1080p\2021_06_22\05\index-1624309238296-11163.ts Time: 2021-06-22 05:03:12,486 Description: [06-22 05:03:12.486] Error message: The remote server returned an error: (404) Not Found. Time: 2021-06-22 05:03:12,486 Description: [06-22 05:03:12.486] Error message: The remote server returned an error: (404) Not Found. Time: 2021-06-22 05:03:12,487 Description: [06-22 05:03:12.487] Error message: The remote server returned an error: (404) Not Found.

HLS Slice Management QPS Log: Time: 2021-06-22 05:03:04,799 Description: Received SRS Callback request: {"ip":"192.168.2.138","duration":5.99,"url":"live/cctv1/360p/index-1624309234829-11161.ts","seq_no":11161,"createTime":"2021-06-21 21:03:04","finishTime":"0001-01-01 00:00:00","removeFileUrl":"http://192.168.2.138/live/cctv1/360p/index-1624309234829-11161.ts","channel":"cctv1","rate":"360p","fileName":"index-1624309234829-11161.ts"}

SRS Configuration (Config):


isten               1935;
max_connections      1000;
srs_log_tank         file;
srs_log_level        verbose;
#http_server {
#                     enabled       on;
#                     listen        80;
#                     dir           ./objs/nginx/html;
#            }
vhost __defaultVhost__ {
hls {
                     enabled       on;
                     hls_path      ./objs/nginx/html;
                     hls_ts_file     [app]/[stream]-[timestamp]-[seq].ts;
                     hls_fragment  5;
                     hls_window    30;
                     hls_cleanup     off;
                     #hls_dispose     10;
    }
http_hooks {
                    enabled         on;
                    on_hls          http://192.168.2.136:5000/api/srs/on_hls;
}

**Replay**

**Every day at 5 o'clock, this phenomenon is guaranteed to replay, while at other random time periods, this issue may occur.**

**Expected Behavior (Expect)**

I would like to understand under what circumstances the above error situation may occur with SRS's `on_hls`. Thank you.

`TRANS_BY_GPT3`
winlinvip commented 3 years ago

Turn off HLS slice cleaning and manage the slice files yourself.

TRANS_BY_GPT3