ossrs / oryx

Oryx(SRS Stack) is an all-in-one, out-of-the-box, and open-source video solution for creating online video services, including live streaming and WebRTC, on the cloud or through self-hosting.
https://ossrs.io/oryx
MIT License
517 stars 110 forks source link

After many hours of recording Oryx writes files in the wrong directory and stops working as intended #197

Open p4xx07 opened 3 months ago

p4xx07 commented 3 months ago

Describe the bug

The issue I have been having is that if I record multiple streams for more than 10 hours with a docker with 4GB of ram, Oryx will start writing ts files in the wrong positions in the filesystem, so I'm guessing that redis gets filled up and oryx can't keep track of what he is supposed to do. Oryx will also stop working and won't come back up. If you have any thoughts on how to solve this it would be great. I'm hoping that outsourcing redis from the docker will fix this issue.

Version v5.14.19

To Reproduce Stream with recording ON. After many hours (I tried with 10 hours) ts get saved under data/record instead of data/record/record_id. Oryx stops working as intended and will crash. My docker had 4GB of ram.

Expected behavior Oryx should continue to write to the write directory and not crash.

Screenshots I want to include some screenshots of the ts in the wrong directory. Also the ts have the same creation date which is very strange since the ts save interval is of 10s

image

Additional context Maybe there is some way to save less information on redis? Is it necessary to save all information about the ts? I'm guessing only the ID is needed to create the playlist to generate the MP4 file. Maybe there is a more memory efficient way of creating this MP4 image

winlinvip commented 3 months ago

I think it's not caused by redis, but the temporary HLS files for record.

See https://github.com/orgs/ossrs/projects/2/views/4?pane=issue&itemId=45110940 Record use HLS as temporary files, but still keep it after convert to MP4 file. So we can improve this by removing the HLS files after converted to MP4.

See https://github.com/orgs/ossrs/projects/2/views/4?pane=issue&itemId=38782310 We should support limit the max duration of recording, so we could cleanup the temporary files ASAP.

Allan-Nava commented 2 months ago

I think it's not caused by redis, but the temporary HLS files for record.

See https://github.com/orgs/ossrs/projects/2/views/4?pane=issue&itemId=45110940 Record use HLS as temporary files, but still keep it after convert to MP4 file. So we can improve this by removing the HLS files after converted to MP4.

See https://github.com/orgs/ossrs/projects/2/views/4?pane=issue&itemId=38782310 We should support limit the max duration of recording, so we could cleanup the temporary files ASAP.

@p4xx07 what do you think about these solutions?