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

Minimize Window: thread 'main' panicked at 'not enough memory left' #899

Closed
wyhaya opened this issue Nov 20, 2020 · 10 comments
Closed

Minimize Window: thread 'main' panicked at 'not enough memory left' #899

wyhaya opened this issue Nov 20, 2020 · 10 comments
Labels
A-Windowing Platform-agnostic interface layer to run your app in D-Trivial Nice and easy! A great choice to get started with Bevy O-Windows Specific to the Windows desktop operating system P-Crash A sudden unexpected crash S-Duplicate This issue or PR already exists

Comments

@wyhaya
Copy link
Contributor

wyhaya commented Nov 20, 2020

Bevy version

4fecb89

Operating system & version

Windows 10 19041.572

What you did

cargo run --example sprite

Click the Minimize button

What you expected to happen

Minimize Window

What actually happened

I'm sure there's at least 8G of memory available, but the process exit

    Finished dev [unoptimized + debuginfo] target(s) in 0.30s
    Running `target\debug\examples\sprite.exe`

Nov 20 13:53:39.946  WARN wgpu_core::device: Failed to parse shader SPIR-V code: UnsupportedBuiltIn(4)
Nov 20 13:53:39.949  WARN wgpu_core::device: Shader module will not be validated
thread 'main' panicked at 'not enough memory left', C:\Users\...\wgpu-0.6.0\src\backend\direct.rs:1323:35
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\examples\sprite.exe` (exit code: 101)

Additional information

linux and macOS do not have this problem

@Moxinilian Moxinilian added P-Crash A sudden unexpected crash O-Windows Specific to the Windows desktop operating system A-Windowing Platform-agnostic interface layer to run your app in labels Nov 20, 2020
@memoryruins
Copy link
Contributor

Thanks for reporting! This is the same issue as gfx-rs/wgpu-rs#316 in wgpu. Some solutions for dealing with window height of 0 (#170) and minimizing a window were discussed in #545. Leaving this issue open to track window minimizing specifically.

@ubill
Copy link

ubill commented Dec 29, 2020

Same thing too happens for me when I minimize the window.

Ran using
cargo +nightly run --example breakout
(Fast builds configured)

Windows 10, current Bevy master (0.4.0+)

Exact same error as #170 .

thread 'main' panicked at 'not enough memory left', C:\Users\xxxx\.cargo\registry\src\gh.neting.cc-1ecc6299db9ec823\wgpu-0.6.2\src\backend\direct.rs:1355:35
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\examples\breakout.exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)

@cart cart added the D-Trivial Nice and easy! A great choice to get started with Bevy label Jan 1, 2021
@maspe36
Copy link

maspe36 commented Jan 3, 2021

Taking a look at this. Seems like this stems from UB with vulkan that wgpu exposes. There is already a fix merged into wgpu gfx-rs/wgpu#1100. I'm trying out an experimental branch where I'll upgrade to the latest wgpu master branch and see if this issue is fixed.

@cart
Copy link
Member

cart commented Jan 3, 2021

@maspe36 if it works, just be aware that we can't publish git dependencies to crates.io, which means we can't merge pull requests with git dependencies into the bevy repo. We'd need to wait for a new wgpu release

@maspe36
Copy link

maspe36 commented Jan 3, 2021

Yeah good point. It's really less of a fix for this specific issue and more of a WIP branch for the wgpu 0.7 upgrade whenever its released.

@maspe36
Copy link

maspe36 commented Jan 3, 2021

See the changes here #1199

This is part one of fixing this issue, however this cannot be merged until wgpu 0.7 releases. With an upgrade to wgpu, the error is now

wgpu error: Validation Error

Caused by:
    In Device::create_texture
    Dimension X is zero


thread 'main' panicked at 'Handling wgpu errors as fatal by default', C:\Users\Sam\.cargo\git\checkouts\wgpu-rs-40ea39809c03c5d8\3d60546\src\backend\direct.rs:1737:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Jan 03 14:12:40.931 ERROR gpu_descriptor::allocator: `DescriptorAllocator` is dropped while some descriptor sets were not deallocated
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `0`: Allocator dropped before all sets were deallocated', C:\Users\Sam\.cargo\git\checkouts\gpu-descriptor-a05b99db0270c787\df74fd8\gpu-descriptor\src\allocator.rs:117:9

And I haven't tested this but I assume it will now panic on linux and macOS. The next step will be handling the error eloquently but we can't proceed until wgpu is released and upgraded in bevy.

@hafrei
Copy link

hafrei commented Jan 14, 2021

And I haven't tested this but I assume it will now panic on linux and macOS. The next step will be handling the error eloquently but we can't proceed until wgpu is released and upgraded in bevy.

Ran and minimized a Bevy 0.4.0 game on macOS 10.15.7 and after a few minutes the game has not crashed, but hasn't paused execution either.

@Azales94500
Copy link

See the changes here #1199

This is part one of fixing this issue, however this cannot be merged until wgpu 0.7 releases. With an upgrade to wgpu, the error is now

wgpu error: Validation Error

Caused by:
    In Device::create_texture
    Dimension X is zero


thread 'main' panicked at 'Handling wgpu errors as fatal by default', C:\Users\Sam\.cargo\git\checkouts\wgpu-rs-40ea39809c03c5d8\3d60546\src\backend\direct.rs:1737:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Jan 03 14:12:40.931 ERROR gpu_descriptor::allocator: `DescriptorAllocator` is dropped while some descriptor sets were not deallocated
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `0`: Allocator dropped before all sets were deallocated', C:\Users\Sam\.cargo\git\checkouts\gpu-descriptor-a05b99db0270c787\df74fd8\gpu-descriptor\src\allocator.rs:117:9

And I haven't tested this but I assume it will now panic on linux and macOS. The next step will be handling the error eloquently but we can't proceed until wgpu is released and upgraded in bevy.

I have exactly the same error :/

@lukors
Copy link
Contributor

lukors commented Apr 21, 2021

wgpu 0.7 is out now, but minimizing on Windows still crashes, but it looks like a different error now?

This is the message I get on Windows:
thread 'main' panicked at 'Error in Device::create_swap_chain: Both `SwapChain` width and height must be non-zero. Wait to recreate the `SwapChain` until the window has non-zero area.', C:\Users\Username\.cargo\registry\src\gh.neting.cc-1ecc6299db9ec823\wgpu-0.7.1\src\backend\direct.rs:129:9 stack backtrace:

Do we have everything we need to solve this issue now since wgpu 0.7 is out?

I would be happy to test on Linux and/or Windows if that's needed.

@NathanSWard
Copy link
Contributor

Similar/duplicate of #170 #1882 (and a few others)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Windowing Platform-agnostic interface layer to run your app in D-Trivial Nice and easy! A great choice to get started with Bevy O-Windows Specific to the Windows desktop operating system P-Crash A sudden unexpected crash S-Duplicate This issue or PR already exists
Projects
None yet
Development

No branches or pull requests

10 participants