GLFW: version 3.4
OS: Ubuntu 24.04.3 LTS
GPU: NVIDIA Corporation GA104 [Geforce RTX 3070 Ti Laptop GPU]
Drivers: OpenGL version string: 4.6.0 NVIDIA 570.172.08
Environment variables: __GLX_VENDOR_LIBRARY_NAME=nvidia __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only
GDB backtrace and frame output:
(gdb) bt
#0 0x00007ffff42fd708 in ?? () from /lib/x86_64-linux-gnu/libnvidia-glcore.so.570.172.08
#1 0x00007ffff4200c03 in ?? () from /lib/x86_64-linux-gnu/libnvidia-glcore.so.570.172.08
#2 0x00007ffff42d7e0e in ?? () from /lib/x86_64-linux-gnu/libnvidia-glcore.so.570.172.08
#3 0x00007ffff42b9df6 in ?? () from /lib/x86_64-linux-gnu/libnvidia-glcore.so.570.172.08
#4 0x00007ffff5d7a3ce in ?? () from /lib/x86_64-linux-gnu/libGLX_nvidia.so.0
#5 0x00007ffff5d48510 in ?? () from /lib/x86_64-linux-gnu/libGLX_nvidia.so.0
#6 0x00005555555b287d in main () at src/main.c:450
(gdb) fr 6
#6 0x00005555555b287d in main () at src/main.c:450
450 glfwSwapBuffers(window);
Please note my program runs fine on he integrated gpu (Intel Corporation Alder Lake-P GT2 [Iris Xe Graphics]).
You can find the full source code here.
Please let me know if you need any more info.
I recommend running an example or test program from GLFW first to see if that also has the same issue - the crash appears to be in the NVIDIA driver code and potentially due to incorrect OpenGL. I would then make sure to have full OpenGL error output available. It can be tricky debugging crashes like this, as they can be due to things like a wrongly sized buffer etc.
Hi there @dougbinks ! Thanks for reaching out !
First of all sorry for the delayed response, thankfully I have diagnosed the problem to be from GLFW itself. The segfault is due toglfwWindowHint(GLFW_DECORATED, GLFW_FALSE) . This matches with the windows.c example from glfw repo. same seg fault crash. By commenting out that line my project runs fine on my nvidia gpu.
Now is this a known issue? I am using glfw 3.4 (shared object file) (I don’t remember correctly i think i downloaded binaries or maybe I compiled libs myself )
What version of glfw would you recommend to test this behaviour ?
Note : There were 2 OpenGL debug messages but of low severity (like INFO or WARN)
Please let me know if you need any further info. Thanks !
Do you mean that running the windows.c example program has the same crash?
If the windows.c program also has the same issue then you have isolated the problem to your system + GLFW, not to just GLFW. It’s still possible that this is a GPU driver, OS, window system or configuration problem. Given that it runs fine on the integrated GPU it’s possibly related to GPU driver or GPU driver configuration or some GLFW issue related to that.
Have you tried with the environment variables you mention removed?
I would also try compiling the latest GLFW from source and running the windows.c program from that. There have been a number of Wayland specific changes, though none of the issues were related to segfaults from non decorated windows.
Yes. (Also the weird behaviour I noticed on both my project as well as windows.c that sometimes it randomly works i.e. program runs fine without seg faulting, although i is like 1 in 10 chance).
Yes, I have tried every combination of those variables, crashes if it runs on nvidia gpu, else it runs just fine with integrated intel gpu.
I am using ubuntu on wayland. I also have other window managers as well I will try them out. If that also gives same error then I will move to testing on different Desktop environments. And if that fails as well then the drivers are to blame I guess. (please correct me if I am missing anything or wrong somewhere).
We do have a report of a Segmentation Fault when calling glfwTerminate on wayland after calling glfwSwapBuffers without glfwPollEvents but this does not seem to be related to your issue.
Notably one of the reports is using an NVIDIA GPU and they do not see any issues unless they call glfwTerminate without calling glfwPollEvents, i.e. they do not see your issue. They are using driver version NVIDIA 580.95.05 which is newer than yours, so the first thing I would look at is updating your NVIDIA driver.
1 Like
After switching to nvidia-drivers-580 or 580.95.05to be specific, everything works fine. Turns out to be driver issue. Thanks for helping out @dougbinks !