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

Redirected flow name duplicated in the origin server cluster #1575

Closed
springjk opened this issue Jan 13, 2020 · 4 comments
Closed

Redirected flow name duplicated in the origin server cluster #1575

springjk opened this issue Jan 13, 2020 · 4 comments
Assignees
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT.
Milestone

Comments

@springjk
Copy link

springjk commented Jan 13, 2020

Repeated redirection flow name in the origin server cluster

I configured origin server clusters A and B according to v3_CN_OriginCluster and the instructions in #464. When streaming to A, only the output of A can be played, but when pulling from B, the redirection returned includes the stream name one more time.

  • Operating environment: docker
  • SRS version: 3.0-a8

Replay

How to replay bug?

Steps to reproduce the bug

**Docker Configuration File** Docker configuration file
version: '2'
services:
  srs-origin-a:
    image: ossrs/srs:v3.0-a8
    ports:
      - "1935:1935"
      - "1985:1985"
    volumes:
      - ./conf/origin-a.conf:/usr/local/srs/conf/srs.conf
  srs-origin-b:
    image: ossrs/srs:v3.0-a8
    ports:
      - "1936:1936"
      - "1986:1986"
    volumes:
      - ./conf/origin-b.conf:/usr/local/srs/conf/srs.conf
origin-a.conf
listen              1935;
max_connections     3000;
srs_log_tank        console;
daemon              off;

http_api {
    enabled         on;
    listen          1985;
}


vhost __defaultVhost__ {

    cluster {
        mode                local;
        origin_cluster      on;
        coworkers           192.168.31.131:1986;
    }

}
origin-b.conf
listen              1936;
max_connections     3000;
srs_log_tank        console;
daemon              off;

http_api {
    enabled         on;
    listen          1986;
}


vhost __defaultVhost__ {

    cluster {
        mode                local;
        origin_cluster      on;
        coworkers           192.168.31.131:1985;
    }

}
  1. Create origin-a and origin-b and set them to cluster with each other by listening on the HTTP API port.
  2. Push the stream to origin-a.
  3. push rtmp://192.168.31.131/streams/123
  4. When playing with the port of origin-a, it works fine, but when using origin-b, it cannot play and returns a 302 error with the stream name repeated.
  5. ffplay rtmp://192.168.31.131:1935/streams/123 ok
  6. ffplay rtmp://192.168.31.131:1936/streams/123 get 302 to rtmp://192.168.31.131:1935/streams/123/123
  • Player console
VM527:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] player stopped
VM528:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] start to play url: rtmp://192.168.31.131:1936/streams/123, w=710, h=336, buffer=1.00s, max_buffer=3.00s, volume=1.00
VM529:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] player stopped
VM530:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] [STATUS] code=init, desc=Ready to play
VM532:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] NetConnection: type=netStatus, bub=false, can=false, info is description=Connection succeeded, level=status, data=, objectEncoding=3, code=NetConnection.Connect.Success, 
VM533:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] metadata is server=SRS/3.0.97(OuXuli) ip=172.28.0.2 pid=1 contributor=winlin cid=489 
VM535:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] user set dar to 0/0
VM536:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] user set refer to screen, percent to100
VM537:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] [STATUS] code=connected, desc=Connected at server
VM539:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] on timer, time=0.00s, buffer=0.00s, bitrate=0.0kbps, fps=0.0, rtime=315
VM541:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] NetStream: type=netStatus, bub=false, can=false, info is description=Playing and resetting stream., details=stream, level=status, clientid=ASAICiss, code=NetStream.Play.Reset, 
VM542:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] NetStream: type=netStatus, bub=false, can=false, info is description=Started playing stream., details=stream, level=status, clientid=ASAICiss, code=NetStream.Play.Start, 
VM543:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] [STATUS] code=play, desc=Start to play stream
VM545:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] NetConnection: type=netStatus, bub=false, can=false, info is description=RTMP 302 Redirect, ex=[object Object], level=error, code=NetConnection.Connect.Rejected, 
VM546:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] Async RTMP 302 Redirect to: rtmp://192.168.31.131:1935/streams/123/123
VM547:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] NetConnection: type=netStatus, bub=false, can=false, info is level=status, code=NetConnection.Connect.Closed, 
VM548:1 [Mon Jan 13 17:10:51 GMT+0800 2020][srs-player][107] [STATUS] code=closed, desc=Server closed.
VM550:1 [Mon Jan 13 17:10:52 GMT+0800 2020][srs-player][107] Async RTMP 302 Redirected.
VM551:1 [Mon Jan 13 17:10:52 GMT+0800 2020][srs-player][107] start to play url: rtmp://192.168.31.131:1935/streams/123/123, w=710, h=336, buffer=1.00s, max_buffer=3.00s, volume=1.00
VM552:1 [Mon Jan 13 17:10:52 GMT+0800 2020][srs-player][107] player stopped
VM553:1 [Mon Jan 13 17:10:52 GMT+0800 2020][srs-player][107] [STATUS] code=init, desc=Ready to play
VM555:1 [Mon Jan 13 17:10:52 GMT+0800 2020][srs-player][107] NetConnection: type=netStatus, bub=false, can=false, info is description=Connection succeeded, level=status, data=, objectEncoding=3, code=NetConnection.Connect.Success, 
VM556:1 [Mon Jan 13 17:10:52 GMT+0800 2020][srs-player][107] metadata is server=SRS/3.0.97(OuXuli) ip=172.28.0.3 pid=1 contributor=winlin cid=515 
VM558:1 [Mon Jan 13 17:10:52 GMT+0800 2020][srs-player][107] user set dar to 0/0
VM559:1 [Mon Jan 13 17:10:52 GMT+0800 2020][srs-player][107] user set refer to screen, percent to100
VM560:1 [Mon Jan 13 17:10:52 GMT+0800 2020][srs-player][107] [STATUS] code=connected, desc=Connected at server
VM562:1 [Mon Jan 13 17:10:52 GMT+0800 2020][srs-player][107] NetStream: type=netStatus, bub=false, can=false, info is description=Playing and resetting stream., details=stream, level=status, clientid=ASAICiss, code=NetStream.Play.Reset, 
VM563:1 [Mon Jan 13 17:10:52 GMT+0800 2020][srs-player][107] NetStream: type=netStatus, bub=false, can=false, info is description=Started playing stream., details=stream, level=status, clientid=ASAICiss, code=NetStream.Play.Start, 
VM564:1 [Mon Jan 13 17:10:52 GMT+0800 2020][srs-player][107] [STATUS] code=play, desc=Start to play stream
VM566:1 [Mon Jan 13 17:10:52 GMT+0800 2020][srs-player][107] NetConnection: type=netStatus, bub=false, can=false, info is level=status, code=NetConnection.Connect.Closed, 
VM567:1 [Mon Jan 13 17:10:52 GMT+0800 2020][srs-player][107] [STATUS] code=closed, desc=Server closed.
VM569:1 [Mon Jan 13 17:10:57 GMT+0800 2020][srs-player][107] player stopped
SRS Console Complete Information
Creating network "srs-test_default" with the default driver
Creating srs-test_srs-origin-b_1 ... done
Creating srs-test_srs-origin-a_1 ... done
Attaching to srs-test_srs-origin-b_1, srs-test_srs-origin-a_1
srs-origin-a_1  | [2020-01-13 09:09:56.052][Trace][1][0] XCORE-SRS/3.0.97(OuXuli)
srs-origin-a_1  | [2020-01-13 09:09:56.057][Trace][1][0] config parse complete
srs-origin-a_1  | [2020-01-13 09:09:56.057][Trace][1][0] write log to console
srs-origin-a_1  | [2020-01-13 09:09:56.057][Trace][1][0] SRS/3.0.97(OuXuli), The MIT License (MIT)
srs-origin-a_1  | [2020-01-13 09:09:56.057][Trace][1][0] contributors: winlin<winlin@vip.126.com> wenjie.zhao<740936897@qq.com> xiangcheng.liu<liuxc0116@foxmail.com> naijia.liu<youngcow@youngcow.net> alcoholyi<alcoholyi@qq.com> byteman<wangchen2011@gmail.com> chad.wang<chad.wang.cn@gmail.com> suhetao<suhetao@gmail.com> Johnny<fengjihu@163.com> karthikeyan<keyanmca@gmail.com> StevenLiu<lq@chinaffmpeg.org> zhengfl<zhengfl_1989@126.com> tufang14<breadbean1449@gmail.com> allspace<allspace@gmail.com> niesongsong<nie950@gmail.com> rudeb0t<nimrod@themanxgroup.tw> CallMeNP<np.liamg@gmail.com> synote<synote@qq.com> lovecat<littlefawn@163.com> panda1986<542638787@qq.com> YueHonghui<hongf.yue@hotmail.com> ThomasDreibholz<dreibh@simula.no> JuntaoLiu<juntliu@gmail.com> RocFang<fangpeng1986@gmail.com> MakarovYaroslav<yaroslav.makarov.97@mail.ru> MirkoVelic<mvelic@inoxx.net> HuiZhang(huzhang2)<huzhang2@cisco.com> OtterWa<simpleotter23@gmail.com> walkermi<172192667@qq.com> haofz<fuzhuang.hao@vhall.com> ME_Kun_Han<hanvskun@hotmail.com> ljx0305<ljx0305@gmail.com> cenxinwei<censhanhe@163.com> StarBrilliant<m13253@hotmail.com> xubin<xubin@chnvideo.com> intliang<yintiliang@gmail.com> flowerwrong<sysuyangkang@gmail.com> YLX<568414379@qq.com> J<guotaojiang@qq.com> Harlan<hailiang@gvrcraft.com> hankun<hankun@bravovcloud.com> JonathanBarratt<jonathan.barratt@gmail.com> KeeganH<keeganwharris@gmail.com> StevenLiu<lingjiujianke@gmail.com> liuxc0116<liuxc0116@gmail.com> ChengdongZhang<lmajzcd@sina.com> lovacat<lovecat@china.sina.com> qiang.li<qiang.li@verycdn.com.cn> HungMingWu<u9089000@gmail.com> Himer<xishizhaohua@qq.com> xialixin<xlx0625@163.com> alphonsetai<tyh_123@163.com> Michael.Ma<wnpllr@gmail.com>
srs-origin-a_1  | [2020-01-13 09:09:56.057][Trace][1][0] cwd=/usr/local/srs, work_dir=./, build: 2020-01-10 12:41:22, configure: --x86-x64 , uname: Linux dcaf45f48446 4.4.0-1060-aws #69-Ubuntu SMP Sun May 20 13:42:07 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
srs-origin-a_1  | [2020-01-13 09:09:56.057][Trace][1][0] configure detail: --prefix=/usr/local/srs --with-hls --with-hds --with-dvr --with-ssl --with-transcode --with-ingest --with-stat --with-http-callback --with-http-server --with-stream-caster --with-http-api --with-librtmp --without-research --with-utest --without-gperf --without-gmc --without-gmd --without-gmp --without-gcp --without-gprof --log-trace
srs-origin-a_1  | [2020-01-13 09:09:56.057][Trace][1][0] srs checking config...
srs-origin-a_1  | [2020-01-13 09:09:56.058][Trace][1][0] ips, iface[0] eth0 ipv4 0x11043 172.28.0.3
srs-origin-a_1  | [2020-01-13 09:09:56.058][Trace][1][0] devices, intranet eth0 172.28.0.3
srs-origin-a_1  | [2020-01-13 09:09:56.058][Warn][1][0][0] stats network use index=0, ip=172.28.0.3
srs-origin-a_1  | [2020-01-13 09:09:56.058][Warn][1][0][0] stats disk not configed, disk iops disabled.
srs-origin-a_1  | [2020-01-13 09:09:56.058][Trace][1][0] write log to console
srs-origin-a_1  | [2020-01-13 09:09:56.058][Trace][1][0] features, rch:on, dash:on, hls:on, hds:on, hc:on, ha:on, hs:on, hp:on, dvr:on, trans:on, inge:on, stat:on, sc:on
srs-origin-a_1  | [2020-01-13 09:09:56.058][Trace][1][0] SRS on  amd64 x86_64, glibc2.17, conf:conf/srs.conf, limit:3000, writev:1024, encoding:little-endian, HZ:100
srs-origin-a_1  | [2020-01-13 09:09:56.058][Trace][1][0] mw sleep:350ms. mr enabled:on, default:0, sleep:350ms
srs-origin-a_1  | [2020-01-13 09:09:56.058][Trace][1][0] gc:on, pq:30000ms, cscc:[0,16), csa:on, tn:on(may hurts performance), ss:auto(guess by merged write)
srs-origin-a_1  | [2020-01-13 09:09:56.058][Trace][1][0] system default latency(ms): mw(0-350) + mr(0-350) + play-queue(0-30000)
srs-origin-a_1  | [2020-01-13 09:09:56.058][Warn][1][0][0] Develop is unstable, please use branch: git checkout -b 2.0release origin/2.0release
srs-origin-a_1  | [2020-01-13 09:09:56.058][Trace][1][0] http: root mount to ./objs/nginx/html
srs-origin-a_1  | [2020-01-13 09:09:56.058][Trace][1][0] st_init success, use epoll
srs-origin-a_1  | [2020-01-13 09:09:56.058][Trace][1][508] server main cid=508, pid=1, ppid=0, asprocess=0
srs-origin-a_1  | [2020-01-13 09:09:56.058][Trace][1][508] write pid=1 to ./objs/srs.pid success!
srs-origin-a_1  | [2020-01-13 09:09:56.058][Trace][1][508] RTMP listen at tcp://0.0.0.0:1935, fd=7
srs-origin-a_1  | [2020-01-13 09:09:56.059][Trace][1][508] HTTP-API listen at tcp://0.0.0.0:1985, fd=8
srs-origin-a_1  | [2020-01-13 09:09:56.059][Trace][1][508] signal installed, reload=1, reopen=10, grace_quit=15
srs-origin-a_1  | [2020-01-13 09:09:56.059][Trace][1][508] http: api mount /console to ./objs/nginx/html/console
srs-origin-b_1  | [2020-01-13 09:09:55.976][Trace][1][0] XCORE-SRS/3.0.97(OuXuli)
srs-origin-b_1  | [2020-01-13 09:09:55.987][Trace][1][0] config parse complete
srs-origin-b_1  | [2020-01-13 09:09:55.987][Trace][1][0] write log to console
srs-origin-b_1  | [2020-01-13 09:09:55.987][Trace][1][0] SRS/3.0.97(OuXuli), The MIT License (MIT)
srs-origin-b_1  | [2020-01-13 09:09:55.987][Trace][1][0] contributors: winlin<winlin@vip.126.com> wenjie.zhao<740936897@qq.com> xiangcheng.liu<liuxc0116@foxmail.com> naijia.liu<youngcow@youngcow.net> alcoholyi<alcoholyi@qq.com> byteman<wangchen2011@gmail.com> chad.wang<chad.wang.cn@gmail.com> suhetao<suhetao@gmail.com> Johnny<fengjihu@163.com> karthikeyan<keyanmca@gmail.com> StevenLiu<lq@chinaffmpeg.org> zhengfl<zhengfl_1989@126.com> tufang14<breadbean1449@gmail.com> allspace<allspace@gmail.com> niesongsong<nie950@gmail.com> rudeb0t<nimrod@themanxgroup.tw> CallMeNP<np.liamg@gmail.com> synote<synote@qq.com> lovecat<littlefawn@163.com> panda1986<542638787@qq.com> YueHonghui<hongf.yue@hotmail.com> ThomasDreibholz<dreibh@simula.no> JuntaoLiu<juntliu@gmail.com> RocFang<fangpeng1986@gmail.com> MakarovYaroslav<yaroslav.makarov.97@mail.ru> MirkoVelic<mvelic@inoxx.net> HuiZhang(huzhang2)<huzhang2@cisco.com> OtterWa<simpleotter23@gmail.com> walkermi<172192667@qq.com> haofz<fuzhuang.hao@vhall.com> ME_Kun_Han<hanvskun@hotmail.com> ljx0305<ljx0305@gmail.com> cenxinwei<censhanhe@163.com> StarBrilliant<m13253@hotmail.com> xubin<xubin@chnvideo.com> intliang<yintiliang@gmail.com> flowerwrong<sysuyangkang@gmail.com> YLX<568414379@qq.com> J<guotaojiang@qq.com> Harlan<hailiang@gvrcraft.com> hankun<hankun@bravovcloud.com> JonathanBarratt<jonathan.barratt@gmail.com> KeeganH<keeganwharris@gmail.com> StevenLiu<lingjiujianke@gmail.com> liuxc0116<liuxc0116@gmail.com> ChengdongZhang<lmajzcd@sina.com> lovacat<lovecat@china.sina.com> qiang.li<qiang.li@verycdn.com.cn> HungMingWu<u9089000@gmail.com> Himer<xishizhaohua@qq.com> xialixin<xlx0625@163.com> alphonsetai<tyh_123@163.com> Michael.Ma<wnpllr@gmail.com>
srs-origin-b_1  | [2020-01-13 09:09:55.987][Trace][1][0] cwd=/usr/local/srs, work_dir=./, build: 2020-01-10 12:41:22, configure: --x86-x64 , uname: Linux dcaf45f48446 4.4.0-1060-aws #69-Ubuntu SMP Sun May 20 13:42:07 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
srs-origin-b_1  | [2020-01-13 09:09:55.987][Trace][1][0] configure detail: --prefix=/usr/local/srs --with-hls --with-hds --with-dvr --with-ssl --with-transcode --with-ingest --with-stat --with-http-callback --with-http-server --with-stream-caster --with-http-api --with-librtmp --without-research --with-utest --without-gperf --without-gmc --without-gmd --without-gmp --without-gcp --without-gprof --log-trace
srs-origin-b_1  | [2020-01-13 09:09:55.987][Trace][1][0] srs checking config...
srs-origin-b_1  | [2020-01-13 09:09:55.987][Trace][1][0] ips, iface[0] eth0 ipv4 0x11043 172.28.0.2
srs-origin-b_1  | [2020-01-13 09:09:55.987][Trace][1][0] devices, intranet eth0 172.28.0.2
srs-origin-b_1  | [2020-01-13 09:09:55.987][Warn][1][0][0] stats network use index=0, ip=172.28.0.2
srs-origin-b_1  | [2020-01-13 09:09:55.987][Warn][1][0][0] stats disk not configed, disk iops disabled.
srs-origin-b_1  | [2020-01-13 09:09:55.987][Trace][1][0] write log to console
srs-origin-b_1  | [2020-01-13 09:09:55.987][Trace][1][0] features, rch:on, dash:on, hls:on, hds:on, hc:on, ha:on, hs:on, hp:on, dvr:on, trans:on, inge:on, stat:on, sc:on
srs-origin-b_1  | [2020-01-13 09:09:55.987][Trace][1][0] SRS on  amd64 x86_64, glibc2.17, conf:conf/srs.conf, limit:3000, writev:1024, encoding:little-endian, HZ:100
srs-origin-b_1  | [2020-01-13 09:09:55.987][Trace][1][0] mw sleep:350ms. mr enabled:on, default:0, sleep:350ms
srs-origin-b_1  | [2020-01-13 09:09:55.987][Trace][1][0] gc:on, pq:30000ms, cscc:[0,16), csa:on, tn:on(may hurts performance), ss:auto(guess by merged write)
srs-origin-b_1  | [2020-01-13 09:09:55.988][Trace][1][0] system default latency(ms): mw(0-350) + mr(0-350) + play-queue(0-30000)
srs-origin-b_1  | [2020-01-13 09:09:55.988][Warn][1][0][0] Develop is unstable, please use branch: git checkout -b 2.0release origin/2.0release
srs-origin-b_1  | [2020-01-13 09:09:55.988][Trace][1][0] http: root mount to ./objs/nginx/html
srs-origin-b_1  | [2020-01-13 09:09:55.988][Trace][1][0] st_init success, use epoll
srs-origin-b_1  | [2020-01-13 09:09:55.988][Trace][1][484] server main cid=484, pid=1, ppid=0, asprocess=0
srs-origin-b_1  | [2020-01-13 09:09:55.988][Trace][1][484] write pid=1 to ./objs/srs.pid success!
srs-origin-b_1  | [2020-01-13 09:09:55.988][Trace][1][484] RTMP listen at tcp://0.0.0.0:1936, fd=7
srs-origin-b_1  | [2020-01-13 09:09:55.988][Trace][1][484] HTTP-API listen at tcp://0.0.0.0:1986, fd=8
srs-origin-b_1  | [2020-01-13 09:09:55.988][Trace][1][484] signal installed, reload=1, reopen=10, grace_quit=15
srs-origin-b_1  | [2020-01-13 09:09:55.988][Trace][1][484] http: api mount /console to ./objs/nginx/html/console
srs-origin-a_1  | [2020-01-13 09:10:33.091][Trace][1][513] RTMP client ip=172.28.0.1, fd=9
srs-origin-a_1  | [2020-01-13 09:10:33.093][Trace][1][513] simple handshake success.
srs-origin-a_1  | [2020-01-13 09:10:33.093][Trace][1][513] connect app, tcUrl=rtmp://192.168.31.131/streams, pageUrl=, swfUrl=rtmp://192.168.31.131/streams, schema=rtmp, vhost=192.168.31.131, port=1935, app=streams, args=null
srs-origin-a_1  | [2020-01-13 09:10:33.094][Trace][1][513] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=4096, out.chunk=128
srs-origin-a_1  | [2020-01-13 09:10:33.144][Trace][1][513] client identified, type=fmle-publish, vhost=192.168.31.131, app=streams, stream=123, param=, duration=0ms
srs-origin-a_1  | [2020-01-13 09:10:33.144][Trace][1][513] connected stream, tcUrl=rtmp://192.168.31.131/streams, pageUrl=, swfUrl=rtmp://192.168.31.131/streams, schema=rtmp, vhost=__defaultVhost__, port=1935, app=streams, stream=123, param=, args=null
srs-origin-a_1  | [2020-01-13 09:10:33.144][Trace][1][513] source url=/streams/123, ip=172.28.0.1, cache=1, is_edge=0, source_id=-1[-1]
srs-origin-a_1  | [2020-01-13 09:10:33.196][Trace][1][513] ignore disabled exec for vhost=__defaultVhost__
srs-origin-a_1  | [2020-01-13 09:10:33.196][Trace][1][513] start publish mr=0/350, p1stpt=20000, pnt=5000, tcp_nodelay=0
srs-origin-a_1  | [2020-01-13 09:10:33.246][Trace][1][513] got metadata, width=1280, height=720
srs-origin-a_1  | [2020-01-13 09:10:33.954][Trace][1][513] 4B audio sh, codec(10, profile=LC, 2channels, 0kbps, 44100HZ), flv(16bits, 2channels, 44100HZ)
srs-origin-a_1  | [2020-01-13 09:10:33.954][Trace][1][513] 45B video sh,  codec(7, profile=High, level=3.1, 1280x720, 0kbps, 0.0fps, 0.0s)
srs-origin-b_1  | [2020-01-13 09:10:51.369][Trace][1][489] RTMP client ip=172.28.0.1, fd=9
srs-origin-b_1  | [2020-01-13 09:10:51.376][Trace][1][489] complex handshake success
srs-origin-b_1  | [2020-01-13 09:10:51.376][Trace][1][489] connect app, tcUrl=rtmp://192.168.31.131:1936/streams, pageUrl=http://ossrs.net/srs.release/trunk/research/players/srs_player.html?app=streams&stream=123&server=118.212.151.86&port=1935&autostart=true&vhost=118.212.151.86&buffer=0.1#, swfUrl=http://ossrs.net/srs.release/trunk/research/players/srs_player/release/srs_player.swf?_version=1.33, schema=rtmp, vhost=192.168.31.131, port=1936, app=streams, args=null
srs-origin-b_1  | [2020-01-13 09:10:51.376][Trace][1][489] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
srs-origin-b_1  | [2020-01-13 09:10:51.572][Trace][1][489] client identified, type=Play, vhost=192.168.31.131, app=streams, stream=123, param=, duration=-1ms
srs-origin-b_1  | [2020-01-13 09:10:51.572][Trace][1][489] connected stream, tcUrl=rtmp://192.168.31.131:1936/streams, pageUrl=http://ossrs.net/srs.release/trunk/research/players/srs_player.html?app=streams&stream=123&server=118.212.151.86&port=1935&autostart=true&vhost=118.212.151.86&buffer=0.1#, swfUrl=http://ossrs.net/srs.release/trunk/research/players/srs_player/release/srs_player.swf?_version=1.33, schema=rtmp, vhost=__defaultVhost__, port=1936, app=streams, stream=123, param=, args=null
srs-origin-b_1  | [2020-01-13 09:10:51.572][Trace][1][489] source url=/streams/123, ip=172.28.0.1, cache=1, is_edge=0, source_id=-1[-1]
srs-origin-a_1  | [2020-01-13 09:10:51.574][Trace][1][514] API server client, ip=172.28.0.1
srs-origin-a_1  | [2020-01-13 09:10:51.575][Trace][1][514] HTTP API POST http://192.168.31.131:1985/api/v1/clusters?vhost=__defaultVhost__&ip=192.168.31.131&app=streams&stream=123&coworker=192.168.31.131:1985, content-length=0, chunked=0/0
srs-origin-a_1  | [2020-01-13 09:10:51.575][Trace][1][514] Redirect vhost=__defaultVhost__, path=streams/123 to ip=192.168.31.131, port=1935, api=192.168.31.131:1985
srs-origin-b_1  | [2020-01-13 09:10:51.576][Trace][1][489] ignore private address: 172.28.0.2
srs-origin-b_1  | [2020-01-13 09:10:51.576][Warn][1][489][11] use private address as ip: 172.28.0.2
srs-origin-b_1  | [2020-01-13 09:10:51.576][Trace][1][489] http: cluster redirect 192.168.31.131:1935 ok, url=http://192.168.31.131:1985/api/v1/clusters?vhost=__defaultVhost__&ip=192.168.31.131&app=streams&stream=123&coworker=192.168.31.131:1985, response={"code":0,"data":{"query":{"ip":"192.168.31.131","vhost":"__defaultVhost__","app":"streams","stream":"123"},"origin":{"ip":"192.168.31.131","port":1935,"vhost":"__defaultVhost__","api":"192.168.31.131:1985","routers":["192.168.31.131:1985"]}}}
srs-origin-b_1  | [2020-01-13 09:10:51.576][Trace][1][489] rtmp: redirect in cluster, from=192.168.31.131:1936, target=192.168.31.131:1935, url=http://192.168.31.131:1985/api/v1/clusters?vhost=__defaultVhost__&ip=192.168.31.131&app=streams&stream=123&coworker=192.168.31.131:1985
srs-origin-a_1  | [2020-01-13 09:10:51.577][Warn][1][514][104] client disconnect peer. ret=1007
srs-origin-b_1  | [2020-01-13 09:10:51.665][Trace][1][489] client finished.
srs-origin-a_1  | [2020-01-13 09:10:52.695][Trace][1][515] RTMP client ip=172.28.0.1, fd=10
srs-origin-a_1  | [2020-01-13 09:10:52.706][Trace][1][515] complex handshake success
srs-origin-a_1  | [2020-01-13 09:10:52.706][Trace][1][515] connect app, tcUrl=rtmp://192.168.31.131:1935/streams/123, pageUrl=http://ossrs.net/srs.release/trunk/research/players/srs_player.html?app=streams&stream=123&server=118.212.151.86&port=1935&autostart=true&vhost=118.212.151.86&buffer=0.1#, swfUrl=http://ossrs.net/srs.release/trunk/research/players/srs_player/release/srs_player.swf?_version=1.33, schema=rtmp, vhost=192.168.31.131, port=1935, app=streams/123, args=null
srs-origin-a_1  | [2020-01-13 09:10:52.706][Trace][1][515] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
srs-origin-a_1  | [2020-01-13 09:10:52.777][Trace][1][515] client identified, type=Play, vhost=192.168.31.131, app=streams/123, stream=123, param=, duration=-1ms
srs-origin-a_1  | [2020-01-13 09:10:52.777][Trace][1][515] connected stream, tcUrl=rtmp://192.168.31.131:1935/streams/123, pageUrl=http://ossrs.net/srs.release/trunk/research/players/srs_player.html?app=streams&stream=123&server=118.212.151.86&port=1935&autostart=true&vhost=118.212.151.86&buffer=0.1#, swfUrl=http://ossrs.net/srs.release/trunk/research/players/srs_player/release/srs_player.swf?_version=1.33, schema=rtmp, vhost=__defaultVhost__, port=1935, app=streams/123, stream=123, param=, args=null
srs-origin-a_1  | [2020-01-13 09:10:52.777][Trace][1][515] source url=/streams/123/123, ip=172.28.0.1, cache=1, is_edge=0, source_id=-1[-1]
srs-origin-b_1  | [2020-01-13 09:10:52.778][Trace][1][490] API server client, ip=172.28.0.1
srs-origin-b_1  | [2020-01-13 09:10:52.779][Trace][1][490] HTTP API POST http://192.168.31.131:1986/api/v1/clusters?vhost=__defaultVhost__&ip=192.168.31.131&app=streams/123&stream=123&coworker=192.168.31.131:1986, content-length=0, chunked=0/0
srs-origin-b_1  | [2020-01-13 09:10:52.781][Warn][1][490][104] client disconnect peer. ret=1007
srs-origin-a_1  | [2020-01-13 09:10:52.780][Trace][1][515] ignore private address: 172.28.0.3
srs-origin-a_1  | [2020-01-13 09:10:52.780][Warn][1][515][11] use private address as ip: 172.28.0.3
srs-origin-a_1  | [2020-01-13 09:10:52.780][Error][1][515][11] serve error code=3090 : service cycle : rtmp: stream service : discover coworkers, url=http://192.168.31.131:1986/api/v1/clusters?vhost=__defaultVhost__&ip=192.168.31.131&app=streams/123&stream=123&coworker=192.168.31.131:1986 : parse data {"code":0,"data":{"query":{"ip":"192.168.31.131","vhost":"__defaultVhost__","app":"streams/123","stream":"123"},"origin":null}}
srs-origin-a_1  | thread [1][515]: do_cycle() [src/app/srs_app_rtmp_conn.cpp:210][errno=11]
srs-origin-a_1  | thread [1][515]: service_cycle() [src/app/srs_app_rtmp_conn.cpp:400][errno=11]
srs-origin-a_1  | thread [1][515]: playing() [src/app/srs_app_rtmp_conn.cpp:622][errno=11]
srs-origin-a_1  | thread [1][515]: discover_co_workers() [src/app/srs_app_http_hooks.cpp:453][errno=11](Resource temporarily unavailable)
srs-origin-a_1  | [2020-01-13 09:10:58.196][Trace][1][513] <- CPB time=20001998, okbps=1,0,0, ikbps=1550,0,0, mr=0/350, p1stpt=20000, pnt=5000
srs-origin-a_1  | [2020-01-13 09:11:07.074][Trace][1][513] cleanup when unpublish
srs-origin-a_1  | [2020-01-13 09:11:07.074][Trace][1][513] rtmp: retry for republish
srs-origin-a_1  | [2020-01-13 09:11:07.074][Warn][1][513][104] client disconnect peer. ret=1007

Expected Behavior (Expect)

The expected return should be rtmp://192.168.31.131:1935/streams/123.

I have been looking at this feature for a long time, and there are no other related issues. Did I misunderstand something?

TRANS_BY_GPT3

@springjk
Copy link
Author

springjk commented Jan 13, 2020

Add an edge on top of this, push to A and B, both edges can play normally, but I see in #464 (comment) that there is an example of what I mentioned above, and this example cannot run.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Jan 16, 2020

First of all, the quality of this issue is very high. It can directly reproduce the problem following your steps. The description is clear, logical, and reasonable. I give you 5 thumbs up. 👍👍👍👍👍
'
Please make sure to maintain the markdown structure.

Furthermore, regarding this issue, the actual returned URL is a complete RTMP URL stream address (as shown in the figure below), but the redirect of "srs-player" is used as the tcURL and not a complete RTMP URL. Then, it adds an additional streamName:

Please make sure to maintain the markdown structure.

                if (evt.info.code == "NetConnection.Connect.Rejected") {
                    if (evt.info.hasOwnProperty("ex") && evt.info.ex.code == 302) {
                        streamName = url.substr(url.lastIndexOf("/") + 1);
                        url = evt.info.ex.redirect + "/" + streamName;
                        log("Async RTMP 302 Redirect to: " + url);
                        owner.on_player_302(url);

image

Referring to the definition of RTMP in FMS, it is actually the tcURL and not a complete RTMP URL. You can refer to this link for more information: #369 (comment)

Please make sure to maintain the markdown structure.

So, in the end, it is still a problem of redirection. It should only return the tcUrl instead of the complete RTMP URL.

Please make sure to maintain the markdown structure.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Jan 16, 2020

Explain why the redirect address of FMS is tcUrl instead of RTMP URL, because RTMP is divided into connect(tcUrl) and play(streamName), which means that the RTMP URL is divided into two stages. Generally, the redirect will be in onConnect, for example:

application.onConnect = function(client) {
    var tcUrl = "rtmp://192.168.1.107:1935/live";
    application.redirectConnection(client, tcUrl);
}

During onConnect, only the tcUrl should be redirected, as there is no streamName at this point.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Jan 16, 2020

Solution:

  1. Keep redirect as tcUrl so that srs-player and other clients that have integrated with FMS can connect properly.
  2. Add a new redirect2 as the RTMP URL so that srs edge can pull the stream correctly. In fact, SRS has gradually aligned the URL logic with HTTP URL, for example, parameters that used to be placed in tcUrl are now placed in the RTMP URL or streamName for HTTP.

Please make sure to maintain the markdown structure.

While maintaining compatibility, try to align with the HTTP URL as much as possible.

Please make sure to maintain the markdown structure.

image

srs-player is working fine, edge is normal.'

Please make sure to maintain the markdown structure.

TRANS_BY_GPT3

@winlinvip winlinvip added this to the SRS 3.0 release milestone Jan 16, 2020
@winlinvip winlinvip added the Bug It might be a bug. label Jan 16, 2020
@winlinvip winlinvip self-assigned this Sep 5, 2021
@winlinvip winlinvip changed the title 源站集群重复重定向流名称 Redirected flow name duplicated in the origin server cluster Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It might be a bug. TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

2 participants