Opened 13 years ago

Closed 13 years ago

#899 closed defect (fixed)

snd_mgr causes crash at exit and during game

Reported by: historic_bruno Owned by:
Priority: Release Blocker Milestone: Alpha 8
Component: Core engine Keywords:
Cc: Jan Wassenberg Patch:

Description

OS: WinXP

Build: [9845] release or debug in VS2008 express


I can reproduce the first error by simply exiting the game:

Function call failed: return value was -100022 (Invalid handle)
Location: h_mgr.cpp:763 (h_force_free)

Call stack:

h_force_free (h_mgr.cpp:763)
    h = 42949673666 (0x0000000A000002C2)
    type = 0x00643298 -> 
        init = 0x00402CE0 -> (UniqueRangeDeleterNone)
        reload = 0x0041BC60 -> (SndData_reload)
        dtor = 0x0041AC60 -> (SndData_dtor)
        validate = 0x00419270 -> (SndData_validate)
        to_string = 0x00418510 -> (SndData_to_string)
        user_size = 24 (0x00000018)
        name = 0x005E6BF0 -> "SndData"


hsd_list_free_all (snd_mgr.cpp:861)

al_shutdown (snd_mgr.cpp:650)

Shutdown (gamesetup.cpp:664)
    __formal = 0 (0x00000000)
    LINE_624_ = 
        m_t0 = 7.21416e-307 (0x00603608402BC9C3)
        m_description = 0x005BA13D -> [8] { 50307, 32788, 52285, 25875, 0, 5493, 42125, 36 ('$') }

    LINE_629_ = 
        m_t0 = 7.21416e-307 (0x00603608402BC9C3)
        m_description = 0x005BA13D (see above)

    LINE_634_ = 
        m_t0 = 7.21416e-307 (0x00603608402BC9C3)
        m_description = 0x005BA13D (see above)

    LINE_641_ = 
        m_t0 = 7.21416e-307 (0x00603608402BC9C3)
        m_description = 0x005BA13D (see above)

    LINE_647_ = 
        m_t0 = 7.21416e-307 (0x00603608402BC9C3)
        m_description = 0x005BA13D (see above)

    LINE_651_ = 
        m_t0 = 7.21416e-307 (0x00603608402BC9C3)
        m_description = 0x005BA13D (see above)

    LINE_655_ = 
        m_t0 = 7.21416e-307 (0x00603608402BC9C3)
        m_description = 0x005BA13D (see above)

    LINE_661_ = 
        m_t0 = 7.21416e-307 (0x00603608402BC9C3)
        m_description = 0x005BA13D (see above)

    LINE_674_ = 
        m_t0 = 7.21416e-307 (0x00603608402BC9C3)
        m_description = 0x005BA13D (see above)


RunGameOrAtlas (main.cpp:493)
    argc = 1 (0x00000001)
    argv = 0x093F5880 -> 0x093F5990 -> "C:\devel\0ad\ps\binaries\system\pyrogenesis.exe"
    args = 
        m_Args = (error -100500 while analyzing vector<pair<CStr8,CStr8> >)
        m_Arg0 = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 576


    paths = 
        m_root = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 65068

        m_rdata = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 22823

        m_data = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 0

        m_config = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 0

        m_cache = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 65204

        m_logs = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 331


    replay = 
        m_Stream = 0x00000001

    mod = 
        path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
        separator = 65128

    zip = 
        path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
        separator = 4

    paths = 
        m_root = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 65068

        m_rdata = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 22823

        m_data = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 0

        m_config = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 0

        m_cache = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 65204

        m_logs = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 331


    builder = 
        m_VFS = 
            px = 0x00000000
            pn = 
                pi_ = 0x00000002


        m_Files = (error -100500 while analyzing vector<Path >)
        m_TempDir = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 47 ('/')



main (main.cpp:511)
    argc = 1 (0x00000001)
    argv = 0x093F5880 (see above)

wmain (wseh.cpp:380)
    argc = 1 (0x00000001)
    argv = 0x093F5210 -> 0x093F5218 -> "C:\devel\0ad\ps\binaries\system\pyrogenesis.exe"
    utf8_argv = (error -100500 while analyzing vector<char * >)
    ret = 6009910 (0x005BB436)
    utf8 = (error -100500 while analyzing string >)

__tmainCRTStartup (crtexe.c:583)
    nested = 0 (0x00000000)

CallStartupWithinTryBlock (wseh.cpp:397)
    ret = 2766642449 (0xA4E79D11)

RegisterWaitForInputIdle (:0)


errno = 0 (No error reported here)
OS error = 2 (The system cannot find the file specified.)

The second error occurs during the game, seemingly when I do something to trigger a sound, like tasking units to move or gather a resource.

Function call failed: return value was -100010 (Logic error in code)
Location: snd_mgr.cpp:114 (al_ReportError)

Call stack:

al_ReportError (snd_mgr.cpp:114)
    err = 40964 (0x0000A004)
    caller = 0x005E6E10 -> "al_buf_free"
    line = 436 (0x000001B4)

al_buf_free (snd_mgr.cpp:436)
    al_buf = 854772512 (0x32F2CB20)

h_reload (h_mgr.cpp:715)
    vfs = 0x0064F2EC -> 
        px = 0x093F64D0 -> (IVFS)
        pn = 
            pi_ = 0x093F7210 -> 
                use_count_ = 4 (0x00000004)
                weak_count_ = 1 (0x00000001)



    pathname = 0xEBDE1DD3 -> 
        path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
        separator = (unavailable - internal error)


    ret = 21675767935008767 (0x004D01FEFFFFFFFF)
    key = 4010463037 (0xEF0ACF3D)
    h = 23358192525442160 (0x0052FC270012FC70)

ReloadChangedFiles (filesystem.cpp:87)
    notifications = (error -100500 while analyzing vector<DirWatchNotification >)
    pathname = 
        path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
        separator = 53005


Frame (main.cpp:296)
    need_update = (bool)0x44
    TimeSinceLastFrame = -0.000000 (0x80000000)
    need_render = (bool)0x3E
    down = [3] { -0.866025 (0xBF5DB3D7), -0.500000 (0xBF000000), 0.000000 (0x0012FEB8) }

RunGameOrAtlas (main.cpp:492)
    argc = 1 (0x00000001)
    argv = 0x093F5880 -> 0x093F5990 -> "C:\devel\0ad\ps\binaries\system\pyrogenesis.exe"
    args = 
        m_Args = (error -100500 while analyzing vector<pair<CStr8,CStr8> >)
        m_Arg0 = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 576


    paths = 
        m_root = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 65068

        m_rdata = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 22823

        m_data = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 0

        m_config = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 0

        m_cache = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 65204

        m_logs = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 53133


    replay = 
        m_Stream = 0x00000001

    mod = 
        path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
        separator = 65128

    zip = 
        path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
        separator = 4

    paths = 
        m_root = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 65068

        m_rdata = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 22823

        m_data = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 0

        m_config = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 0

        m_cache = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 65204

        m_logs = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 53133


    builder = 
        m_VFS = 
            px = 0x00000000
            pn = 
                pi_ = 0x00000002


        m_Files = (error -100500 while analyzing vector<Path >)
        m_TempDir = 
            path = (error -100500 while analyzing basic_string<wchar_t,char_traits<wchar_t> >)
            separator = 47 ('/')



main (main.cpp:511)
    argc = 1 (0x00000001)
    argv = 0x093F5880 (see above)

wmain (wseh.cpp:380)
    argc = 1 (0x00000001)
    argv = 0x093F5210 -> 0x093F5218 -> "C:\devel\0ad\ps\binaries\system\pyrogenesis.exe"
    utf8_argv = (error -100500 while analyzing vector<char * >)
    ret = 6009910 (0x005BB436)
    utf8 = (error -100500 while analyzing string >)

__tmainCRTStartup (crtexe.c:583)
    nested = 0 (0x00000000)

CallStartupWithinTryBlock (wseh.cpp:397)
    ret = 1606451003 (0x5FC07F3B)

RegisterWaitForInputIdle (:0)


errno = 0 (No error reported here)
OS error = 2 (The system cannot find the file specified.)

Change History (7)

comment:1 by Jan Wassenberg, 13 years ago

This is mystifying. You mean just launch the game, see the main menu and quit? Needless to say, that works on my machine as well ;) (and no, I'm not running with -quickstart nor -nosound)

We can at least explain the UniqueRangeDeleterNone thing - !SndData_init is a no-op, so apparently the COMDAT is getting folded with UniqueRangeDeleterNone (another no-op). Maybe your error message is from a release build, but it doesn't matter either way.

It's great that the recently fixed stack traces are now giving some more useful information, at least. That handle is the 11th slot, which has apparently been reused more than 500 times. Interesting but plausible. However, what I need to know to diagnose this is what exactly failed on line 762 of h_mgr. Is that handle simply invalid (i.e. no such index or the tag is outdated) or is its type incorrect? Would you please fire up the debugger and put a breakpoint on h_mgr!763 to find out?

comment:2 by historic_bruno, 13 years ago

Thanks for taking a look, I'll try that as soon as possible :)

comment:3 by Jan Wassenberg, 13 years ago

(In [9961]) cleanup and simplification of the really old h_mgr code. replace array-of-pages data structure with demand-committed VM => allows simple allocation of new resources without having to search for the first free index. I suspect the cause of multiple reported bugs (refs #860, #899, #915) was a race. Most issues are fixed, but the pool's freelist also needs to be made thread-safe and lock-free. this has performance and 64-bit portability implications, so I'll leave it for later (Pool is due for some serious refactoring anyway).

please post a comment if this or similar issues persist.

comment:4 by Kieran P, 13 years ago

Milestone: BacklogAlpha 7

comment:5 by Kieran P, 13 years ago

Priority: Should HaveRelease Blocker

comment:6 by historic_bruno, 13 years ago

Milestone: Alpha 7Alpha 8

I only encountered this error on a borrowed laptop, so I'm afraid debugging it will have to wait until after A7 (luckily it doesn't seem to be a very common error). In about three weeks I'll be able to work on it.

comment:7 by historic_bruno, 13 years ago

Resolution: fixed
Status: newclosed

Seems to be fixed :)

Note: See TracTickets for help on using tickets.