**使用HTTPApi更新配置文件导致srs异常退出

vaj7vani  于 2022-12-31  发布在  其他
关注(0)|答案(5)|浏览(310)

使用HTTPApi更新配置文件导致srs异常退出

  1. SRS版本(Version): 3.0.116
  2. SRS的日志如下(Log):
[2020-02-14 10:01:44.985][Trace][731][498] API server client, ip=127.0.0.1
[2020-02-14 10:01:44.985][Trace][731][498] HTTP API GET http://127.0.0.1:1985/api/v1/raw?rpc=update&scope=srs_log_level&value=info, content-length=-1, chunked=0/0
[2020-02-14 10:01:44.985][Trace][731][498] reload srs_log_level success.
[2020-02-14 10:01:44.985][Trace][731][498] raw api update srs_log_level=info ok.
[2020-02-14 10:01:44.986][Warn][731][498][104] client disconnect peer. ret=1007
[2020-02-14 10:01:45.388][Warn][731][492][13] main cycle terminated, system quit normally.
[2020-02-14 10:01:45.488][Trace][731][492] srs terminated

重现步骤

  1. 按wiki编译打包,在Ubuntu18.04.3上安装
  2. 将文件权限设置为777
  3. 非root用户运行srs, /etc/init.d/srs start
  4. 使用HTTPApi更改配置srs_log_level, curl 'http://127.0.0.1:1985/api/v1/raw?rpc=update&scope=srs_log_level&value=info'

期待结果
按照wiki: https://github.com/ossrs/srs/wiki/v3_CN_HTTPApi
配置文件更新,reload后,srs正常运行。
实际上配置文件已经更新。但是srs进程退出。

but5z9lq

but5z9lq1#

同样更改RAW DVR配置:
curl 'http://127.0.0.1:1985/api/v1/raw?rpc=update&scope=dvr&value=127.0.0.1&param=disable&data=live/234'
也是srs退出,log日志如下:

[2020-02-14 10:12:31.111][Trace][4322][451] API server client, ip=127.0.0.1
[2020-02-14 10:12:31.111][Trace][4322][451] HTTP API GET http://127.0.0.1:1985/api/v1/raw?rpc=update&scope=dvr&value=127.0.0.1&param=disable&data=live/234, content-length=-1, chunked=0/0
[2020-02-14 10:12:31.111][Trace][4322][451] vhost 127.0.0.1 reload dvr_apply success.
[2020-02-14 10:12:31.111][Trace][4322][451] raw api update dvr=127.0.0.1/live/234 to disable ok.
[2020-02-14 10:12:31.111][Warn][4322][451][104] client disconnect peer. ret=1007
[2020-02-14 10:12:31.931][Warn][4322][444][13] main cycle terminated, system quit normally.
[2020-02-14 10:12:32.031][Trace][4322][444] srs terminated
mbskvtky

mbskvtky2#

配置文件给下。

91zkwejq

91zkwejq3#

使用的配置文件内容如下:

~$ cat /usr/local/srs/conf/srs.conf 
listen 1935;
max_connections 1000;
srs_log_tank file;
srs_log_file ./objs/srs.log;
srs_log_level trace;
http_api {
    enabled on;
    listen 1985;
    raw_api {
        enabled on;
        allow_reload on;
        allow_query on;
        allow_update on;
    }
}
http_server {
    enabled on;
    listen 8080;
    dir ./objs/nginx/html;
}
stats {
    network 0;
    disk sda sdb xvda xvdb;
}
vhost 127.0.0.1 {
    dvr {
        enabled on;
        dvr_path ./objs/nginx/html/[app]/[2006]-[01]-[02]/[stream]-[15].[04].[05].[999].mp4;
        dvr_plan segment;
        dvr_duration 30;
        dvr_wait_keyframe on;
        dvr_apply live/234;
    }
    http_hooks {
        enabled on;
        on_dvr http://127.0.0.1:8085/api/v1/dvrs;
    }
}
ctrmrzij

ctrmrzij4#

这个问题后来有解决么?我也遇到了相同的问题,使用的是官方的Docker镜像:
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:3

vom3gejh

vom3gejh5#

HTTP RAW API需要谨慎,还不够稳定。

相关问题