[Linux] Natural Selection 2 keeps crashing when shooting.
CommanderAlchemy
Sweden Join Date: 2013-12-04 Member: 189780Members
Right i know that there was another thread but was later closed as fixed. I posted about this and some other crashing issues on another thread but it was related to optimization.
Well after latest update i removed all config files related to NS2 and downloaded the whole game again from Steam the game keeps crashing when shooting weapons or hatching. I decided to do a video of the occurrence to just clarify the issue and try to collect the most amount of info i can about this. If there is something missing please tell.
I also posted this on nVidia forums to maybe get a response from their devs located here:
https://devtalk.nvidia.com/default/topic/770053/linux/natural-selection-2-keeps-crashing-when-shooting-
The game was running the lowest settings and effects that could be turned off in the graphics options. Everything else is the stock settings from a fresh install.
Info/Logs
Steam systeminfo:
https://gist.github.com/CommanderAlchemy/83c70f2deffb678192c3
Dmesg error:
nVidia-bug-report:
Check the devtalk.nvidia.com post i did, linked above it contains allot of information and logs if the steam systeminfo is not enough.
log.txt (from ~/.config/....
https://gist.github.com/CommanderAlchemy/9cbde0308b5814da0ef4
Video of the issue
Well after latest update i removed all config files related to NS2 and downloaded the whole game again from Steam the game keeps crashing when shooting weapons or hatching. I decided to do a video of the occurrence to just clarify the issue and try to collect the most amount of info i can about this. If there is something missing please tell.
I also posted this on nVidia forums to maybe get a response from their devs located here:
https://devtalk.nvidia.com/default/topic/770053/linux/natural-selection-2-keeps-crashing-when-shooting-
The game was running the lowest settings and effects that could be turned off in the graphics options. Everything else is the stock settings from a fresh install.
Info/Logs
Steam systeminfo:
https://gist.github.com/CommanderAlchemy/83c70f2deffb678192c3
Dmesg error:
[77133.261726] ns2_linux32[15536]: segfault at 0 ip 00000000f151f3e7 sp 00000000ffac1680 error 4 in libnvidia-glcore.so.343.13[efdc8000+1925000]
nVidia-bug-report:
Check the devtalk.nvidia.com post i did, linked above it contains allot of information and logs if the steam systeminfo is not enough.
log.txt (from ~/.config/....
https://gist.github.com/CommanderAlchemy/9cbde0308b5814da0ef4
Video of the issue
Comments
Also when biting with skulk:
[170953.562559] ns2_linux32[27104]: segfault at 0 ip 00000000f15ff4d1 sp 00000000ff7f7260 error 4 in libnvidia-glcore.so.340.32[efee4000+18e9000]
https://devtalk.nvidia.com/default/topic/770053/linux/natural-selection-2-keeps-crashing-when-shooting-/?offset=6#4303486
Though kudos for nVidia and sandipt for responding and working so fast with this issue since I posted it on their forums. Lets hope it's "the" issue that causes crashes and not some yet another bug :P
https://devtalk.nvidia.com/default/topic/770053/linux/natural-selection-2-keeps-crashing-when-shooting-/?offset=6#4303486
Thanks @CommanderAlchemy for doing that
There is an answer on the nvidia thread about the crashing issue, seems it's the game doing some bad things that it should not do.
https://devtalk.nvidia.com/default/topic/770053/linux/natural-selection-2-keeps-crashing-when-shooting-/
I'm having relativly rare random crashes. Want to know if it is the same thing.
(will post details later)
Cannot say, nVidia found some issues with the game rendering code so it could possibly affect other things and probably other vendors.
BTW, it's really as I assumed — a null pointer passed to the driver's function. Not that I'm bragging about it... ah, ok, I'm bragging. Though it was an obvious outcome anyway.
I have not been able to reproduce the crash after several hours of gameplay.
Awesome news.
Would it be possible to provide some quick information on setting this up?
I am vaguely familiar with LD_PRELOAD, but not in terms of intercepting this.
You should be willing to take any risk that may be associated with this, certainly not recommended for the average user. In my case I do not crash at all when using this and I also do not notice any graphics or performance issues.
I was also told that this specific code is not a cheat and VAC will not take action against it. (By who I'm 99% sure is a Valve employee, but this information should still be considered speculative and risky)
Compile it with:
gcc -fPIC -c -o preload.o preload.c
gcc -shared -o preload.so preload.o -ldl
Load it by adding the following to NS2's launch options in steam:
LD_PRELOAD=$LD_PRELOAD:/path/to/preload.so %command%
And the compilation could be done in one pass with gcc -fPIC -shared -o preload.so preload.c
I also have to add -m32 argument so it produces a 32-bit binary which is necessary as NS2 is 32-bit only and won't accept a 64-bit library.
About the usage: place the preload.so file to the NS2 directory. Set the launch options for the game in Steam to this: You can then attach with gdb and check if the library is loaded with "info sharedlibrary" command. I'll be playing with it from now on and I'll report if it doesn't help. Crashes happen not so often for me so it may take a couple of weeks to confirm.
LD_PRELOAD=$LD_PRELOAD:/path/to/object.so
For me, I can definitely say it works. If I stop loading it I crash within an average of 5-10 minutes of play. I've played more in the last two days than I've been able to play in the last six months thanks to nvidia!
Also, this is the current version, you can find it here: https://github.com/ali1234/nvidiathing/blob/master/preload.c
It seems he has also made the changes you suggested. Additionally, it should be using RTLD_NEXT instead of RTLD_LAZY. However, RTLD_NEXT requires '#define _GNU_SOURCE' before the dlfcn.h include (which isn't there) and even then it produces compiler warnings.
I wasn't required to use the -m32 option.
It is loading the PRELOAD script however as shown in the terminal line
Strange thing is, in pub servers, I can play for an hour or so without a problem, using shotguns the whole time. However, when I start a sandbox server up, it crashes without fail on the very first shot.
compiled with : gcc -fPIC -shared -o preload.so preload.c
I preload it with: LD_PRELOAD=preload.so %command%
Having the file in game dir.
It prints out that it loaded but.
It crashes at sandbox the way it did before. I added also a fprintf just before it should return in the and it never prints out.
Also note that it was one of the issues of the rendering code.
From the nvidia dev,
"It crashes upon calling glDrawElementsInstanced() because it has incorrectly set the vertex attribute pointers to NULL."
"You will note that no VBO is bound, and the application gives a NULL pointer to attribute 6, which by itself is enough to trigger the crash"
So i guess we would also need to do something about
glVertexAttribPointer(6, 3, GL_FLOAT, 0, 76, (nil));