ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
15.09k stars 777 forks source link

Huge GPU memory leak on https://honking.be/pown/?swf=24909&hide=1 #16889

Open Tele3000 opened 1 week ago

Tele3000 commented 1 week ago

Describe what you were doing

bug-report-ruffle 350p.webm

What does the crash message say?

Error Info

Error name: Error Error message: panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.21.0/src/gles/device.rs:775:52: called Result::unwrap() on an Err value: "Unable to create texture object" Error stack:

Error: panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.21.0/src/gles/device.rs:775:52:
called `Result::unwrap()` on an `Err` value: "Unable to create texture object"
    at n.wbg.__wbg_new_28c511d9baebfa89 (https://honking.be/script/core.ruffle.8413c1e69e2f0e8b03a2.js:1:79048)
    at ruffle_web.wasm.js_sys::Error::new::h4d90f277f68d570d (wasm://wasm/ruffle_web.wasm-033421f6:wasm-function[12880]:0x9e0531)
    at ruffle_web.wasm.core::ops::function::FnOnce::call_once{{vtable.shim}}::h55ede6a173052926 (wasm://wasm/ruffle_web.wasm-033421f6:wasm-function[9897]:0x975e00)
    at ruffle_web.wasm.std::panicking::rust_panic_with_hook::h6731baa78621a747 (wasm://wasm/ruffle_web.wasm-033421f6:wasm-function[6556]:0x86904b)
    at ruffle_web.wasm.core::panicking::panic_fmt::h5c7ce52813e94bcd (wasm://wasm/ruffle_web.wasm-033421f6:wasm-function[10329]:0x9a05b6)
    at ruffle_web.wasm.core::result::unwrap_failed::h4ed86702351a3017 (wasm://wasm/ruffle_web.wasm-033421f6:wasm-function[8150]:0x8f33a8)
    at ruffle_web.wasm.<T as wgpu::context::DynContext>::device_create_texture::hb3630b8f8cff77fb (wasm://wasm/ruffle_web.wasm-033421f6:wasm-function[7563]:0x8b5594)
    at ruffle_web.wasm.wgpu::Device::create_texture::hff7c3ba2959bf2d1 (wasm://wasm/ruffle_web.wasm-033421f6:wasm-function[5988]:0x834d1c)
    at ruffle_web.wasm.<ruffle_render_wgpu::backend::WgpuRenderBackend<T> as ruffle_render::backend::RenderBackend>::create_empty_texture::h3ae30ea2c89f8b96 (wasm://wasm/ruffle_web.wasm-033421f6:wasm-function[5746]:0x81e5ec)
    at ruffle_web.wasm.ruffle_core::display_object::render_base::h4c793588a7af8d9a (wasm://wasm/ruffle_web.wasm-033421f6:wasm-function[809]:0x161fd6)

Player Info

Allows script access: true Renderer: wgpu Adapter Backend: Gl Adapter Name: "ANGLE (NVIDIA, NVIDIA GeForce GTX 1080 (0x00001B80) Direct3D11 vs_5_0 ps_5_0, D3D11)" Adapter Device Type: Other Adapter Driver Name: "WebGL 2.0 (OpenGL ES" Adapter Driver Info: "3.0 Chromium)" Enabled features: Features(TEXTURE_COMPRESSION_BC | FLOAT32_FILTERABLE | TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES | SHADER_UNUSED_VERTEX_OUTPUT) Available features: Features(DEPTH32FLOAT_STENCIL8 | PUSH_CONSTANTS | CLEAR_TEXTURE | MULTIVIEW) Current limits: Limits { max_texture_dimension_1d: 16384, max_texture_dimension_2d: 16384, max_texture_dimension_3d: 2048, max_texture_array_layers: 256, max_bind_groups: 4, max_bindings_per_bind_group: 1000, max_dynamic_uniform_buffers_per_pipeline_layout: 8, max_dynamic_storage_buffers_per_pipeline_layout: 0, max_sampled_textures_per_shader_stage: 16, max_samplers_per_shader_stage: 16, max_storage_buffers_per_shader_stage: 0, max_storage_textures_per_shader_stage: 0, max_uniform_buffers_per_shader_stage: 11, max_uniform_buffer_binding_size: 65536, max_storage_buffer_binding_size: 0, max_vertex_buffers: 8, max_buffer_size: 268435456, max_vertex_attributes: 16, max_vertex_buffer_array_stride: 255, min_uniform_buffer_offset_alignment: 256, min_storage_buffer_offset_alignment: 256, max_inter_stage_shader_components: 120, max_color_attachments: 8, max_color_attachment_bytes_per_sample: 32, max_compute_workgroup_storage_size: 0, max_compute_invocations_per_workgroup: 0, max_compute_workgroup_size_x: 0, max_compute_workgroup_size_y: 0, max_compute_workgroup_size_z: 0, max_compute_workgroups_per_dimension: 0, min_subgroup_size: 0, max_subgroup_size: 0, max_push_constant_size: 0, max_non_sampler_bindings: 1000000 } Surface quality: high Surface samples: 4 Surface size: (550, 400, 1)

Page Info

Page URL: https://honking.be/pown/?swf=24909&hide=1 SWF URL: https://honking.be/pown/flash/24909.swf

Browser Info

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Platform: Win32 Has touch support: false

Ruffle Info

Version: 0.1.0 Name: nightly 2024-06-25 Channel: nightly Built: 2024-06-25T00:05:32.860Z Commit: e83e39ad27aacde29583d51ed0ad234de4f370ef Is extension: false

Metadata

width: 600 height: 489 frameRate: 24 numFrames: 10 swfVersion: 11 backgroundColor: #FFFFFF isActionScript3: true uncompressedLength: 3129452

Ruffle Version

nightly 2024-06-25

Affected platform

Self-hosted version

Operating system

Windows 10

Additional information

Video timecodes: 0:00 - Test on Firefox browser=memory leak then crash 1:10 - Test on Chrome browser=memory leak then crash 1:35 - Test on Ruffle program=memory leak then I shutdown it before crash 2:20 - Test on Adobe Flash Player 21.0 r0 program=no issue

Sorry for the bad quality, was limited to 10Mb only, but I guess you can see the issue anyway. I stopped the Ruffle program before the crash because behaviour seems random, on 4 tests I got either permanent huge graphic issue (sometimes very different than in the video), simple crash like for the browser with an error message staying not enough memory or during my previous recording ; my whole computer became unresponsive with a blinking backlight on a blackscreen for both of my monitors, I had to hit the reset button even alt-f4 was doing nothing, I was still hearing the music though.

I found this problem while looking at my rheobus, I noticed the huge memory usage, then understood what was happening. I also tested on 2 other builds I had: ruffle-nightly-2023_10_02-web-selfhost ed and ruffle-nightly-2021_07_07-web-selfhosted, same behaviour. I also tested this same file on another computer, same behaviour. The Ruffle program is the last one: nightly 2024-06-25.

I know there is many "not enough memory" report here already, but I tested by myself a dozen of the swf reported on Github, none of them have the same behaviour as this one for me. I don't report each time I found a bug or crash, but this one looks harmful.

I attach the swf here to this report in a zip file. 24909.zip

Tele3000 commented 1 week ago

Just to provide a little more info: I tested at my work with many other computers, the memory leak happens all the time, but the final crash only happens on Nvidia GPU, with Intel 630 HD Graphics, we noticed the GPU RAM goes to half then it seems to throttle somehow, the animation is hugely slowed down but no crash.

torokati44 commented 1 week ago

I'd be interested whether having merged https://github.com/ruffle-rs/ruffle/pull/16786 (which includes https://github.com/gfx-rs/wgpu/pull/5141) improved this at all.