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

[FreeBSD] Out of memory error on Queue::write_texture on high resolution pictures #6468

Open
Canvis-Me opened this issue Oct 26, 2024 · 3 comments
Labels
api: vulkan Issues with Vulkan type: bug Something isn't working

Comments

@Canvis-Me
Copy link

Canvis-Me commented Oct 26, 2024

Description
Program simp panic when open high resolution pictures,
such as 8736x11658px.

Repro steps

  • Git clone simp and build with cargo build --no-default-features --features=gtk3
  • simp xxx.png
  • simp panic

Expected vs observed behavior
simp open high resolution pictures normally.

Extra materials

panic.txt
   0: simp::main::{{closure}}
             at /usr/home/canvis/Downloads/simp/src/main.rs:448:25
   1: std::panicking::rust_panic_with_hook
   2: std::panicking::begin_panic_handler::{{closure}}
   3: std::sys::backtrace::__rust_end_short_backtrace
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: wgpu::backend::wgpu_core::default_error_handler
             at /home/canvis/.cargo/registry/src/mirrors.ustc.edu.cn-4affec411d11e50f/wgpu-22.1.0/src/backend/wgpu_core.rs:3411:5
   7: core::ops::function::Fn::call
             at /rustc/f54dd915b0a4345ee06fd561416ad1af08b54dbb/library/core/src/ops/function.rs:79:5
   8: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
             at /rustc/f54dd915b0a4345ee06fd561416ad1af08b54dbb/library/alloc/src/boxed.rs:2084:9
   9: wgpu::backend::wgpu_core::ErrorSinkRaw::handle_error
             at /home/canvis/.cargo/registry/src/mirrors.ustc.edu.cn-4affec411d11e50f/wgpu-22.1.0/src/backend/wgpu_core.rs:3397:17
  10: wgpu::backend::wgpu_core::ContextWgpuCore::handle_error
  11: wgpu::backend::wgpu_core::ContextWgpuCore::handle_error_nolabel
             at /home/canvis/.cargo/registry/src/mirrors.ustc.edu.cn-4affec411d11e50f/wgpu-22.1.0/src/backend/wgpu_core.rs:308:9
  12: <wgpu::backend::wgpu_core::ContextWgpuCore as wgpu::context::Context>::queue_write_texture
             at /home/canvis/.cargo/registry/src/mirrors.ustc.edu.cn-4affec411d11e50f/wgpu-22.1.0/src/backend/wgpu_core.rs:2272:22
  13: <T as wgpu::context::DynContext>::queue_write_texture
             at /home/canvis/.cargo/registry/src/mirrors.ustc.edu.cn-4affec411d11e50f/wgpu-22.1.0/src/context.rs:3032:9
  14: wgpu::Queue::write_texture
             at /home/canvis/.cargo/registry/src/mirrors.ustc.edu.cn-4affec411d11e50f/wgpu-22.1.0/src/lib.rs:5499:9
  15: simp::app::image_view::texture::Texture::from_image
             at /usr/home/canvis/Downloads/simp/src/app/image_view/texture.rs:73:9
  16: simp::app::image_view::mosaic::Mosaic::from_images
             at /usr/home/canvis/Downloads/simp/src/app/image_view/mosaic.rs:69:25
  17: simp::app::image_view::ImageView::new
             at /usr/home/canvis/Downloads/simp/src/app/image_view.rs:58:22
  18: simp::app::App::handle_output
             at /usr/home/canvis/Downloads/simp/src/app.rs:118:37
  19: simp::app::App::handle_user_event
             at /usr/home/canvis/Downloads/simp/src/app.rs:353:21
  20: simp::WindowHandler::main_loop::{{closure}}
             at /usr/home/canvis/Downloads/simp/src/main.rs:432:44
  21: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /rustc/f54dd915b0a4345ee06fd561416ad1af08b54dbb/library/core/src/ops/function.rs:294:13
  22: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /rustc/f54dd915b0a4345ee06fd561416ad1af08b54dbb/library/core/src/ops/function.rs:294:13
  23: winit::platform_impl::linux::wayland::event_loop::EventLoop<T>::single_iteration
             at /home/canvis/.cargo/registry/src/mirrors.ustc.edu.cn-4affec411d11e50f/winit-0.30.5/src/platform_impl/linux/wayland/event_loop/mod.rs:323:13
  24: winit::platform_impl::linux::wayland::event_loop::EventLoop<T>::poll_events_with_timeout
             at /home/canvis/.cargo/registry/src/mirrors.ustc.edu.cn-4affec411d11e50f/winit-0.30.5/src/platform_impl/linux/wayland/event_loop/mod.rs:295:9
  25: winit::platform_impl::linux::wayland::event_loop::EventLoop<T>::pump_events
             at /home/canvis/.cargo/registry/src/mirrors.ustc.edu.cn-4affec411d11e50f/winit-0.30.5/src/platform_impl/linux/wayland/event_loop/mod.rs:217:13
  26: winit::platform_impl::linux::wayland::event_loop::EventLoop<T>::run_on_demand
             at /home/canvis/.cargo/registry/src/mirrors.ustc.edu.cn-4affec411d11e50f/winit-0.30.5/src/platform_impl/linux/wayland/event_loop/mod.rs:181:19
  27: winit::platform_impl::linux::EventLoop<T>::run_on_demand
             at /home/canvis/.cargo/registry/src/mirrors.ustc.edu.cn-4affec411d11e50f/winit-0.30.5/src/platform_impl/linux/mod.rs:813:56

panicked at /home/canvis/.cargo/registry/src/mirrors.ustc.edu.cn-4affec411d11e50f/wgpu-22.1.0/src/backend/wgpu_core.rs:3411:5:
wgpu error: Validation Error

Caused by:
  In Queue::write_texture
    Not enough memory left.

Tested on both Ubuntu and Windows 11, simp works fine.

Platform
FreeBSD 14.1-RELEASE-p5 with latest ports
wgpu-22.1.0
The wm is sway with vulkan enabled and pure wayland.

@Wumpf
Copy link
Member

Wumpf commented Oct 27, 2024

I don't think there's much to do here - apparently you ran out of memory:

Caused by:
  In Queue::write_texture
    Not enough memory left.

If you don't want this to panic and instead to fail recoverably, you have to install an error scope.

If you think there is no way this should run out of vram we'll of course reopen the issue!
(Such a texture would be about 389MiB, but you probably need at least double that to account for for upload buffer that write_texture has to manage which are subject to padding restrictions.)

@Wumpf Wumpf closed this as not planned Won't fix, can't repro, duplicate, stale Oct 27, 2024
@Canvis-Me
Copy link
Author

It's not probably running out of vram. When all other programs except sway and terminal emulator closed, simp still panic to open high resolution pictures based on a 92MiB/8192MiB usage of Nvidia 3060ti.
So I guess it would be a wgpu/freebsd problem, since there is no such crash on Linux/Windows.

@Wumpf Wumpf reopened this Oct 28, 2024
@Wumpf Wumpf added type: bug Something isn't working api: vulkan Issues with Vulkan labels Oct 28, 2024
@Wumpf
Copy link
Member

Wumpf commented Oct 28, 2024

Technically FreeBSD isn't one of the supported platforms but let's leave it open anyways for reference

@Wumpf Wumpf changed the title Panic when open high resolution pictures on FreeBSD Out of memory error when doing write_texture on high resolution pictures on FreeBSD Oct 28, 2024
@Wumpf Wumpf changed the title Out of memory error when doing write_texture on high resolution pictures on FreeBSD Out of memory error on Queue::write_texture on high resolution pictures on FreeBSD Oct 28, 2024
@Wumpf Wumpf changed the title Out of memory error on Queue::write_texture on high resolution pictures on FreeBSD [FreeBSD] Out of memory error on Queue::write_texture on high resolution pictures Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vulkan Issues with Vulkan type: bug Something isn't working
Projects
Status: In Progress
Development

No branches or pull requests

2 participants