Fix #114342: Crash when opening too many movies at once #114381

Merged
Richard Antalik merged 2 commits from iss/blender:114342 into blender-v4.0-release 2023-11-03 02:01:24 +01:00

Adding strips or changing filepaths caused that movie files were loaded,
but memory was only released after new frame was rendered. Since FFmpeg
can take a lot of memory per strip, this can cause crash.

Free memory for each strip immediately after it is not needed after
these operations.

Adding strips or changing filepaths caused that movie files were loaded, but memory was only released after new frame was rendered. Since FFmpeg can take a lot of memory per strip, this can cause crash. Free memory for each strip immediately after it is not needed after these operations.
Richard Antalik added 1 commit 2023-11-01 22:03:13 +01:00
buildbot/vexp-code-patch-coordinator Build done. Details
edf0d55a7b
Fix #114342: Crash when opening too many movies at once
Adding strips or changing filepaths caused that movie files were loaded,
but memory was only released after new frame was rendered. Since FFmpeg
can take a lot of memory per strip, this can cause crash.

Free memory for each strip immediately after it is not needed after
these operations.
Richard Antalik requested review from Sergey Sharybin 2023-11-01 22:03:24 +01:00
Richard Antalik requested review from Bastien Montagne 2023-11-01 22:07:33 +01:00
Bastien Montagne reviewed 2023-11-02 09:50:58 +01:00
Bastien Montagne left a comment
Owner

Fix makes sense to me, wondering though if there should not be a check for cfra, to avoid freeing the anim data when the sequence intersects with it?

At some point we'll have to find a way to cache and manage data in anim in a better way, like we already do with the ImBuf - though this is likely way more tricky since it would have to deal with big unknown like the FFMPEG context...

Fix makes sense to me, wondering though if there should not be a check for `cfra`, to avoid freeing the `anim` data when the sequence intersects with it? At some point we'll have to find a way to cache and manage data in `anim` in a better way, like we already do with the `ImBuf` - though this is likely way more tricky since it would have to deal with big unknown like the FFMPEG context...
@ -627,2 +629,4 @@
seq->len = 0;
}
/* Prevent high memory usage when adding many files at once. */

when reloading many files at once

`when reloading many files at once`

Checking for cfra is not fully enough. You can have multiple videos stacked on top of each others, with OVERRIDE blending. In this case you'd only want to keep the top-most anim in memory.

I don't really think it will be THAT bad to free anim on open/reload, don't think it is that slow. It is also not something you do often. So feels like we'd better first land simple solution, unlock some people in the studio, and look into further improvements as a follow up development.

Checking for `cfra` is not fully enough. You can have multiple videos stacked on top of each others, with OVERRIDE blending. In this case you'd only want to keep the top-most `anim` in memory. I don't really think it will be THAT bad to free anim on open/reload, don't think it is that slow. It is also not something you do often. So feels like we'd better first land simple solution, unlock some people in the studio, and look into further improvements as a follow up development.

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR114381) when ready.

Checking for cfra is not fully enough. You can have multiple videos stacked on top of each others, with OVERRIDE blending. In this case you'd only want to keep the top-most anim in memory.

I don't really think it will be THAT bad to free anim on open/reload, don't think it is that slow. It is also not something you do often. So feels like we'd better first land simple solution, unlock some people in the studio, and look into further improvements as a follow up development.

OKI then doing build to confirm it works for the studio TD.

> Checking for `cfra` is not fully enough. You can have multiple videos stacked on top of each others, with OVERRIDE blending. In this case you'd only want to keep the top-most `anim` in memory. > > I don't really think it will be THAT bad to free anim on open/reload, don't think it is that slow. It is also not something you do often. So feels like we'd better first land simple solution, unlock some people in the studio, and look into further improvements as a follow up development. OKI then doing build to confirm it works for the studio TD.
Bastien Montagne approved these changes 2023-11-02 14:25:09 +01:00
Bastien Montagne left a comment
Owner

Fix works fine here at studio, so LGTM.

Fix works fine here at studio, so LGTM.
Sergey Sharybin approved these changes 2023-11-02 14:27:34 +01:00
Sergey Sharybin left a comment
Owner

The comment still needs to be updated it seems, but there is no need in extra review iteration.

The comment still needs to be updated it seems, but there is no need in extra review iteration.
Richard Antalik added 1 commit 2023-11-03 01:59:14 +01:00
Richard Antalik merged commit 5d765a0d31 into blender-v4.0-release 2023-11-03 02:01:24 +01:00
Richard Antalik deleted branch 114342 2023-11-03 02:01:29 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#114381
No description provided.