Closed
Description
Note: Please read FAQ before file an issue, see 2716
Note: Before asking a question, please refer to the FAQ, specifically 2716.
Description (描述)
srs5.0 HTTP callback exception: When the HTTP callback response returns code 200 and response = 0, it still reports an error, causing the streaming to disconnect.
-
SRS Version:
XCORE-SRS/5.0.78(Bee)
link -
SRS Log:
[2022-10-21 18:27:13.719][Trace][37079][o0w60af5] TCP: clear zombies=1 resources, conns=1, removing=0, unsubs=0
[2022-10-21 18:27:13.719][Trace][37079][0q722j46] TCP: disposing #0 resource(RtmpConn)(0x7ffff0058380), conns=1, disposing=1, zombies=0
[2022-10-21 18:27:18.319][Trace][37079][030c55ll] Hybrid cpu=2.00%,18MB, cid=2,1, timer=62,0,0, clock=0,47,1,0,0,0,0,0,0, free=1, objs=(pkt:0,raw:0,fua:0,msg:1,oth:0,buf:0)
[2022-10-21 18:27:18.470][Trace][37079][08w26761] Process: cpu=1.00%,18MB, threads=2
[2022-10-21 18:27:23.320][Trace][37079][030c55ll] Hybrid cpu=1.00%,18MB, cid=2,1, timer=62,0,0, clock=0,47,1,0,0,0,0,0,0, free=1, objs=(pkt:0,raw:0,fua:0,msg:1,oth:0,buf:0)
[2022-10-21 18:27:23.476][Trace][37079][08w26761] Process: cpu=0.00%,18MB, threads=2
[2022-10-21 18:27:23.901][Trace][37079][0t95647z] RTMP client ip=192.168.1.104:9478, fd=14, trace=, span=
[2022-10-21 18:27:23.903][Trace][37079][0t95647z] simple handshake success.
[2022-10-21 18:27:23.904][Trace][37079][0t95647z] connect app, tcUrl=rtmp://192.168.1.221:1935/live, pageUrl=, swfUrl=rtmp://192.168.1.221:1935/live, schema=rtmp, vhost=192.168.1.221, port=1935, app=live, args=null
[2022-10-21 18:27:23.904][Trace][37079][0t95647z] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=4096, out.chunk=128
[2022-10-21 18:27:23.946][Trace][37079][0t95647z] client identified, type=fmle-publish, vhost=192.168.1.221, app=live, stream=testjj, param=?ts=1791216000&sign=266fd9485c7e9b098af3eb9cea968dee, duration=0ms
[2022-10-21 18:27:23.946][Trace][37079][0t95647z] connected stream, tcUrl=rtmp://192.168.1.221:1935/live, pageUrl=, swfUrl=rtmp://192.168.1.221:1935/live, schema=rtmp, vhost=__defaultVhost__, port=1935, app=live, stream=testjj, param=?ts=1791216000&sign=266fd9485c7e9b098af3eb9cea968dee, args=null
[2022-10-21 18:27:23.946][Trace][37079][0t95647z] source url=/live/testjj, ip=192.168.1.104, cache=1, is_edge=0, source_id=/
[2022-10-21 18:27:24.040][Trace][37079][0t95647z] TCP: before dispose resource(RtmpConn)(0x7ffff0058380), conns=1, zombies=0, ign=0, inz=0, ind=0
[2022-10-21 18:27:24.040][Error][37079][0t95647z][0] serve error code=3008(HttpResponseData)(HTTP response data invalid) : service cycle : rtmp: stream service : rtmp: callback on publish : rtmp on_publish http://192.168.1.104:8090/api/srs/on/push/callback : http: on_publish failed, client_id=0t95647z, url=http://192.168.1.104:8090/api/srs/on/push/callback, request={"server_id":"vid-o154223","action":"on_publish","client_id":"0t95647z","ip":"192.168.1.104","vhost":"__defaultVhost__","app":"live","tcUrl":"rtmp://192.168.1.221:1935/live","stream":"testjj","param":"?ts=1791216000&sign=266fd9485c7e9b098af3eb9cea968dee","stream_url":"/live/testjj","stream_id":"vid-21w91p4"}, response=0, code=200 : http: response number code 0
thread [37079][0t95647z]: do_cycle() [src/app/srs_app_rtmp_conn.cpp:248][errno=0]
thread [37079][0t95647z]: service_cycle() [src/app/srs_app_rtmp_conn.cpp:440][errno=0]
thread [37079][0t95647z]: publishing() [src/app/srs_app_rtmp_conn.cpp:910][errno=0]
thread [37079][0t95647z]: http_hooks_on_publish() [src/app/srs_app_rtmp_conn.cpp:1423][errno=0]
thread [37079][0t95647z]: on_publish() [src/app/srs_app_http_hooks.cpp:153][errno=0]
thread [37079][0t95647z]: do_post() [src/app/srs_app_http_hooks.cpp:647][errno=0]
[2022-10-21 18:27:24.040][Trace][37079][o0w60af5] TCP: clear zombies=1 resources, conns=1, removing=0, unsubs=0
- SRS Config:
# SRS Reference Configuration
listen 1935;
max_connections 1000;
# srs_log_tank file;
# srs_log_file ./objs/srs.log;
daemon off;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
# Enable HTTPS support, and open port 8088
# https {
# enabled on;
# listen 8088;
# key ./conf/woniu.key;
# cert ./conf/woniu.crt;
# }
}
rtc_server {
enabled on;
listen 8000; # UDP port
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
candidate $CANDIDATE;
}
vhost __defaultVhost__ {
tcp_nodelay on;
min_latency on;
play {
gop_cache on;
queue_length 0;
mw_latency 0;
mw_msgs 1;
}
publish {
mr off;
}
# HTTP-FLV settings
http_remux{
enabled on;
mount [vhost]/[app]/[stream].flv;
hstrs on;
}
# HLS settings
hls {
enabled on;
hls_fragment 1;
hls_window 2;
hls_path ./objs/nginx/html;
hls_m3u8_file [app]/[stream].m3u8;
hls_ts_file [app]/[stream]-[seq].ts;
}
# DVR settings
dvr {
enabled off;
dvr_path ./objs/nginx/html/[app]/[stream]/[2006]/[01]/[02]/[timestamp].flv;
dvr_plan segment;
dvr_duration 30;
dvr_wait_keyframe on;
}
# RTC settings
rtc {
enabled on;
rtmp_to_rtc on;
keep_bframe discard;
rtc_to_rtmp on;
}
# SRS supports referer anti-leeching: check where the user is coming from. For example, people who are not coming from the company's website are not allowed to view.
refer {
# whether enable the refer hotlink-denial.
# default: off.
enabled off;
# the common refer for play and publish.
# if the page url of client not in the refer, access denied.
# if not specified this field, allow all.
# default: not specified.
all github.com github.io;
# refer for publish clients specified.
# the common refer is not overrided by this.
# if not specified this field, allow all.
# default: not specified.
publish github.com github.io;
# refer for play clients specified.
# the common refer is not overrided by this.
# if not specified this field, allow all.
# default: not specified.
play github.com github.io;
}
# HTTP callback
http_hooks {
# Event: When this event occurs, the specified HTTP address will be called back.
# HTTP address: Multiple addresses are supported, separated by spaces. SRS will sequentially call these interfaces.
# Data: SRS will POST data to the HTTP interface.
# Return value: SRS requires the HTTP server to return HTTP 200 and the response content to be an integer error code (0 indicates success). Other error codes will disconnect the client connection.
# whether the http hooks enable.
# default off.
enabled on;
# When the client connects to the specified vhost and app.
#on_connect http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients;
# When the client closes the connection, or when SRS actively closes the connection.
#on_close http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients;
# When the client publishes a stream, for example, pushing the stream to the server using flash/FMLE.
on_publish http://192.168.1.104:8090/api/srs/on/push/callback;
# When the client stops publishing the stream.
on_unpublish http://192.168.1.104:8090/api/srs/un/push/callback;
# When the client starts playing the stream.
#on_play http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
# When the client stops playing. Note: Stopping playback may not close the connection and can still continue playing.
#on_stop http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
# When the DVR recording closes an flv file.
#on_dvr http://127.0.0.1:8085/api/v1/dvrs http://localhost:8085/api/v1/dvrs;
# When HLS generates a ts file.
#on_hls http://127.0.0.1:8085/api/v1/hls http://localhost:8085/api/v1/hls;
# when srs reap a ts file of hls, call this hook,
#on_hls_notify http://127.0.0.1:8085/api/v1/hls/[app]/[stream]/[ts_url][param];
}
}
Replay (重现)
Please describe how to replay the bug? (重现Bug的步骤)
- Use docker to build the Dockerfile with the following content.
FROM ossrs/srs:dev AS build
# Install depends tools.
#RUN yum install -y gcc make gcc-c++ patch unzip perl git
# Build and install SRS.
COPY . /srs
WORKDIR /srs/trunk
RUN ./configure --srt=on --jobs=2 && make -j2 && make install
# All config files for SRS.
RUN cp -R conf /usr/local/srs/conf && \
cp research/api-server/static-dir/index.html /usr/local/srs/objs/nginx/html/ && \
cp research/api-server/static-dir/favicon.ico /usr/local/srs/objs/nginx/html/ && \
cp research/players/crossdomain.xml /usr/local/srs/objs/nginx/html/ && \
cp -R research/console /usr/local/srs/objs/nginx/html/ && \
cp -R research/players /usr/local/srs/objs/nginx/html/ && \
cp -R 3rdparty/signaling/www/demos /usr/local/srs/objs/nginx/html/
############################################################
# dist
############################################################
FROM centos:7 AS dist
# Expose ports for streaming @see https://github.com/ossrs/srs#ports
EXPOSE 1935 1985 8080 8000/udp 10080/udp
# FFMPEG 4.1
COPY --from=build /usr/local/bin/ffmpeg /usr/local/srs/objs/ffmpeg/bin/ffmpeg
# SRS binary, config files and srs-console.
COPY --from=build /usr/local/srs /usr/local/srs
# Default workdir and command.
WORKDIR /usr/local/srs
CMD ["./objs/srs", "-c", "conf/docker.conf"]
- Open the http_hooks feature to reproduce it.
Expect (Expected Behavior)
Please describe your expectation:
- http_hooks should work properly.
I don't know why the value of SRS_HTTP_RESPONSE_OK is 'E'.
TRANS_BY_GPT3