Skip to content
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

Crash on record processing (Memory leak) #20114

Open
SavchenkoVV opened this issue Apr 30, 2024 · 4 comments
Open

Crash on record processing (Memory leak) #20114

SavchenkoVV opened this issue Apr 30, 2024 · 4 comments

Comments

@SavchenkoVV
Copy link

BBB 2.7.3 (docker)

Describe the bug
When processing one custom record ffmpeg crashes with OutOfMemory. It eat 8GB of memory
BBB 2.7.3 (docker)

To Reproduce
Problem only with one custom record processing (reproduced via --rebuild command).

Expected behavior
Record processed successfully

Actual behavior
Record processing crashed

Log

recordings-1        | I, [2024-04-29T19:16:40.174214 #698]  INFO -- : Executing: ffmpeg -y -v warning -nostats -nostdin -max_error_rate 1.0 -vsync vfr -noaccurate_seek -ss 0.000 -itsoffset 0.000 -i /var/bigbluebutton/recording/raw/<recordid>/deskshare/83937-1714298633135.webm -filter_complex \[0:v:0\]scale\=w\=1280:h\=720:force_original_aspect_ratio\=decrease,setsar\=1,pad\=w\=1280:h\=720:x\=-1:y\=-1:color\=white,trim\=end\=1872.860:end_frame\=1\[out\] -map \[out\] -enc_time_base -1 -c:v rawvideo -f nut pipe:11
recordings-1        | D, [2024-04-29T19:16:40.175130 #698] DEBUG -- : preprocessing ffmpeg command pid 762
recordings-1        | D, [2024-04-29T19:16:40.175307 #698] DEBUG -- :   ffmpeg filter_complex_script:
recordings-1        | I, [2024-04-29T19:16:40.175780 #698]  INFO -- : Executing: ffmpeg -y -v warning -nostats -max_error_rate 1.0 -copyts -f lavfi -i color\=c\=white:s\=1280x720:r\=5 -f nut -i pipe:10 -filter_complex_script /var/bigbluebutton/recording/process/presentation/<recordid>/deskshare_1.mp4.filter -an -codec libx264 -preset fast -crf 23 -x264opts stitchable\=1 -force_key_frames expr:gte\(t,n_forced\*10\) -pix_fmt yuv420p -r 5 /var/bigbluebutton/recording/process/presentation/<recordid>/deskshare_1.mp4
recordings-1        | D, [2024-04-29T19:17:26.412929 #698] DEBUG -- : ffmpeg command pid 763 SIGKILL (signal 9) (deskshare_1.mp4.log)
recordings-1        | D, [2024-04-29T19:17:28.164926 #698] DEBUG -- : preprocessing ffmpeg command pid 762 exit 255 (deskshare_1.mp4.deskshare_x0_y0.log)
recordings-1        | E, [2024-04-29T19:17:28.202824 #698] ERROR -- : At least one ffmpeg process failed

File deskshare_1.mp4.deskshare_x0_y0.log

av_interleaved_write_frame(): Broken pipe
Error writing trailer of pipe:11: Broken pipe

File deskshare_1.mp4.log

[nut @ 0x55ae651fe440] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)

I think problem with IO.pipes or file 83937-1714298633135.webm. Looks like ffmpeg not understand file(pipe) ended.
I execute this commands manually with replacing "pipe:11" and "pipe:10" to tmp file name - it processed ok. Used max 300 mb of memory

@SavchenkoVV
Copy link
Author

SavchenkoVV commented May 1, 2024

Update
Looks like i found reason. Problem not in pipe. When i experimenting with replacing "pipe:11" and "pipe:10" to tmp file name - it was at other machine with ffmpeg version 5.1.3.
Today I copied docker data to machine with more memory and test it.
Last command

 recordings-1        | I, [2024-04-29T19:16:40.175780 #698]  INFO -- : Executing: ffmpeg -y -v warning -nostats -max_error_rate 1.0 -copyts -f lavfi -i color\=c\=white:s\=1280x720:r\=5 -f nut -i pipe:10 -filter_complex_script /var/bigbluebutton/recording/process/presentation/<recordid>/deskshare_1.mp4.filter -an -codec libx264 -preset fast -crf 23 -x264opts stitchable\=1 -force_key_frames expr:gte\(t,n_forced\*10\) -pix_fmt yuv420p -r 5 /var/bigbluebutton/recording/process/presentation/<recordid>/deskshare_1.mp4

crashed with memory limit 6 gb and was success with memory limit 10gb.
Then I used the new docker image debian 12 with ffmpeg version 5.1.4-0+deb12u1. And command was success with 2gb memory limit.

I did benchmark for last command.

ffmpeg version 4.3.6-0+deb11u1
bench: maxrss=10489280kB

ffmpeg version 5.1.4-0+deb12u1
bench: maxrss=435480kB

May be something wrong with new ffmpeg version?
Why memory savings more than 10x?

@antobinary
Copy link
Member

Thanks for the update!
Just to clarify, which ffmpeg version was more reliable?

@SavchenkoVV
Copy link
Author

Thanks for the update! Just to clarify, which ffmpeg version was more reliable?

Yes. So I don’t understand whether ffmpeg version 5.1.4-0+deb12u1 is really optimized or is it just doing something wrong?...

@antobinary
Copy link
Member

On a working non-docker stock BBB 2.7.6 I see:

ffmpeg version 4.2.7-0ubuntu0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants