Linux games crash at random

Reporter: time-killer-games  |  Status: closed  |  Last Modified: June 16, 2019, 11:16:10 PM

even with an empty 1 room project. eveything I make on Linux crashes. sometimes it works, other runs it dumps out at random times near or at startup. Might be an XLib-exclusive issue. I'm too lazy to confirm this with SDL rn. Also, Ubuntu doesn't show the usual "This application quit unexpectedly" error that crashes usually have. It just looks like the game is closing normally, but I know it isn't, because game_end isn't being called, and I'm not doing anything to close the game when this happens.
RobertBColton  
See if it occurs in debug mode, if so, run gdb in debug mode, otherwise attempt to run gdb on the run mode executable.
https://enigma-dev.org/docs/Wiki/Debugging
time-killer-games  

Here's what it gave me doing compile mode after the game froze:

https://pastebin.com/kYz7ewun

I think i just found some info that seems related here:

https://stackoverflow.com/questions/13152775/debugging-c-nptl-sysdeps-unix-sysv-linux-raise-c-no-such-file-or-directo

Edit:

Now I'm checking it in debug mode...

Edit2:

Doing it in debug mode seems to have produced a similar if not the same result:

https://pastebin.com/eJ4xhseJ

fundies  

you wanna type "bt" into gdb after it crashes in debug mode
time-killer-games  

lol whoops idk how i missed that it was the first thing i saw when the page loaded after you told me that. Will edit this post with the results it gives.

Edit:

Now we are cooking with grease...

https://pastebin.com/iPiGjfzx

RobertBColton  

Where is the engine crashing Sam? Why don't you tell me based on that stack trace instead of me giving you the answer. Remember the point is that you learn to read a stack trace.
RobertBColton  

It seems with high probability the problem is caused by your Nouveau driver, please try updating it.
time-killer-games  

I couldn't figure out how to update the driver, so alternatively if this helps at all, I switched to an NVIDIA driver. It doesn't seem to crash at total random anymore. But just like the other driver, it consistently crashes when the full screen window loses focus via Alt+Tab.

Edit:

Nope, I was wrong, it still crashes at random. Nothing has changed. GMStudio games don't do this. Both GMStudio 1.4 and 2.x versions work flawlessly.

Edit2:

The only noticeable difference or impact changing to NVIDIA had was making all versions of the game run overall slower. So anyway, for that reason, I switched back to using Nouveau.

RobertBColton  

Try OpenGL3 in debug mode and look for anything printed in the console, since GL3 debug mode enables OpenGL debug mode and prints warnings and errors using a callback TheExDeus wrote. Double check that the game setting for vertical synchronization is off/disabled.

Crash is here, so either your driver hates screen refresh or the engine is calling it wrong:

glXSwapBuffers(enigma::x11::disp, enigma::x11::win);

Another workaround is for you to use SDL which uses its own swap control.

RobertBColton  

To reiterate, the realm of possibilities includes:

  1. There's a bug in your installed MESA libraries
  2. There's stack corruption somewhere else in the engine overwriting the variables passed (unlikely as you can reproduce it consistently)
  3. The stack corruption could be caused by a failed initialization

GMS would not have this problem since its installer likely includes binaries which are statically linked to versions of the MESA library different from the bugged one you have installed.

time-killer-games  

Here's the installer script GMStudio 1.4 uses:

#!/bin/bash
sudo apt-get install libopenal1 libopenal1:i386 lib32z1 libbz2-1.0:i386 libstdc++6:i386 libxxf86vm1 libssl1.0.0:i386 libglu1-mesa:i386 libxrandr-dev libxrandr2:i386 zip unzip

Here's the installer script GMStudio 2.x uses:

#!/bin/bash
sudo apt-get install libopenal1 lib32z1 libbz2-1.0 libstdc++6 libxxf86vm1 libssl1.0.0 libglu1-mesa libxrandr-dev libxrandr2 zip unzip

Notice both of these contain libglu1-mesa which implies that is NOT statically linked. Sure, when ENIGMA is known to be multitudes buggier than GMStudio, it makes sense to blame the libraries I have installed via sudo apt-get and NOT engima itself. ESPECIALLY since the bug does not happen in GameMaker, provided both software rely on the same exact dependency that you say is broken.

Yes, that makes a TON of sense!

Also, VSync is on, not sure whether that was what you wanted to hear or not. Regardless, VSync being on or off shouldn't crash the game, smells like a bug to me, and yes, I mean with ENIGMA.

RobertBColton  

GMS is not known to conform to all of the established conventions of any given platform (e.g, a sandboxed filesystem on Windows desktops). The fact that they did here is exceptional. I also expected them to be linking ANGLE which is usually statically linked to libglu1-mesa.

Regardless, try disabling vertical synchronization. When the game starts we check what swap control extension paths are available. Sounds like we're selecting a bugged one. If there's no crash with vertical synchronization disabled, then we know that's the cause.

RobertBColton  

Also, another possibility I just noticed now is that GMSv1.4 installed the 32 bit libglu1-mesa because it can't build 64 bit games. It may have corrupted the 64 bit one ENIGMA was using, since Ubuntu/Debian isn't so nice about installing 32 and 64 bit dependencies simultaneously.
https://askubuntu.com/a/865573
https://askubuntu.com/a/865573

I don't know the order you installed GMSv1.4 and GMS2, but I bet if you go back and try the other one now, without rerunning the installer, the opposite one has quit working.

time-killer-games  

GMS 2.x builds 64-bit linux games. 1.4 did 32-bit. Both the GMS 1.4 and GMS 2.x linux versions of my game work on the same machine and boot.

Oddly enough, I was able to build games just fine yesterday, but now I can't because -lGL isn't being recognized. I looked at my GL install and it appears my libGL.so file is missing. I've tried reinstalling all of ENIGMA's dependencies including of course the OpenGL related ones and tried updating them. Nothing seems to be fixing it.

So anyway, until that gets fixed, not much else I can do in the area of building, running, or debugging.

Sorry dude. :(

RobertBColton  

I spoke hastily, I meant to say GMSv1.4 can't build 64 bit games. What date did you install the two GMS versions on the same machine as ENIGMA? And to clarify, what is the order all 3 were installed?

Here's something to try. Try creating an exe of a simple 1 room game in GMSv1.4 and GMS2 on the desktop area. See if libGL.so is copied somewhere next to the executable.

RobertBColton  

Correction again, libglu1-mesa is not the same as libglu1-mesa-dev. I believe ENIGMA requires the latter while GMS requires the former from your install script paste. I am not sure if these two dependencies are mutually exclusive. In other words, you may have to remove the GMS one, install the ENIGMA one, to use ENIGMA. And do the converse when you want to use GMS.

It may also, in fact, just be ok to use the one ENIGMA does since it may include the shared objects in addition to the static libraries and will work with ENIGMA and GMS. However, it may still require that you remove the user one GMS installed first before it will allow you to install the dev one.

time-killer-games  

I have a feeling I permanently fucked up my Kubuntu installation. I'm tempted to just reinstall the distro. I'm having a hard time believing I'm going to be able to fix this otherwise.
time-killer-games  

Well, I reinstalled Kubuntu from the disk image, again, and it still seems messed up in all the same ways. I didn't install GMStudio depends this time, only the x64 ENIGMA depends, and the issue persists. In any case, I'm hoping the reinstall fixed the missing SO file issue. Trying VSync off again. Will edit with results.

Edit:

Okay, so it builds now that I reinstalled Kubuntu, but it still crashes even when I turn off VSync.

Edit2:

I'll try OpenGL3 in debug mode tmr as you previously requested...

Edit3:

I changed my mind and decided to try OpenGL3 tonight. OpenGL3 does not work at all. I get a blank screen, just like I've always had when trying to use that broken piece of shite.

RobertBColton  

Try OpenGL3 with SDL. I forgot we don't create a core context with GLX, but with SDL we do. That may by chance work or it may not.
time-killer-games  

Using SDL with OpenGL3 is still giving me a blank screen. That said, I'll try building the game with SDL and see if it still crashes using plain old OpenGL1.

Edit:

It doesn't crash in SDL, but I still would like this fixed in X11 somehow, as I do not want to force users to install SDL to play my game, I prefer having as few dependencies as possible, and that is a big one.

time-killer-games  

@RobertBColton I reinstalled Kubuntu and the crashes no longer happen now. Weird thing is, last time I tried that it didn't solve or change anything but this time it did. I just wanted to let you know it was probably an issue with Kubuntu, not ENIGMA, after all, just like you originally suspected.

RobertBColton  

Sure, closing is the correct thing to do now. However, since you just did that with me having merged fixes for crashes on Windows, it could have been that which fixed it too.
I mean 1ab91ae and 7593150
RobertBColton  

I'll also add here that napkin basically had the same problems in #1449 not too long ago and it was fixed the same way. Go figure.
Please sign in to post comments, or you can view this issue on GitHub.