unlimitedbacon / stl-thumb

Thumbnail generator for STL files
MIT License
1.02k stars 89 forks source link

main thread panic when running stl-thumb #40

Closed sick4noise closed 2 years ago

sick4noise commented 3 years ago

I was very excited to find this project as I'm in need of an STL thumbnailer. I'm running gentoo on x86_64 hardware so I had to compile and install manually. However, the compile binary refuses to work. Based on searches it sounds like it's an issue with winit and my version of Rust (1.51.0). I tried using various versions of winit but I hit the same issue with all of them. Here's the stacktrace:

thread 'main' panicked at 'attempted to leave type `platform::platform::x11::util::input::PointerState` uninitialized, which is invalid', /rustc/1.51.0/library/core/src/mem/mod.rs:671:9
stack backtrace:
   0:     0x55f3e5cfc670 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha82970ce331ee3df
   1:     0x55f3e5d1bb5c - core::fmt::write::h92100e0a6eb0e206
   2:     0x55f3e5cf9432 - std::io::Write::write_fmt::he651b488a8ffa4cc
   3:     0x55f3e5cfe7b5 - std::panicking::default_hook::{{closure}}::h010c097578ccb97b
   4:     0x55f3e5cfe313 - std::panicking::default_hook::h8c4b8abaadca6a5a
   5:     0x55f3e5cfef51 - std::panicking::rust_panic_with_hook::h57aad5155f981348
   6:     0x55f3e5cfea67 - std::panicking::begin_panic_handler::{{closure}}::h3fc4d29fbfbcb4c0
   7:     0x55f3e5cfcb2c - std::sys_common::backtrace::__rust_end_short_backtrace::hcbb448073e5fc14e
   8:     0x55f3e5cfe9f9 - rust_begin_unwind
   9:     0x55f3e5d19b51 - core::panicking::panic_fmt::hf6474c47f9aace56
  10:     0x55f3e5d19a9d - core::panicking::panic::hdef100c2be4b5e1c
  11:     0x55f3e5c78e39 - winit::platform::platform::x11::window::UnownedWindow::new::h137a8eae2d5d479e
  12:     0x55f3e5c478c5 - winit::platform::platform::x11::Window::new::h9a0d63040f6881ad
  13:     0x55f3e5c320ae - glutin::platform::platform::x11::Context::new::h368d4f308f7fbbd9
  14:     0x55f3e5c37a52 - glutin::GlWindow::new::h6b007a127aa87965
  15:     0x55f3e5bb008a - glium::backend::glutin::Display::new::he2ad2c3f66be025a
  16:     0x55f3e5b03e5e - stl_thumb::create_normal_display::h80fc51a1ad985bb9
  17:     0x55f3e5b065cc - stl_thumb::render_to_image::hede39f3a5e60b7bc
  18:     0x55f3e5b08c0c - stl_thumb::render_to_file::h0cb41b6a22f536f6
  19:     0x55f3e5aff80b - stl_thumb::main::h3b921ee4a9c7a298
  20:     0x55f3e5b00233 - std::sys_common::backtrace::__rust_begin_short_backtrace::hca825ff6266d766f
  21:     0x55f3e5b002d9 - std::rt::lang_start::{{closure}}::hf7be66efd71edf7e
  22:     0x55f3e5cff377 - std::rt::lang_start_internal::h5a78c72a894ab7a4
  23:     0x55f3e5aff992 - main
  24:     0x7f1c4b78c88e - __libc_start_main
  25:     0x55f3e5aff08a - _start
  26:                0x0 - <unknown>

I would think if it's a compatibility issue with Rust then everyone running a recent version of Rust would be having this issue.

maxkueng commented 2 years ago

I have the same issue on Manjaro Linux. I installed the AUR package.

export RUST_BACKTRACE=full
stl-thumb ./test.stl ./test.png

memory allocation of 48 bytes failed
[1]    493830 abort (core dumped)  stl-thumb ./test.stl ./test.png
export RUST_BACKTRACE=full
stl-thumb -x ./test.stl

thread 'main' panicked at 'attempted to leave type `platform::platform::x11::util::input::PointerState` uninitialized, which is invalid', /build/rust/src/rustc-1.55.0-src/library/core/src/mem/mod.rs:663:9
stack backtrace:
   0:     0x5623315b99c0 - <unknown>
   1:     0x5623315db53c - <unknown>
   2:     0x5623315b7135 - <unknown>
   3:     0x5623315bba3b - <unknown>
   4:     0x5623315bb511 - <unknown>
   5:     0x5623315bc114 - <unknown>
   6:     0x5623315bbbb7 - <unknown>
   7:     0x5623315b9ebc - <unknown>
   8:     0x5623315bbb49 - <unknown>
   9:     0x5623313feb81 - <unknown>
  10:     0x5623313feacd - <unknown>
  11:     0x56233154bebf - <unknown>
  12:     0x562331527952 - <unknown>
  13:     0x56233150cc9c - <unknown>
  14:     0x562331507ab9 - <unknown>
  15:     0x56233149827a - <unknown>
  16:     0x562331405909 - <unknown>
  17:     0x562331405e7c - <unknown>
  18:     0x5623313ffa79 - <unknown>
  19:     0x5623313fffd3 - <unknown>
  20:     0x562331400579 - <unknown>
  21:     0x5623315bc61a - <unknown>
  22:     0x5623313ffc92 - <unknown>
  23:     0x7f6233c64b25 - __libc_start_main
  24:     0x5623313ff35e - <unknown>
  25:                0x0 - <unknown>
unlimitedbacon commented 2 years ago

Can you test again with version 0.4.1? https://github.com/unlimitedbacon/stl-thumb/releases/tag/v0.4.1

unlimitedbacon commented 2 years ago

Closing. Reopen if this is still happening for you on v0.5.0.

sick4noise commented 2 years ago

Confirmed - v0.5.0 works for me on Gentoo when compiled from scratch. Thanks!