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

API: The server_id does not change even when restarted. 服务重启 server ID 标识没有改变 #3378

Closed
xiangzi1 opened this issue Jan 11, 2023 · 2 comments · Fixed by #3385
Assignees
Labels
API HTTP-API, HTTP-Callback, etc. Enhancement Improvement or enhancement. TransByAI Translated by AI/GPT.
Milestone

Comments

@xiangzi1
Copy link

xiangzi1 commented Jan 11, 2023

Note: Please read FAQ before file an issue, see #2716

Description

Please description your issue here

  1. SRS Version: srs5.0.100

  2. SRS Log:

Start to run service
[2023-01-11 15:51:51.448][INFO][21][1i3bs59v] XCORE-SRS/5.0.100(Bee)
[2023-01-11 15:51:51.449][INFO][21][1i3bs59v] config parse complete
[2023-01-11 15:51:51.449][INFO][21][1i3bs59v] write log to console
[2023-01-11 15:51:51.449][INFO][21][1i3bs59v] SRS/5.0.100(Bee), MIT
[2023-01-11 15:51:51.449][INFO][21][1i3bs59v] authors: Winlin<winlin@vip.126.com> ZhaoWenjie<zhaowenjie@tal.com> ShiWei<shiwei05@kuaishou.com> XiaoZhihong<hondaxiao@tencent.com> WuPengqiang<pengqiang.wpq@alibaba-inc.com> XiaLixin<xialixin@kanzhun.com> LiPeng<mozhan.lp@alibaba-inc.com> ChenGuanghua<jinxue.cgh@alibaba-inc.com> ChenHaibo<nmgchenhaibo@foxmail.com> Johzzy<hellojinqiang@gmail.com> Zhouxiaojun2008<279686030@qq.com> Pengfei.ma<pengfei.ma.chn@outlook.com> ZhangJunqin<zhangjunqin@jd.com> and https://github.com/ossrs/srs/blob/develop/trunk/AUTHORS.md#contributors
[2023-01-11 15:51:51.449][INFO][21][1i3bs59v] cwd=/usr/local/srs, work_dir=./, build: 2022-12-01 15:19:56, configure: --gb28181=on --sanitizer-static=on, uname: Linux buildkitsandbox 5.15.0-1023-azure #29~20.04.1-Ubuntu SMP Wed Oct 26 19:18:25 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux, osx: 0, env: 0, pkg: dcis
[2023-01-11 15:51:51.449][INFO][21][1i3bs59v] configure detail: --prefix=/usr/local/srs --config=conf/srs.conf --hls=on --hds=off --dvr=on --ssl=on --https=on --ssl-1-0=off --ssl-local=off --sys-ssl=off --transcode=on --ingest=on --stat=on --http-callback=on --http-server=on --stream-converter=on --http-api=on --utest=off --cherrypy=off --srt=on --rtc=on --gb28181=on --simulator=off --cxx11=on --cxx14=off --backtrace=on --ffmpeg-fit=on --nasm=on --srtp-nasm=on --clean=on --gperf=off --gmc=off --gmd=off --gmp=off --gcp=off --gprof=off --static=off --shared-st=off --shared-srt=off --shared-ffmpeg=off --log-verbose=off --log-info=off --log-trace=on --log-level_v2=on --gcov=off --debug=off --debug-stats=off --cross-build=off --sanitizer=on --cygwin64=off --single-thread=off --cc=gcc --cxx=g++ --ar=ar --ld=ld --randlib=randlib
[2023-01-11 15:51:51.449][INFO][21][1i3bs59v] srs checking config...
[2023-01-11 15:51:51.450][INFO][21][1i3bs59v] ips, iface[0] eth0 ipv4 0x11043 172.17.0.2
[2023-01-11 15:51:51.450][INFO][21][1i3bs59v] devices, intranet eth0 172.17.0.2
[2023-01-11 15:51:51.450][WARN][21][1i3bs59v][22] stats network use index=0, ip=172.17.0.2, ifname=eth0
[2023-01-11 15:51:51.450][WARN][21][1i3bs59v][22] stats disk not configed, disk iops disabled.
[2023-01-11 15:51:51.450][INFO][21][1i3bs59v] write log to console
[2023-01-11 15:51:51.451][INFO][21][1i3bs59v] features, rch:on, dash:on, hls:on, hds:off, srt:on, hc:on, ha:on, hs:on, hp:on, dvr:on, trans:on, inge:on, stat:on, sc:on
[2023-01-11 15:51:51.451][INFO][21][1i3bs59v] SRS on amd64 x86_64, conf:conf/docker.conf, limit:1000, writev:1024, encoding:little-endian, HZ:100
[2023-01-11 15:51:51.451][INFO][21][1i3bs59v] mw sleep:350ms. mr enabled:on, default:0, sleep:350ms
[2023-01-11 15:51:51.451][INFO][21][1i3bs59v] gc:on, pq:30000ms, cscc:[0,16), csa:on, tn:on(may hurts performance), ss:auto(guess by merged write)
[2023-01-11 15:51:51.451][INFO][21][1i3bs59v] system default latency(ms): mw(0-350) + mr(0-350) + play-queue(0-30000)
[2023-01-11 15:51:51.451][WARN][21][1i3bs59v][22] SRS/5.0.100 is not stable
[2023-01-11 15:51:51.451][INFO][21][1i3bs59v] write pid=21 to ./objs/srs.pid success!
[2023-01-11 15:51:51.451][INFO][21][1i3bs59v] Thread #1(primordial): init name=srs-master-1, interval=5000ms
[2023-01-11 15:51:51.451][INFO][21][1i3bs59v] Pool: Start threads primordial=1, hybrids=1 ok
[2023-01-11 15:51:51.452][INFO][21][g862ifw7] Thread #2: run with tid=22, entry=0x60c000000400, label=hybrid, name=srs-hybrid-2
[2023-01-11 15:51:51.467][INFO][21][g862ifw7] TencentCloud CLS is disabled
[2023-01-11 15:51:51.467][INFO][21][g862ifw7] TencentCloud APM is disabled
[2023-01-11 15:51:51.473][INFO][21][g862ifw7] fingerprint=D0:63:46:D7:58:01:CE:ED:7D:04:7F:F3:BF:68:EA:2B:68:39:29:3A:7F:64:18:BC:19:29:C8:CF:92:13:06:62
[2023-01-11 15:51:51.473][INFO][21][g862ifw7] CircuitBreaker: enabled=1, high=2x90, critical=1x95, dying=5x99
[2023-01-11 15:51:51.474][INFO][21][g862ifw7] http flv live stream, vhost=__defaultVhost__, mount=[vhost]/[app]/[stream].flv
[2023-01-11 15:51:51.474][INFO][21][g862ifw7] http: root mount to ./objs/nginx/html
[2023-01-11 15:51:51.474][INFO][21][g862ifw7] server main cid=g862ifw7, pid=21, ppid=1, asprocess=0
[2023-01-11 15:51:51.475][INFO][21][g862ifw7] RTMP listen at tcp://0.0.0.0:1935, fd=9
[2023-01-11 15:51:51.475][INFO][21][g862ifw7] HTTP-API listen at tcp://0.0.0.0:1985, fd=10
[2023-01-11 15:51:51.475][INFO][21][g862ifw7] HTTP-Server listen at tcp://0.0.0.0:8080, fd=11
[2023-01-11 15:51:51.475][INFO][21][g862ifw7] signal installed, reload=1, reopen=10, fast_quit=15, grace_quit=3
[2023-01-11 15:51:51.476][INFO][21][g862ifw7] http: api mount /console to ./objs/nginx/html/console
[2023-01-11 15:51:51.477][INFO][21][g862ifw7] rtc listen at udp://0.0.0.0:8000, fd=12
[2023-01-11 15:51:51.477][INFO][21][599u6508] Hybrid cpu=0.00%,38MB
[2023-01-11 15:51:51.477][WARN][21][29404uj8][22] use private address as ip: 172.17.0.2, ifname=eth0
[2023-01-11 15:51:51.477][INFO][21][29404uj8] Startup query id=vid-gv865k1, session=vid-200j0qy, eip=172.17.0.2, wait=300s
[2023-01-11 15:51:51.477][INFO][21][o9ox3e2w] TCP: connection manager run, conns=0
[2023-01-11 15:51:51.478][WARN][21][g862ifw7][11] enable auto reload for docker
[2023-01-11 15:51:51.478][INFO][21][g862ifw7] auto reload watching fd=13, watch=1, file=conf
[2023-01-11 15:51:51.478][INFO][21][6u0408e3] GB: connection manager run, conns=0
[2023-01-11 15:51:51.478][INFO][21][o45my81t] SRT: connection manager run, conns=0
[2023-01-11 15:51:51.478][INFO][21][kc4j60h1] UDP #12 LISTEN at 0.0.0.0:8000, SO_SNDBUF(default=212992, expect=10485760, actual=425984, r0=0), SO_RCVBUF(default=212992, expect=10485760, actual=425984, r0=0)
[2023-01-11 15:51:51.478][INFO][21][gl439156] RTC: connection manager run, conns=0
[2023-01-11 15:51:51.488][INFO][21][hx039xv0] HTTP #0 10.67.4.32:59777 GET http://10.67.65.17:1985/api/v1/vhosts/?callback=angular.callbacks._2c, content-length=-1
[2023-01-11 15:51:51.545][INFO][21][hx039xv0] TCP: before dispose resource(HttpConn)(0x607000004f50), conns=1, zombies=0, ign=0, inz=0, ind=0
[2023-01-11 15:51:51.545][WARN][21][hx039xv0][104] client disconnect peer. ret=1007
[2023-01-11 15:51:51.545][INFO][21][o9ox3e2w] TCP: clear zombies=1 resources, conns=1, removing=0, unsubs=0
[2023-01-11 15:51:51.545][INFO][21][hx039xv0] TCP: disposing #0 resource(HttpConn)(0x607000004f50), conns=1, disposing=1, zombies=0
[2023-01-11 15:51:51.690][INFO][21][49w770rp] HTTP #0 10.67.4.32:59778 GET http://10.67.65.17:1985/api/v1/summaries, content-length=-1
[2023-01-11 15:51:51.734][INFO][21][49w770rp] TCP: before dispose resource(HttpConn)(0x6070000067d0), conns=1, zombies=0, ign=0, inz=0, ind=0
[2023-01-11 15:51:51.734][WARN][21][49w770rp][104] client disconnect peer. ret=1007
[2023-01-11 15:51:51.734][INFO][21][o9ox3e2w] TCP: clear zombies=1 resources, conns=1, removing=0, unsubs=0
[2023-01-11 15:51:51.734][INFO][21][49w770rp] TCP: disposing #0 resource(HttpConn)(0x6070000067d0), conns=1, disposing=1, zombies=0
[2023-01-11 15:51:52.518][INFO][21][1k7q1en9] HTTP #0 10.67.4.32:59780 GET http://10.67.65.17:1985/api/v1/summaries, content-length=-1
[2023-01-11 15:51:52.562][INFO][21][1k7q1en9] TCP: before dispose resource(HttpConn)(0x607000006d10), conns=2, zombies=0, ign=0, inz=0, ind=0

  1. SRS Config:
# docker config for srs.
# @see full.conf for detail config.

listen              1935;
max_connections     1000;
# For docker, please use docker logs to manage the logs of SRS.
# See https://docs.docker.com/config/containers/logging/
srs_log_tank        console;
daemon              off;
http_api {
    enabled         on;
    listen          1985;
    raw_api {
        enabled             on;
        allow_reload        on;
    }
}
http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}
rtc_server {
    enabled on;
    listen 8000;
    # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate
    candidate 10.67.65.17;
}
vhost __defaultVhost__ {
    http_hooks {
        enabled         on;
        on_close        http://xxxxx:3001/api/v1/clients;
        on_play         http://xxxxxx:3001/api/v1/sessions;
        on_stop         http://xxxxxx:3001/api/v1/sessions;
    }
    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;
        stun_timeout 5;
        stun_strict_check on;
    }
}

Replay

Please describe how to replay the bug?

Step 1: Start the SRS service.

API call: http://10.67.65.17:1985/api/v1/server
Response: {

    "code": 0,
    "server": "vid-gv865k1",
    "urls": {
        "versions": "the version of SRS",
        "summaries": "the summary(pid, argv, pwd, cpu, mem) of SRS",
        "rusages": "the rusage of SRS",
        "self_proc_stats": "the self process stats",
        "system_proc_stats": "the system process stats",
        "meminfos": "the meminfo of system",
        "authors": "the license, copyright, authors and contributors",
        "features": "the supported features of SRS",
        "requests": "the request itself, for http debug",
        "vhosts": "manage all vhosts or specified vhost",
        "streams": "manage all streams or specified stream",
        "clients": "manage all clients or specified client, default query top 10 clients",
        "raw": "raw api for srs, support CUID srs for instance the config",
        "clusters": "origin cluster server API",
        "perf": "System performance stat",
        "tcmalloc": "tcmalloc api with params ?page=summary|api"
    },
    "tests": {
        "requests": "show the request info",
        "errors": "always return an error 100",
        "redirects": "always redirect to /api/v1/test/errors",
        "[vhost]": "http vhost for http://error.srs.com:1985/api/v1/tests/errors"
    }
}

Step 2: Restart the SRS service.

SRS container restart.

Step 3: Call the server query interface again.

Call the interface: http://10.67.65.17:1985/api/v1/server
Response: {
    "code": 0,
    "server": "vid-gv865k1",
    "urls": {
        "versions": "the version of SRS",
        "summaries": "the summary(pid, argv, pwd, cpu, mem) of SRS",
        "rusages": "the rusage of SRS",
        "self_proc_stats": "the self process stats",
        "system_proc_stats": "the system process stats",
        "meminfos": "the meminfo of system",
        "authors": "the license, copyright, authors and contributors",
        "features": "the supported features of SRS",
        "requests": "the request itself, for http debug",
        "vhosts": "manage all vhosts or specified vhost",
        "streams": "manage all streams or specified stream",
        "clients": "manage all clients or specified client, default query top 10 clients",
        "raw": "raw api for srs, support CUID srs for instance the config",
        "clusters": "origin cluster server API",
        "perf": "System performance stat",
        "tcmalloc": "tcmalloc api with params ?page=summary|api"
    },
    "tests": {
        "requests": "show the request info",
        "errors": "always return an error 100",
        "redirects": "always redirect to /api/v1/test/errors",
        "[vhost]": "http vhost for http://error.srs.com:1985/api/v1/tests/errors"
    }
}

Expect

After the service restarts, the serverID changes.
Please describe your expectation.

TRANS_BY_GPT3

@xiangzi1 xiangzi1 reopened this Jan 11, 2023
@xiangzi1
Copy link
Author

xiangzi1 commented Jan 11, 2023

I tried the latest SRS container service, but the SRS serverID remained unchanged after restarting. The command to start the Docker container is: docker run --restart=always -itd -p 1935:1935 -p 1985:1985 -p 8081:8080 --name srs5.128 srs:v5.0.128.

TRANS_BY_GPT3

@winlinvip winlinvip changed the title srs 服务重启 server ID 标识没有改变 The server_id not changed even when restarted. 服务重启 server ID 标识没有改变 Jan 14, 2023
@winlinvip winlinvip changed the title The server_id not changed even when restarted. 服务重启 server ID 标识没有改变 API: The server_id not changed even when restarted. 服务重启 server ID 标识没有改变 Jan 14, 2023
@winlinvip winlinvip added this to the 5.0 milestone Jan 14, 2023
@winlinvip winlinvip added Enhancement Improvement or enhancement. API HTTP-API, HTTP-Callback, etc. labels Jan 14, 2023
@winlinvip
Copy link
Member

winlinvip commented Jan 14, 2023

The server_id is used to identify the machine, so it should not change when restart.

To identify the restart of service, we need another one named service_id:

  1. Use Prometheus Exporter, a server, pid and service label will be added to srs_build_info, for example:
# HELP srs_build_info A metric with a constant '1' value labeled by build_date, version from which SRS was built.
# TYPE srs_build_info gauge
srs_build_info{"server":"vid-2566t9t",service="ud72id23d",pid="2846"} 1
  1. Each API response, should return pid and service, for example, http://localhost:1985/api/v1/versions:
{
  "code": 0,
  "server": "vid-2566t9t",
  "service": "ud72id23d",
  "pid": 2846,
  "data": {
    "major": 6,
    "minor": 0,
    "revision": 14,
    "version": "6.0.14"
  }
}

chundonglinlin added a commit to chundonglinlin/srs that referenced this issue Jan 17, 2023
chundonglinlin added a commit to chundonglinlin/srs that referenced this issue Jan 17, 2023
winlinvip pushed a commit to chundonglinlin/srs that referenced this issue Jan 17, 2023
winlinvip pushed a commit to chundonglinlin/srs that referenced this issue Jan 17, 2023
winlinvip added a commit that referenced this issue Jan 17, 2023
* Exporter: Support server/pid/service.(#3378)
* API: Support return server/pid/service.(#3378)
* Use 8-length service id.
* Update release v5.0.135 v6.0.16

Co-authored-by: winlin <winlin@vip.126.com>
Co-authored-by: Haibo Chen <495810242@qq.com>
winlinvip added a commit that referenced this issue Jan 17, 2023
* Exporter: Support server/pid/service.(#3378)
* API: Support return server/pid/service.(#3378)
* Use 8-length service id.
* Update release v5.0.135 v6.0.16

PICK 02653ce

Co-authored-by: winlin <winlin@vip.126.com>
Co-authored-by: Haibo Chen <495810242@qq.com>
@winlinvip winlinvip changed the title API: The server_id not changed even when restarted. 服务重启 server ID 标识没有改变 API: The server_id does not change even when restarted. 服务重启 server ID 标识没有改变 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
API HTTP-API, HTTP-Callback, etc. Enhancement Improvement or enhancement. TransByAI Translated by AI/GPT.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants