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.69k stars 5.38k forks source link

webrtc push-pull stream repeated multiple times, failed to pull stream error code 4042 #2862

Open cppmediaman opened 2 years ago

cppmediaman commented 2 years ago

Note: Before asking a question, please read the FAQ (Please read FAQ before filing an issue) https://github.com/ossrs/srs/issues/2716

Description

Please describe your issue here

  1. SRS version: 4.0.205

  2. SRS log:

[2021-12-31 14:16:36.577][Trace][17891][6e82z09d] RTC: Server conns=1, rpkts=(1,rtp:0,stun:1,rtcp:0), spkts=(1,rtp:0,stun:1,rtcp:0), snk=(24,a:12,v:12,h:0), fid=(id:1,fid:1,ffid:0,addr:1,faddr:1)
[2021-12-31 14:16:39.930][Trace][17891][395j48v0] -> PLA time=1019408859, msgs=9, okbps=2179,3310,2317, ikbps=0,0,0, mw=350/8
[2021-12-31 14:16:40.697][Trace][17891][6d5481r9] <- CPB time=425024871, okbps=0,0,0, ikbps=3544,4696,3122, mr=0/350, p1stpt=20000, pnt=5000
[2021-12-31 14:16:41.578][Trace][17891][6e82z09d] Hybrid cpu=1.00%,43MB, cid=3,1, timer=62,7,35, clock=0,46,2,0,0,0,0,0,0, free=1, objs=(pkt:707,raw:4,fua:703,msg:834,oth:0,buf:0)
[2021-12-31 14:16:41.578][Trace][17891][6e82z09d] RTC: Server conns=1, rpkts=(1,rtp:0,stun:1,rtcp:0), spkts=(1,rtp:0,stun:1,rtcp:0), snk=(24,a:12,v:12,h:0), fid=(id:1,fid:1,ffid:0,addr:1,faddr:1)
[2021-12-31 14:16:44.249][Trace][17891][08huq3gj] TCP: before dispose resource(HttpsConn)(0x34c7210), conns=5, zombies=0, ign=0, inz=0, ind=0
[2021-12-31 14:16:44.250][Error][17891][08huq3gj][0] serve error code=4042 : start : handshake : handshake r0=-1, r1=1
thread [17891][08huq3gj]: do_cycle() [src/app/srs_app_http_conn.cpp:153][errno=0]
thread [17891][08huq3gj]: on_start() [src/app/srs_app_http_api.cpp:1106][errno=0]
thread [17891][08huq3gj]: handshake() [src/app/srs_app_conn.cpp:667][errno=0]
[2021-12-31 14:16:44.250][Trace][17891][e1e09498] TCP: clear zombies=1 resources, conns=5, removing=0, unsubs=0
[2021-12-31 14:16:44.250][Trace][17891][08huq3gj] TCP: disposing #0 resource(HttpsConn)(0x34c7210), conns=5, disposing=1, zombies=0
[2021-12-31 14:16:46.578][Trace][17891][6e82z09d] Hybrid cpu=3.99%,43MB, cid=3,1, timer=62,7,35, clock=0,46,2,0,0,0,0,0,0, free=1, objs=(pkt:707,raw:4,fua:703,msg:834,oth:0,buf:0)
[2021-12-31 14:16:46.578][Trace][17891][6e82z09d] RTC: Server conns=1, rpkts=(1,rtp:0,stun:1,rtcp:0), spkts=(1,rtp:0,stun:1,rtcp:0), snk=(24,a:12,v:12,h:0), fid=(id:1,fid:1,ffid:0,addr:1,faddr:1)
  1. SRS configuration:
# main config for srs.
# @see full.conf for detail config.

listen              1935;
max_connections     1000;
#srs_log_tank        file;
#srs_log_file        ./objs/srs.log;
daemon              on;
http_api {
    enabled         on;
    listen          1985;
    https {
        enabled on;
        listen 1988;
        key /opt/key/xidingcloud_key_file.key;
        cert /opt/key/xidingcloud_cert_file.crt;
    }
}
http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
    https {
        enabled on;
        listen  8088;
        key /opt/key/xidingcloud_key_file.key;
        cert /opt/key/xidingcloud_cert_file.crt;
    }
}
rtc_server {
    enabled on;
    listen 8000; # UDP port
    # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate
    #candidate $CANDIDATE;
    candidate *;
}
vhost __defaultVhost__ {
    hls {
        enabled         on;
    }
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
    rtc {
        enabled     on;
        # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtmp-to-rtc
        rtmp_to_rtc on;
        # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtc-to-rtmp
        rtc_to_rtmp off;
    }
    dvr {
        enabled      on;
        dvr_path     ./objs/nginx/html/[app]/[stream].[timestamp].mp4;
        dvr_plan     session;
    }
}

Replay

How to replay bug?

  1. webrtc streaming
  2. webrtc playback
  3. Repeat the above two steps multiple times

Expected Behavior

Expected Behavior

Describe your expectation Multiple successful WebRTC streaming and playback without any failures occurring.

TRANS_BY_GPT3

phusinh commented 2 years ago

Do you know how to configure webrtc through the quic can you guide me?

winlinvip commented 2 years ago

Repeated multiple times, is the interval between pushing and pulling streams very short? After a pull stream fails, does the retry recover?

TRANS_BY_GPT3

cppmediaman commented 2 years ago

On average, there is a push-pull stream every minute, with around 40 channels each time. With this testing method repeated 30 times, there will be more than ten failures, resulting in an error rate of 0.7% to 0.9%.

TRANS_BY_GPT3

winlinvip commented 2 years ago

The frequency is not high, there will be no critical condition.

Can it be recovered by retrying after failure?

This needs to be thoroughly investigated to know.

TRANS_BY_GPT3

zsinba commented 2 years ago

+1

RussellXY commented 2 years ago

+1