unlimitedbacon / stl-thumb

Thumbnail generator for STL files
MIT License
1.09k stars 93 forks source link

Segmentation fault on release build #38

Closed gdetrez closed 2 years ago

gdetrez commented 3 years ago

Hej and thanks for stl-thumb!

I'm having this puzzling issue but I'm not sure if it's a stl-thumb issue or a rustc issue.

When I build stl-thumb in debug mode it works fine, e.g.:

$ cargo run test_data/3DBenchy.stl 3DBenchy.png

But when I build in release mode, I get a segfault :thinking:

$ cargo run --release test_data/3DBenchy.stl 3DBenchy.png  
[1]    1122892 segmentation fault (core dumped)  cargo run --release test_data/3DBenchy.stl 3DBenchy.png

This is on Fedora 34, with Rust stable (rustc 1.52.1).

unlimitedbacon commented 3 years ago

Ok. I'm able to replicate this. It was working previously on Rust 1.44, but when I updated to 1.52 it breaks. Not sure what is going on here. Running with -vvv shows that it is successfully able to load the mesh and create an OpenGL context before crashing.

jkolo commented 3 years ago

I have same issue. Output from run stl-thumb with -vvv:

INFO - STL File: Arm Motor Base-Body.stl
INFO - Output: stdout

INFO - Bounds:
INFO - X: -40.75, 40.75
Y: -19, 19
Z: 0, 21.5

INFO - Center:  Point3 [0.0, 0.0, 10.75]
INFO - Triangles processed:     3800

INFO - GL Version:   Version(Gl, 2, 1)
INFO - GL Version:   2.1 Mesa 21.1.5
INFO - GLSL Version: Version(Gl, 1, 2)
INFO - Vendor:       Mesa/X.org
INFO - Renderer      llvmpipe (LLVM 12.0.1, 256 bits)
INFO - Free GPU Mem: None
INFO - Depth Bits:   None

memory allocation of 48 bytes failed
zsh: abort (core dumped)  stl-thumb Arm\ Motor\ Base-Body.stl -vvv
unlimitedbacon commented 2 years ago

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

gdetrez commented 2 years ago

Version 0.4.1 seems to work fine when built with --release on Fedora 35 :+1:

unlimitedbacon commented 2 years ago

Thank you