Skip to content
This repository has been archived by the owner on Apr 18, 2022. It is now read-only.

[BUG] 2D Starter Project Crash on Mouse Hover #2569

Closed
nyghtly-derek opened this issue Jan 3, 2021 · 8 comments
Closed

[BUG] 2D Starter Project Crash on Mouse Hover #2569

nyghtly-derek opened this issue Jan 3, 2021 · 8 comments
Labels
open-when-archived This was open when we decided to archive the repo, so we closed it as per best practices. type: bug Something is not working as it should.

Comments

@nyghtly-derek
Copy link

nyghtly-derek commented Jan 3, 2021

Description

2D starter project will crash after hovering my mouse over the game window.

Reproduction Steps

  1. Execute git clone https://github.com/amethyst/amethyst-starter-2d.git.
  2. Execute cargo run (with your mouse cursor off to the side of the screen).
  3. Hover mouse over the game window.
  4. Observe crash.

Screenshots and Logs

$ RUST_BACKTRACE=1 cargo run
...
[INFO][amethyst::app] Initializing Amethyst...
[INFO][amethyst::app] Version: 0.15.3
[INFO][amethyst::app] Platform: x86_64-unknown-linux-gnu
[INFO][amethyst::app] Amethyst git commit: UNKNOWN
[INFO][amethyst::app] Rustc version: 1.49.0 Stable
[INFO][amethyst::app] Rustc git commit: e1884a8e3c3e813aada8254edfa120e85bf5ffca
[INFO][winit::platform::platform::x11::window] Guessed window DPI factor: 1
[WARN][gfx_backend_vulkan] Unable to find layer: VK_LAYER_LUNARG_standard_validation
thread 'main' panicked at 'attempted to leave type `platform::platform::x11::util::input::PointerState` uninitialized, which is invalid', /home/nyghtly/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:659:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5
   1: core::panicking::panic_fmt
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/panicking.rs:50:5
   3: core::mem::uninitialized
             at /home/nyghtly/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:659:9
   4: winit::platform::platform::x11::util::input::<impl winit::platform::platform::x11::xdisplay::XConnection>::query_pointer
             at /home/nyghtly/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/linux/x11/util/input.rs:94:51
   5: winit::platform::platform::x11::EventsLoop::process_event
             at /home/nyghtly/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/linux/x11/mod.rs:956:45
   6: winit::platform::platform::x11::EventsLoop::poll_events
             at /home/nyghtly/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/linux/x11/mod.rs:270:13
   7: winit::platform::platform::EventsLoop::poll_events
             at /home/nyghtly/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/platform/linux/mod.rs:522:44
   8: winit::EventsLoop::poll_events
             at /home/nyghtly/.cargo/registry/src/github.com-1ecc6299db9ec823/winit-0.19.5/src/lib.rs:277:9
   9: <amethyst_window::system::EventsLoopSystem as shred::system::RunNow>::run_now
             at /home/nyghtly/.cargo/registry/src/github.com-1ecc6299db9ec823/amethyst_window-0.15.3/src/system.rs:116:9
  10: shred::dispatch::dispatcher::Dispatcher::dispatch_thread_local
             at /home/nyghtly/.cargo/registry/src/github.com-1ecc6299db9ec823/shred-0.10.2/src/dispatch/dispatcher.rs:113:13
  11: shred::dispatch::dispatcher::Dispatcher::dispatch
             at /home/nyghtly/.cargo/registry/src/github.com-1ecc6299db9ec823/shred-0.10.2/src/dispatch/dispatcher.rs:65:9
  12: amethyst::game_data::GameData::update
             at /home/nyghtly/.cargo/registry/src/github.com-1ecc6299db9ec823/amethyst-0.15.3/src/game_data.rs:47:13
  13: <T as amethyst::state::State<amethyst::game_data::GameData,amethyst::state_event::StateEvent>>::update
             at /home/nyghtly/.cargo/registry/src/github.com-1ecc6299db9ec823/amethyst-0.15.3/src/state.rs:345:9
  14: amethyst::state::StateMachine<T,E>::update
             at /home/nyghtly/.cargo/registry/src/github.com-1ecc6299db9ec823/amethyst-0.15.3/src/state.rs:447:21
  15: amethyst::app::CoreApplication<T,E,R>::advance_frame
             at /home/nyghtly/.cargo/registry/src/github.com-1ecc6299db9ec823/amethyst-0.15.3/src/app.rs:379:13
  16: amethyst::app::CoreApplication<T,E,R>::run
             at /home/nyghtly/.cargo/registry/src/github.com-1ecc6299db9ec823/amethyst-0.15.3/src/app.rs:243:13
  17: amethyst_starter_2d::main
             at ./src/main.rs:42:5
  18: core::ops::function::FnOnce::call_once
             at /home/nyghtly/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[ERROR][rendy_resource::escape] Terminal must be dropped after all `Escape`s
[ERROR][rendy_resource::escape] Terminal must be dropped after all `Escape`s
[ERROR][rendy_resource::escape] Terminal must be dropped after all `Escape`s
[ERROR][rendy_memory::allocator::dynamic] Memory leak: SizeEntry(1024) is still used
[ERROR][rendy_memory::allocator::dynamic] Memory leak: SizeEntry(8192) is still used
[ERROR][rendy_memory::allocator::dynamic] Memory leak: SizeEntry(65536) is still used
[ERROR][rendy_memory::allocator::dynamic] Memory leak: SizeEntry(524288) is still used
[ERROR][rendy_memory::allocator::dynamic] Memory leak: SizeEntry(262144) is still used
[ERROR][rendy_memory::allocator::dynamic] Memory leak: SizeEntry(4194304) is still used
[ERROR][rendy_memory::allocator::dynamic] Memory leak: SizeEntry(2097152) is still used
[ERROR][rendy_resource::escape] `Escape` was dropped after a `Terminal`?
[ERROR][rendy_resource::escape] `Escape` was dropped after a `Terminal`?
[ERROR][rendy_resource::escape] `Escape` was dropped after a `Terminal`?
[ERROR][rendy_resource::escape] `Escape` was dropped after a `Terminal`?
[ERROR][rendy_resource::escape] `Escape` was dropped after a `Terminal`?
[ERROR][rendy_resource::escape] `Escape` was dropped after a `Terminal`?
[ERROR][rendy_resource::escape] `Escape` was dropped after a `Terminal`?
[ERROR][rendy_resource::escape] `Escape` was dropped after a `Terminal`?
[ERROR][rendy_resource::escape] `Escape` was dropped after a `Terminal`?
[ERROR][rendy_resource::escape] `Escape` was dropped after a `Terminal`?
[ERROR][rendy_resource::escape] `Escape` was dropped after a `Terminal`?
[ERROR][rendy_resource::escape] `Escape` was dropped after a `Terminal`?
[ERROR][rendy_resource::escape] `Escape` was dropped after a `Terminal`?
[ERROR][rendy_resource::escape] `Escape` was dropped after a `Terminal`?
[ERROR][rendy_resource::escape] `Escape` was dropped after a `Terminal`?
Segmentation fault (core dumped)

Your Environment

Operating System: Manjaro 20.2 (linux kernel 5.4.85)
Version of Amethyst: 0.15.3
Version of Rust: 1.49.0 or 1.48.0 (same error with both)
Graphics card: TU116 [GeForce GTX 1660 Ti] (nVidia Corporation)

Additional Context

I can work around the error by switching to version 1.47.0 of Rust.

My problem appears to be similar to that of this closed issue from November: #2524

@nyghtly-derek nyghtly-derek added status: needs triage type: bug Something is not working as it should. labels Jan 3, 2021
@ezpuzz
Copy link
Contributor

ezpuzz commented Jan 3, 2021

@nyghtly-derek the starter project isn't updated to use master yet and therefore uses old rendy/winit , I will add updating it to the todo in #2517 but please try running examples from this branch instead https://github.com/amethyst/amethyst/tree/debug-lines and let me know if they work for you. Thanks!

@nyghtly-derek
Copy link
Author

@ezpuzz Thank you for the quick response. I was able to run the following examples successfully using the debug-lines branch and Rust version 1.49:

  • tiles
  • sprite_animation
  • debug_lines

Let me see if I can clarify my understanding: the starter project is using an older version of amethyst from before the (ongoing) migration to legion from specs. This makes it incompatible with Rust 1.49, because of problems with the old specs version of amethyst. In order to run on Rust 1.49, the starter project would need to be migrated to the latest version of amethyst, which requires some changes to the implementation of the starter project.

Do I understand that correctly? If so, perhaps I can help with migrating the starter project. Is there a closed issue that I can look at to give me an example of what such a migration might entail?

Maybe this one is a good start for me? #2582

@Ducolnd
Copy link

Ducolnd commented Feb 14, 2021

Have the exact same problem. Program crashes on mouse hover on the window opened. This is not specific for the 2D starter project. Crash also occurred when following the Amethyst book.

Enviroment:
Rust: 1.50.0
Amethyst: 0.15.1
OS: Ubuntu 20.04
PC: GTX 1660 Super Ryzen 7 3700X

Edit:
Just like @nyghtly-derek switching to Rust version 1.47.0 'fixes' the bug

@nyghtly-derek
Copy link
Author

nyghtly-derek commented Feb 14, 2021

@Ducolnd Amethyst is in the process of migrating to legion (an alternative to specs, which is used under the hood). As I understand, that is the root cause for this issue, and won't be resolved soon. It's being worked on, but there's no time estimate as far as I know.

In the short term, you have two options:

I'm currently developing a project using method 2. I plan to switch to the cargo package once Amethyst 0.16 is released.

There's also a hidden third option:

  • Contribute to amethyst in order to get 0.16 over the finish line.

@stale
Copy link

stale bot commented Aug 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. Maybe it's time to revisit this?

@stale stale bot added the stale Issue had no recent activity label Aug 21, 2021
@git2013vb
Copy link

I have the same problem:

rustc 1.57.0 (f1edd0429 2021-11-29)
It is not clear to me what I need to do exactly to make it work. Someone can explain it in detail please?

@stale stale bot removed the stale Issue had no recent activity label Dec 6, 2021
@nyghtly-derek
Copy link
Author

@git2013vb The simplest solution would be to use Rust version 1.47. Here's how:

https://users.rust-lang.org/t/how-can-i-revert-to-older-version-of-rust/20497

It's worth noting that the Amethyst engine is not being actively maintained. Bevy is the natural alternative.

@git2013vb
Copy link

git2013vb commented Dec 6, 2021

Thank you for the fast response :)
The error came out after using rust 1.47.0
But its ok. I read the news in blog after posted the issue :)
Here the details about my issue amethyst/amethyst-starter-2d#22 (comment)

Thanks.

@CleanCut CleanCut added the open-when-archived This was open when we decided to archive the repo, so we closed it as per best practices. label Apr 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
open-when-archived This was open when we decided to archive the repo, so we closed it as per best practices. type: bug Something is not working as it should.
Projects
None yet
Development

No branches or pull requests

5 participants