Opened 3 years ago

Closed 3 years ago

#4786 closed defect (fixed)

Crash at start in snd_detect()

Reported by: Jan Owned by: Itms
Priority: Release Blocker Milestone: Alpha 23
Component: Core engine Keywords:
Cc: Patch: Phab:D1254


Hey all.

New in the forum, but not to the game :)

0AD won´t start. It just crash.

Have play ver 22, but now it wont even start.

Much to our regret we must report the program has encountered an error.

Please let us know at and attach the crashlog.txt and crashlog.dmp files.

Details: unhandled exception (Access violation reading 0x00000000)

Location: unknown:0 (?)

Call stack:

(error while dumping stack: No stack frames found) errno = 0 (No error reported here) OS error = 0 (no error code was set)

Now i just have to find a way to attach the files from logs

Attachments (2)

crashlog.txt (672 bytes ) - added by Jan 3 years ago.
crashlog.dmp (83.1 KB ) - added by Jan 3 years ago.

Download all attachments as: .zip

Change History (23)

by Jan, 3 years ago

Attachment: crashlog.txt added

by Jan, 3 years ago

Attachment: crashlog.dmp added

comment:1 by elexis, 3 years ago

Can you try to disable GLSL and let us know if that works?

comment:2 by Jan, 3 years ago

Is there a other way than in game "options"?

Cos the game crash at start up.

comment:3 by elexis, 3 years ago

I see. (Thought start means starting the match) Then its unlikely that it's GLSL, but you can still try to disable graphics options in a user.cfg file:

Might also want to post the system_info.txt file to see if its some piece of hardware that is not liked by the game.

Other than that we probably need someone with windows and visual studio 2013 to create a text version of the crashlog.dmp.

comment:4 by Jan, 3 years ago

Thanks for the replay.

The user.cfg:

gui.splashscreen.enable = "true" gui.splashscreen.version = "1478832372" playername.singleplayer = "Jan" postproc = "false" preferglsl = "false" sound.actiongain = "0.699999988079071" sound.ambientgain = "0.6000000238418579" sound.mastergain = "0.8999999761581421" sound.musicgain = "0.20000000298023224" sound.uigain = "0.699999988079071" userreport.enabledversion = "0" = "5a9eb91b9eceba09"

comment:5 by elexis, 3 years ago

Try adding this:

postproc = "false"
preferglsl = "false"
shadowpcf = "false"
shadows = "false"
showsky = "false"
silhouettes = "false"
smoothlos = "false"
watereffects = "false"
waterfancyeffects = "false"
waterrealdepth = "false"
waterreflection = "false"
waterrefraction = "false"
watershadows = "false"
waterugly = "true"
windowed = "true"

comment:6 by Jan, 3 years ago

I have try, still the same.

comment:7 by elexis, 3 years ago

Until someone can show the contents of that crash dump, I can only guess.

Next guess would be that it can't even access the user directory due to directory read/write permissions.

The quickest and probably most reliable try would be to run 0AD with administrator permissions. Alternatively one could try to change directory permissions and the owner of the directory containing the 0AD config files (where also the user.cfg resides) manually (but at least in the past people have failed trying to).

comment:8 by Jan, 3 years ago

Do you know how to get the crash dump?

Have try the others thing, with read/write per...

Still the same

comment:9 by elexis, 3 years ago

Would require installing visual studio 2013. Then one can open the crash dmp file there and see a the lines of code where it crashes exactly. We could ask Stan to do it. I guess I'll send him a PM.

comment:10 by stanislas69, 3 years ago

There you go. Looks like detection code error. Do you have an up to date sound card ?

>	pyrogenesis.exe!snd_detect() Line 65	C++
 	pyrogenesis.exe!WriteSystemInfo() Line 87	C++
 	pyrogenesis.exe!InitGraphics(const CmdLineArgs & args={...}, int flags=0) Line 1041	C++
 	pyrogenesis.exe!RunGameOrAtlas(int argc=1, const char * * argv=0x00250008) Line 579	C++
 	pyrogenesis.exe!SDL_main(int argc=1, char * * argv=0x00250008) Line 623	C++
 	pyrogenesis.exe!main_utf8(int argc=1, char * * argv=0x00250008) Line 126	C
 	pyrogenesis.exe!wmain(int argc=1, unsigned short * * wargv=0x003f69f0, unsigned short * wenvp=0x003f35d8) Line 151	C
 	pyrogenesis.exe!__tmainCRTStartup() Line 623	C
 	pyrogenesis.exe!CallStartupWithinTryBlock() Line 364	C++
()	Unknown
()	Unknown
()	Unknown

comment:11 by elexis, 3 years ago

Component: UI & SimulationCore engine
Summary: Crash at startCrash at start in snd_detect()

Yep, really need to know the sound card and OS.

I guess system_info.txt is never written because it crashes just before.

comment:12 by Jan, 3 years ago

Thanks for all until now.

Lenovo T530

Win7 pro

Sound card: Realtek High Defination audio. Driver ver.

comment:13 by s0600204, 3 years ago

Interesting. I've occasionally been having a similar problem - but with Arch Linux.

My own backtrace:

#0  0x00007ffff373c221 in __strlen_avx2 () from /usr/lib/
#1  0x0000555555aca340 in std::char_traits<char>::length (__s=0x0) at /usr/include/c++/7.2.0/bits/char_traits.h:269
#2  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign (__s=0x0, this=0x555555f275c0 <snd_drv_ver[abi:cxx11]>)
    at /usr/include/c++/7.2.0/bits/basic_string.h:1387
#3  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator= (__s=0x0, this=0x555555f275c0 <snd_drv_ver[abi:cxx11]>)
    at /usr/include/c++/7.2.0/bits/basic_string.h:667
#4  snd_detect () at ../../../source/lib/snd.cpp:65
#5  0x000055555575a173 in WriteSystemInfo () at ../../../source/ps/Util.cpp:84
#6  0x0000555555816595 in InitGraphics (args=..., flags=0) at ../../../source/ps/GameSetup/GameSetup.cpp:1034
#7  0x00005555555b0caf in RunGameOrAtlas (argc=<optimized out>, argv=<optimized out>) at ../../../source/main.cpp:587
#8  0x00005555555a13a7 in main (argc=1, argv=0x7fffffffe9e8) at ../../../source/main.cpp:632

For me, the crash happens if the soundcard is unavailable (for instance if some other application is playing audio), and this causes 0AD to segfault.

Personally, I've been getting round the problem by commenting out the offending line and recompiling, but I know that's not a solution for everyone. Or indeed a true solution. As I'm not the only one suffering this any more I've looked into it a bit further than I did last time:

The line that appears to be at fault is line 65 of source/lib/snd.cpp (link) and all it does is call a function (alGetString (source)) and assign the returned value to a variable (snd_drv_ver).

Ordinarily the returned value would be of type ALchar* (and be cast to std::string through assignment).

However, if there's something wrong (ie. OpenAL not initialised, or the sound card is unavailable) the function called returns NULL, and it is this that appears to be causing the problem, and the crash. (Quick websearch implies that std::string may never be set to NULL.)

Now, I realise that the root cause/fault might be different for Jan, but either way, the code should gracefully handle a NULL being returned. (Then if there is a further problem, that would be revealed.)

comment:14 by Jan, 3 years ago

Many, many thanks for the help.

It was cos i have mute the audio/sound on my laptop :)

comment:15 by stanislas69, 3 years ago

Glad to hear that. Have fun with the game.

In the meantime, I think not having a Sound Card shouldn't prevent people from playing. Sounds like a bug that should be fixed like the one about GLSL.

comment:16 by elexis, 3 years ago

Milestone: BacklogAlpha 23
Priority: Should HaveMust Have

Agree with Stan. In particular fixing it sounds feasible as we have a developer who can reproduce an at least similar bug in the same line.

comment:17 by Itms, 3 years ago

All of this comes from r19877 and s0600204 is totally right, we should just check the return value of alGetString before casting it to a string. My bad!

comment:18 by Itms, 3 years ago

Owner: set to Itms
Priority: Must HaveRelease Blocker

comment:19 by stanislas69, 3 years ago

#4925 Crashdump :

>	pyrogenesis.exe!snd_detect() Line 65	C++	Symbols loaded.
 	pyrogenesis.exe!WriteSystemInfo() Line 87	C++	Symbols loaded.
 	pyrogenesis.exe!InitGraphics(const CmdLineArgs & args, int flags) Line 1041	C++	Symbols loaded.
 	pyrogenesis.exe!RunGameOrAtlas(int argc, const char * * argv) Line 579	C++	Symbols loaded.
 	pyrogenesis.exe!SDL_main(int argc, char * * argv) Line 623	C++	Symbols loaded.
 	pyrogenesis.exe!main_utf8(int argc, char * * argv) Line 126	C	Symbols loaded.
 	pyrogenesis.exe!wmain(int argc, unsigned short * * wargv, unsigned short * wenvp) Line 151	C	Symbols loaded.
 	[External Code]		Annotated Frame
 	pyrogenesis.exe!CallStartupWithinTryBlock() Line 364	C++	Symbols loaded.
 	[External Code]		Annotated Frame
 	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]		Annotated Frame

comment:20 by Itms, 3 years ago

Patch: Phab:D1254

comment:21 by Itms, 3 years ago

Resolution: fixed
Status: newclosed

In 21097:

Fix crash at start in snd_detect(), fixes #4786.

Reviewed By: s0600204, echotangoecho
Differential Revision:

Note: See TracTickets for help on using tickets.