Opened 7 years ago

Closed 7 years ago

#4561 closed defect (fixed)

Recent NVidia driver crashing 0AD

Reported by: Roosi Owned by: Itms
Priority: Release Blocker Milestone: Alpha 22
Component: Core engine Keywords:
Cc: Patch: Phab:D636

Description (last modified by elexis)

Error:
Function call failed: return value was -100102 (Case 2)
Location: wmi.cpp:62 (Init)

Call stack:

Init (wmi.cpp:62)
    pLoc = 
        m_pInterface = 0x00000033


ModuleInit (module_init.cpp:47)
    initState = 0x013E971C -> 4294867266 (0xFFFE7942)
    init = 0x012D5DD0 -> (Init)

wmi_GetClassInstances (wmi.cpp:108)
    className = 0x01396494 -> "Win32_SoundDevice"
    instances = 0x00CFEBFC -> (unsupported vector<map<basic_string<wchar_t,char_traits<wchar_t> >,tagVARIANT > >)
    pEnum = 
        m_pInterface = 0x0011A140 -> 
            (IUnknown)


    query = [200] 
        13056
        14382
        12854
        50 ('2')
        0
        0
        0
        0
        0
        0
        15
        0 ...
    pObj = 
        m_pInterface = 0x00CFEA2C -> 
            (IUnknown)


    instance = (unsupported map<basic_string<wchar_t,char_traits<wchar_t> >,tagVARIANT >)
    numReturned = 13565998 (0x00CF002E)
    name = 0x00CFEBD0 -> [8] { 17160, 302, 25748, 313, 60412, 207, 53335, 49440 }
    value = 
        vt = 26159 (0x662F)
        wReserved1 = 40577 (0x9E81)
        wReserved2 = 50704 (0xC610)
        wReserved3 = 17 (0x0011)
        llVal = 58524942375840676 (0x00CFEC2000CFEBA4)
        lVal = 13626276 (0x00CFEBA4)
        bVal = 164 (0xA4)
        iVal = 60324 (0xEBA4)
        fltVal = 0.000000 (0x00CFEBA4)
        dblVal = 9.09179e-305 (0x00CFEC2000CFEBA4)
        boolVal = 60324 (0xEBA4)
        scode = 13626276 (0x00CFEBA4)
        cyVal = { Lo = 13626276 (0x00CFEBA4), Hi = 13626400 (0x00CFEC20), int64 = 58524942375840676 (0x00CFEC2000CFEBA4) }
        date = 9.09179e-305 (0x00CFEC2000CFEBA4)
        bstrVal = 0x00CFEBA4 -> [8] { 9880, 3086, 60360, 207, 11646, 30650, 15, 0 }
        punkVal = 0x00CFEBA4 (see above)
        pdispVal = 0x00CFEBA4 (see above)
        parray = 0x00CFEBA4 (see above)
        pbVal = 0x00CFEBA4 (see above)
        piVal = 0x00CFEBA4 (see above)
        plVal = 0x00CFEBA4 (see above)
        pllVal = 0x00CFEBA4 (see above)
        pfltVal = 0x00CFEBA4 (see above)
        pdblVal = 0x00CFEBA4 (see above)
        pboolVal = 0x00CFEBA4 (see above)
        pscode = 0x00CFEBA4 (see above)
        pcyVal = 0x00CFEBA4 (see above)
        pdate = 0x00CFEBA4 (see above)
        pbstrVal = 0x00CFEBA4 (see above)
        ppunkVal = 0x00CFEBA4 (see above)
        ppdispVal = 0x00CFEBA4 (see above)
        pparray = 0x00CFEBA4 (see above)
        pvarVal = 0x00CFEBA4 (see above)
        byref = 0x00CFEBA4 (see above)
        cVal = 164
        uiVal = 60324 (0xEBA4)
        ulVal = 13626276 (0x00CFEBA4)
        ullVal = 58524942375840676 (0x00CFEC2000CFEBA4)
        intVal = 13626276 (0x00CFEBA4)
        uintVal = 13626276 (0x00CFEBA4)
        pdecVal = 0x00CFEBA4 (see above)
        pcVal = 0x00CFEBA4 (see above)
        puiVal = 0x00CFEBA4 (see above)
        pulVal = 0x00CFEBA4 (see above)
        pullVal = 0x00CFEBA4 (see above)
        pintVal = 0x00CFEBA4 (see above)
        puintVal = 0x00CFEBA4 (see above)
        pvRecord = 0x00CFEBA4 (see above)
        pRecInfo = 0x00CFEC20 -> 
            (IUnknown)

        decVal = 
            wReserved = 26159 (0x662F)
            scale = [8] { 129 (0x81), 158 (0x9E), 16 (0x10), 198 (0xC6), 17 (0x11), 0 (0x00), 164 (0xA4), 235 (0xEB) }
            sign = 158 (0x9E)
            signscale = 40577 (0x9E81)
            Hi32 = 1164816 (0x0011C610)
            Lo32 = 13626276 (0x00CFEBA4)
            Mid32 = 13626400 (0x00CFEC20)
            Lo64 = 58524942375840676 (0x00CFEC2000CFEBA4)



win_get_snd_info (wsnd.cpp:130)
    instances = (unsupported vector<map<basic_string<wchar_t,char_traits<wchar_t> >,tagVARIANT > >)
    names = (unsupported set<basic_string<wchar_t,char_traits<wchar_t> > >)
    versionList = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
    dlls = (unsupported set<basic_string<wchar_t,char_traits<wchar_t> > >)

WriteSystemInfo (util.cpp:87)
    cpuClock = 4.43749e-038 (0x382E33333FFE9AFB)
    driverInfo = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
    smbios = (unsupported basic_string<char,char_traits<char> >)
    un = 
        sysname = "622 ms"
        nodename = [16] { 18, 125 ('}'), 11, 10, 0, 0, 0, 15, 0, 0, 0, 0, 38 ('&'), 14, 12, 250 }
        release = [9] { 236, 162, 91 ('['), 0, 0, 16, 0, 0, 0 }
        version = [16] { 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 232, 18, 125 ('}'), 11, 168, 7 }
        machine = [9] { 14, 12, 211, 208, 32 (' '), 193, 232, 194, 182 }

    pathname = 
        path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
        separator = 46640

    cardName = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
    LINE_81_ = 
        m_t0 = 1.91294 (0x3FFE9B633EF10D12)
        m_description = 0x0136EF30 -> "write_sys_info"

    seconds = 4048229410262653691 (0x382E33333FFE9AFB)
    timestampBuf = [100] 
        40 ('(')
        0
        5
        0
        0
        0
        0
        0
        2
        0
        0
        0 ...

InitGraphics (gamesetup.cpp:1029)
    args = (unavailable)
    flags = (unavailable)
    profilerGPUEnable = false
    setup_vmode = false
    context = [2048] 
        192 (0xC0)
        112 (0x70)
        186 (0xBA)
        119 (0x77)
        212 (0xD4)
        239 (0xEF)
        207 (0xCF)
        0 (0x00)
        0 (0x00)
        0 (0x00)
        0 (0x00)
        0 (0x00)
        44 (0x2C)
        0 (0x00)
        0 (0x00)
        0 (0x00) ...
    buf = [500] 
        0
        0
        1088
        0
        63456
        207
        0
        0
        0
        256
        36 ('$')
        0 ...
    context = [2048] 
        192 (0xC0)
        112 (0x70)
        186 (0xBA)
        119 (0x77)
        212 (0xD4)
        239 (0xEF)
        207 (0xCF)
        0 (0x00)
        0 (0x00)
        0 (0x00)
        0 (0x00)
        0 (0x00)
        44 (0x2C)
        0 (0x00)
        0 (0x00)
        0 (0x00) ...
    context = [2048] 
        192 (0xC0)
        112 (0x70)
        186 (0xBA)
        119 (0x77)
        212 (0xD4)
        239 (0xEF)
        207 (0xCF)
        0 (0x00)
        0 (0x00)
        0 (0x00)
        0 (0x00)
        0 (0x00)
        44 (0x2C)
        0 (0x00)
        0 (0x00)
        0 (0x00) ...
    rq = 
        mContext = 0x00000000

    setup_gui = false
    data = 
        { 
                (js::ValueOperations<JS::Rooted<JS::Value> >)
 }
        stack = 0x77BE0000 -> 0xFFFFFDF4 -> 
            (js::RootedBase<void *>)
            stack = (unavailable - internal error)

            prev = (unavailable - internal error)

            ptr = (unavailable - internal error)


        prev = 0xB7D9D451 -> 
            (js::RootedBase<void *>)
            stack = (unavailable - internal error)

            prev = (unavailable - internal error)

            ptr = (unavailable - internal error)


        ptr = 
            data = 
                asBits = 13627564 (0x0000000000CFF0AC)
                s = { payload = 
                        i32 = 13627564 (0x00CFF0AC)
                        u32 = 13627564 (0x00CFF0AC)
                        boo = 13627564 (0x00CFF0AC)
                        str = 0x00CFF0AC -> (JSString)
                        sym = 0x00CFF0AC (see above)
                        obj = 0x00CFF0AC (see above)
                        cell = 0x00CFF0AC (see above)
                        ptr = 0x00CFF0AC (see above)
                        why = 13627564
                        word = 13627564 (0x00CFF0AC)
                        uintptr = 13627564 (0x00CFF0AC)
, tag = 0 }
                asDouble = 6.73291e-317 (0x0000000000CFF0AC)
                asPtr = 0x00CFF0AC (see above)



    scriptInterface = (shared_ptr<ScriptInterface>)
    e = 0x00000000

RunGameOrAtlas (main.cpp:525)
    argc = 2 (0x00000002)
    argv = 0x002A0008 -> 0x002A0028 -> "C:\Users\Roosi\AppData\Local\0 A.D. alpha\binaries\system\pyrogenesis.exe"
    replayFile = (unsupported basic_string<char,char_traits<char> >)
    scriptEngine = 
        (Singleton<ScriptEngine>)
        m_Runtimes = (unsupported list<JSRuntime const * >)

    args = 
        m_Args = (unsupported vector<pair<CStr8,CStr8> >)
        m_Arg0 = 
            path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 92 ('\')


    res = 0 (0x0000000000000000)
    paths = 
        m_root = 
            path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 0

        m_rdata = 
            path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 72 ('H')

        m_gameData = 
            path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 0

        m_userData = 
            path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 0

        m_config = 
            path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 2

        m_cache = 
            path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 8

        m_logs = 
            path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 49840


    replay = 
        m_Stream = 0x00000004

    mod = 
        path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
        separator = 62185

    zip = 
        path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
        separator = 0

    mods = (unsupported vector<CStr8 >)
    paths = 
        m_root = 
            path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 0

        m_rdata = 
            path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 72 ('H')

        m_gameData = 
            path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 0

        m_userData = 
            path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 0

        m_config = 
            path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 2

        m_cache = 
            path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 8

        m_logs = 
            path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 49840


    builder = 
        m_VFS = (shared_ptr<IVFS>)
        m_Files = (unsupported vector<Path >)
        m_TempDir = 
            path = (unsupported basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 64728

        m_NumBaseMods = 2008690282 (0x77BA2E6A)


SDL_main (main.cpp:567)
    argc = 2 (0x00000002)
    argv = 0x002A0008 (see above)

main_utf8 (sdl_windows_main.c:126)
    argc = 2 (0x00000002)
    argv = 0x002A0008 (see above)

wmain (sdl_windows_main.c:151)
    argc = 2 (0x00000002)
    wargv = 0x00113AE0 -> 0x00113AEC -> 67 (0x0043)
    wenvp = 0x0010C948 -> 28528 (0x6F70)
    argv = 0x002A0008 (see above)
    retval = 0 (0x00000000)
    i = 2 (0x00000002)

CallStartupWithinTryBlock (wseh.cpp:364)
    ret = 19542336 (0x012A3140)

RtlGetAppContainerNamedObjectPath (:0)

RtlGetAppContainerNamedObjectPath (:0)


errno = 0 (No error reported here)
OS error = 0 (no error code was set)

Attachments (4)

error.txt (10.8 KB ) - added by elexis 7 years ago.
by Kristian818
snd_detect_openal.patch (19.2 KB ) - added by Itms 7 years ago.
snd_detect_openal_complete_wmi_removal.patch (29.6 KB ) - added by Itms 7 years ago.
snd_detect_minimal.patch (831 bytes ) - added by Itms 7 years ago.

Download all attachments as: .zip

Change History (28)

comment:1 by Stan, 7 years ago

Hello,

Could you attach your system_info.txt, interestinglog.html, and mainlog.html please ?

See GameDataPaths and ReportingErrors Also upload the crash dump.dmp if it exists. Thanks in advance.

Meanwhile try disabling GLSL and postprocessing in the options.

comment:2 by elexis, 7 years ago

See #4569

comment:3 by elexis, 7 years ago

Notice it crashes with className = 0x01396494 -> "Win32_SoundDevice" and your system_info.txt has an empty field at Sound Drivers.

So the issue is that you either don't have sound driver installed at all or it can't detect your sound driver somehow, presumably.

comment:4 by Roosi, 7 years ago

so what can I do?

comment:5 by Stan, 7 years ago

Update your sound drivers maybe ?

comment:6 by Roosi, 7 years ago

They are up to date they are Logitech sound drivers

comment:7 by Stan, 7 years ago

Have you got another soundcard that may conflict or is not properly configured.

Version 0, edited 7 years ago by Stan (next)

comment:8 by elexis, 7 years ago

The system_info.txt entry contains:

Sound Card     : Logitech G430 Gaming Headset; NVIDIA High Definition Audio; NVIDIA Virtual Audio Device (Wave Extensible) (WDM); Realtek High Definition Audio; 

So maybe it just fails for one of them

comment:9 by Roosi, 7 years ago

hm

comment:10 by Stan, 7 years ago

Could you look for a dmp file in the folder ?

comment:12 by elexis, 7 years ago

Milestone: BacklogAlpha 22
Patch: 0.0.21
Priority: Must HaveRelease Blocker

And it was reported a third time today by Kristian818 on #0ad-dev. So we should try to do something about it if possible before many people will experience this.

13:30 < Kristian818> This error started when I switched the game to run on my Nvidia card instead of my intel graphics card
13:31 < bb_> I guess some driver issue... do u have the same problem with other 3d games?
13:31 < Kristian818> Everything is perfectly fine in other games, I have the newest drivers I think, just going to check
13:32 < Kristian818> If I switch the game back to running on my intel graphics card it doesn't error for me
13:32 < Kristian818> but since the intel card is an integrated card it runs very bad on it
13:33 < Kristian818> Any known problems with a laptop switching between graphic cards?
13:35  * bb_ runs 0ad on intel only...
13:35 < Kristian818> Only on intel it works?
13:36 < bb_> ye well intel graphics integrated, but needs put all graphics low, then its ok
13:37 < Kristian818> Well, hope I won't be lagging too much. Anyways thanks for the help. Do you guys plan on making it possible to run it on other cards soon?

by elexis, 7 years ago

Attachment: error.txt added

by Kristian818

comment:13 by elexis, 7 years ago

and again: #4579

comment:14 by Stan, 7 years ago

Looking at the driver date for that above ticket Is say it's pretty recent update (1st of May)

comment:15 by Itms, 7 years ago

Owner: set to Itms

I am also getting the issue since a few days so I should be able to debunk it :)

However I am not on my Windows machine this weekend so you'll have to wait a bit.

comment:16 by echotangoecho, 7 years ago

I looked into this, and it seems that the issue is specific to people who have their displays connected by HDMI (and HDMI includes audio -- this is where the nvidia sound drivers come into play, and there is probably a bug in those) (I can't reproduce the issue myself as my displays are connected by DVI). This seems quite serious, as this means that any combination of nvidia + hdmi + latest driver is now broken.

Now note that the function in which this fails is the function win_get_snd_info(), and I would argue that this function is completely useless -- IMO, the added value of including this information about the sound devices and drivers in the system info and the hardware reports is low (we don't actually do anything directly with sound devices in the game, and even if there is a problem with sound devices, the chances that this would help tracking it down are low).

Why this fails exactly at the CoInitializeSecurity call with the problematic hardware combinations? I have no idea...

in reply to:  16 comment:17 by Itms, 7 years ago

My findings go a bit beyond that. The sound card has little to do with it I think. It so happens that the sound card detection is the first thing to init a module, thus calling CoInitializeSecurity. However this function fails with RPC_E_TOO_LATE (CoInitializeSecurity has already been called - documentation).

Something initializes a COM interface, resulting in the failure. I was able to track down the moment in the code from which CoInitializeSecurity fails by calling it myself: the unwanted COM initialization seems to happen in SDL_CreateWindow, on this line.

Since the users reported performing a driver update, I have to assume a recent nvidia graphics driver somehow initializes a COM interface inside our program when SDL asks it to create a window.

The naive fix I can think of is removing the security initialization and let the program use the default system policy, but that's just ignoring the problem.


Maybe I'm wrong and the sound card has a real influence (the HDMI vs DVI thing gives me some doubt about my findings). To test this I'd suggest moving around the detections in WriteSystemInfo and check the first one fails, even if it's not the sound card.

comment:18 by elexis, 7 years ago

Summary: Game doesnt start!Recent NVidia driver crashing 0AD

comment:19 by elexis, 7 years ago

Refs #4625

comment:20 by Itms, 7 years ago

I have patch(es) for this issue.

The sound card detection is the only thing that uses Windows Management Instrumentation. The sound card detection is working only on Windows (see snd.cpp). We could use OpenAL to detect the card but it gives useless information as stated in the same source file. This is actually not entirely true: the card detection through OpenAL does work on Windows. It detects a different set of cards than the WMI detection though: WMI gives the same list as in the Device Manager, OpenAL gives the same list as in the Control Panel.

I believe we should go with OpenAL detection. We don't care about hardware that is not plugged/activated, and the detection will work on at least as many platforms as just Windows. Additionally, it gives us the driver version, which worked nowhere (broken for me on Win) and would now work everywhere.

If we use that we don't need WMI anymore (we stopped using it for GFX card detection in r13536), so I also join a "complete" version of the patch that removes WMI altogether.

Alternatively, I join a minimal patch that just ignores the issue and prevents the crash.

by Itms, 7 years ago

Attachment: snd_detect_openal.patch added

by Itms, 7 years ago

Attachment: snd_detect_minimal.patch added

comment:21 by Itms, 7 years ago

Patch: D636

After discussing with Philip, the best thing to do is removing WMI altogether, in order to get rid of some legacy code.

If WMI is needed in the future for something more important than sound card detection, the issue could also be fixed by calling the WMI initialization earlier during the game start.

comment:22 by Itms, 7 years ago

Patch: D636Phab:D636

comment:23 by elexis, 7 years ago

Description: modified (diff)

comment:24 by Itms, 7 years ago

Resolution: fixed
Status: newclosed

In 19877:

Stop using WMI for detecting the sound card, and use OpenAL instead. Delete WMI code altogether now it is unused.

This fixes #4561 and makes sound card detection work on non-Windows platforms.

Reviewed By: echotangoecho
Tested By: Imarok, elexis
Differential Revision: https://code.wildfiregames.com/D636

Note: See TracTickets for help on using tickets.