-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
HLS: Crash when publishing and reloading simultenously #3773
Comments
First push the stream, then change hls_ctx, then reload, it will crash.
|
ok, i will check it as soon as possible |
My reproduction steps:
srs.conf.ctx_off
./objs/srs -c conf/srs.conf
// handle the dvrs requests: on_hls stream.
http.HandleFunc("/api/v1/hls", func(w http.ResponseWriter, r *http.Request) {
if r.Method != "POST" {
SrsWriteDataResponse(w, struct{}{})
return
}
if err := func() error {
body, err := ioutil.ReadAll(r.Body)
if err != nil {
return fmt.Errorf("read request body, err %v", err)
}
log.Println(fmt.Sprintf("post to hls, req=%v", string(body)))
msg := &SrsHlsRequest{}
if err := json.Unmarshal(body, msg); err != nil {
return fmt.Errorf("parse message from %v, err %v", string(body), err)
}
log.Println(fmt.Sprintf("Got %v", msg.String()))
time.Sleep(10 * time.Second)
log.Println("after sleep")
if !msg.IsOnHls() {
return fmt.Errorf("invalid message %v", msg.String())
}
SrsWriteDataResponse(w, &SrsCommonResponse{Code: 0})
return nil
}(); err != nil {
SrsWriteErrorResponse(w, err)
}
})
cd research/api-server
go run server.go
ffmpeg -stream_loop -1 -re -i doc/source.200kbps.768x320.flv -c copy -f flv "rtmp://127.0.0.1/live/livestream"
#!/bin/bash
i=1
cur_pid=$(pgrep "srs")
while [ $i -le 1000000 ]
do
let i++
echo "$i"
sleep 10
cp conf/srs.conf.ctx_on conf/srs.conf
kill -1 $cur_pid
pid=$(pgrep "srs")
echo $(date +%T)" reload signo, srs pid=$pid"
sleep 10
cp conf/srs.conf.ctx_off conf/srs.conf
kill -1 $cur_pid
pid=$(pgrep "srs")
echo $(date +%T)" reload signo, srs pid=$pid"
done
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Please description your issue here
SRS Version: 5.0.170
SRS Log:
Replay
Please describe how to replay the bug?
Step 1: Run SRS, with HLS and on_hls callback.
Step 2: Set
hls_ctx on;
and publish stream.Step 3: Set the field
hls_ctx off;
and reload SRS.Crashed.
In on_hls, sleep 60s to simulate slow API server.
Expect
No crash.
The text was updated successfully, but these errors were encountered: