fstl-app / fstl

A fast STL file viewer
463 stars 106 forks source link

Segmentation fault when there is no display #98

Open coderforlife opened 1 year ago

coderforlife commented 1 year ago

When rendering a scene to an output file (and thus no window is opened), this works just fine when there is a display. However, when running from ssh or similar, the program segfaults.

mkeeter commented 1 year ago

Can you post a backtrace? I'm not sure whether a headless session is able to get an OpenGL context, so this may not be possible at all, but a segfault is a bad way to report it.

coderforlife commented 1 year ago

I did find a workaround. I can use Xvfb to make a fake X session and it works headless then. The Xvfb can even be arbitrarily small (I am using a 640x480 fake screen but generating a 1800x1350 image with the command line). I will still try to get a backtrace as well, but for the moment my problem has an effective workaround. It seems to me to not be an OpenGL issue but instead a Qt issue (Qt won't start without a display, and even though you are never opening a Qt window, it is still looking for that display). I do get a warning message from Xvfb every time f3d is run that a keyboard mapping can't be loaded (for emojis...), which is another indication that it is Qt and not OpenGL opening the current display.

I hope that doing this isn't using software rendering, since the machine has multiple GPUs that I usually use headless for other purposes. Is there any way to test if your program is using software rendering or not? On the one model I tried (a fairly complex/large STL) it renders essentially instantly.