harlanc / xiu

A simple,high performance and secure live media server in pure Rust (RTMP[cluster]/RTSP/WebRTC[whip/whep]/HTTP-FLV/HLS).🦀
https://www.rustxiu.com
MIT License
1.61k stars 168 forks source link

thread 'tokio-runtime-worker' panicked at 'attempt to subtract with overflow' #17

Closed raptpz closed 1 year ago

raptpz commented 2 years ago

I've configured xiu with a simple RTMP server: [rtmp] enabled = true port = 1935

I then publish a sample RTMP stream with ffmpeg: ffmpeg -re -stream_loop -1 -i sample_video.mp4 -vcodec libx264 -acodec aac -f flv rtmp://127.0.0.1:1935/live/test

When the input stream is stopped, I got the following error on xiu server:

thread 'tokio-runtime-worker' panicked at 'attempt to subtract with overflow', C:\Users\Administrator.cargo\registry\src\github.com-1ecc6299db9ec823\rtmp-0.0.1 0\src\chunk\unpacketizer.rs:422:25

Is there a way to avoid it ?

Notes:

harlanc commented 2 years ago

Thanks for your report, can the problem be reproduced stably or it happens randomly?

raptpz commented 2 years ago

Thank you for your reply, it can be reproduced stably. Let me know if you needed further details on the issue, or if you can reproduce too

harlanc commented 2 years ago

@raptpz I did some fix , try the latest xiu version v0.0.10. Thanks.

raptpz commented 2 years ago

I tried v0.0.10 and I confirm that now the behaviour is correct: the stream session closure is correctly handled Thank you very moch, best regards

raptpz commented 2 years ago

Today, after several hours of "live" streaming in the same conditions (ffmpeg as source of streaming), when I stopped the ffmpeg input stream, I got a similar panich error in "xiu v0.0.10" executable: "thread 'tokio-runtime-worker' panicked at 'attempt to add with overflow'" (note: this time the error was with "add" instead of "subtract")

I will try to reproduce it, since it seems to happen only after several hours of streaming: with few minutes of streaming no more issue, Do you want to open a new issue or keep this re-opened?

harlanc commented 2 years ago

Just keep this issue re-opened,do you record the detailed stack info about the add overflow?Thanks.

raptpz commented 2 years ago

I will keep it running until I get the issue again and then publish here Thank you

harlanc commented 1 year ago

just close this issue since the problem cannot be reproduced...