bevyengine / bevyengine/bevy

loop exits immediately in Release build

Open
#5,113 0 comments 0 reactions 0 assignees View on GitHub
A-Windowing C-Bug C-Startup
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

```
commit a138804d618a00d9e42a62547603a0b094be1042 (grafted, HEAD -> main)
Author: Robert Gabriel Jakabosky
Date: Sun Jun 26 21:45:04 2022 +000
```

## Relevant system information

`cargo 1.61.0 (a028ae4 2022-04-29)`
```
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
```

NOTE: using WSL2:

```
WSLg ( x86_64 ): 1.0.34+Branch.main.Sha.a6f7a68801278da2a3ba96b9e6a631e5f67d1adb
Mariner: VERSION="1.0.20220226"
mesa:
pulseaudio: 2f0f0b8c3872780f15e275fc12899f4564f01bd5
FreeRDP: c574044a10003e50453acb4cf42801c5833fb572
weston: 6eebe8febc213ba5034737e11c5ab36b3f0bbacc
```

```ignore
2022-06-27T13:51:40.247744Z INFO wgpu_core::instance: Adapter Vulkan AdapterInfo { name: "llvmpipe (LLVM 12.0.0, 256 bits)", vendor: 65541, device: 0, device_type: Cpu, backend: Vulkan }
2022-06-27T13:51:40.247773Z INFO bevy_render::renderer: AdapterInfo { name: "llvmpipe (LLVM 12.0.0, 256 bits)", vendor: 65541, device: 0, device_type: Cpu, backend: Vulkan }
2022-06-27T13:51:40.247833Z WARN wgpu_hal::vulkan::adapter: Missing extensions: ["VK_KHR_timeline_semaphore"]
```

## What you did

- add dep `winit = "0.26.1"` into `Cargo.toml`
- compile in release, or better add:
```
# https://bevy-cheatbook.github.io/pitfalls/performance.html
# "Enable only a small amount of optimization in debug mode"
[profile.dev]
opt-level = 1

# "Enable high optimizations for dependencies (incl. Bevy), but not for our code:"
[profile.dev.package."*"]
opt-level = 3
```
- run any example: eg `cargo run --example=shapes`

## What went wrong

- what were you expecting?
- the example should run correctly
- what actually happened?
- the loop exits immediately

## Additional information

IMPORTANT: when compiling with debug symbol, it CAN work with `winit = "0.26.1"` IFF a breakpoint is added during the setup process
around `/.../.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.26.1/src/platform_impl/linux/wayland/event_loop/mod.rs` L366 at `for event in event_sink_back_buffer.drain(..)`
Once the window is created, the program works just fine.
NOTE: the breakpoint works in a lot of places; I guess anywhere "early enough" would work.

- links to related bugs, PRs or discussions:
It could be related to the same kind of init bug than https://github.com/bevyengine/bevy/issues/4105?

I know it is probably a winit bug, but the fact is that adding a dependency breaks a bevy program means something should probably done on this side?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.