acreloaded / acr

AssaultCube Reloaded (first-person-shooter game)
https://acr.victorz.ca
127 stars 23 forks source link

Bot Waypoint (A*) Crash #189

Open ruler501 opened 9 years ago

ruler501 commented 9 years ago

When playing on longhorn CTF(confirm, hardcore modifiers) with bots(I tested with 8v1 and 12v1 so far) the game crashes within two minutes.

stacktrace: /run/media/devon/Share/C++/ACR/acr/bin_unix/native_client(+0x137ac0) [0x7f15418a8ac0] /lib64/libc.so.6(+0x35000) [0x7f153f1df000] /run/media/devon/Share/C++/ACR/acr/bin_unix/native_client(+0xc3839) [0x7f1541834839] /run/media/devon/Share/C++/ACR/acr/bin_unix/native_client(+0xc404c) [0x7f154183504c] /run/media/devon/Share/C++/ACR/acr/bin_unix/native_client(+0xcab6d) [0x7f154183bb6d] /run/media/devon/Share/C++/ACR/acr/bin_unix/native_client(+0xcd47a) [0x7f154183e47a] /run/media/devon/Share/C++/ACR/acr/bin_unix/native_client(+0xbd1fc) [0x7f154182e1fc] /run/media/devon/Share/C++/ACR/acr/bin_unix/native_client(+0xc1bba) [0x7f1541832bba] /run/media/devon/Share/C++/ACR/acr/bin_unix/native_client(+0xada73) [0x7f154181ea73] /run/media/devon/Share/C++/ACR/acr/bin_unix/native_client(main+0xa83) [0x7f1541787223] /lib64/libc.so.6(__libc_start_main+0x114) [0x7f153f1ca1e4] /run/media/devon/Share/C++/ACR/acr/bin_unix/native_client(+0x1d7ac) [0x7f154178e7ac] ACR error (11) (Couldn't open packages/maps/preview/warroom.jpg)

That's the relevant stacktrace without debugging enabled. I'll test with debugging and see if I can figure out where in the code this is occurring.

EDIT: Doesn't appear to happen when debugging is enabled and optimization is turned off. I'll keep looking into it.

theonlypwner commented 9 years ago

It would be much easier if the stacktrace had debug symbols.

ruler501 commented 9 years ago

I tried duplicating with debugging turned on and couldn't. I'm still trying to find out what's going on in between classes.

On Sun, Aug 23, 2015 at 10:11 PM Victor notifications@github.com wrote:

It would be much easier if the stacktrace had debug symbols.

— Reply to this email directly or view it on GitHub https://github.com/acreloaded/acr/issues/189#issuecomment-134002251.

theonlypwner commented 9 years ago

Is it possible to duplicate this with debug mode off but symbols on?

ruler501 commented 9 years ago

I'll try that when I get the chance.

On Mon, Aug 24, 2015 at 4:54 PM Victor notifications@github.com wrote:

Is it possible to duplicate this with debug mode off but symbols on?

— Reply to this email directly or view it on GitHub https://github.com/acreloaded/acr/issues/189#issuecomment-134391779.

theonlypwner commented 8 years ago

For me, it seems to crash within a minute (similar to what you described) on ac_complex.

I was able to get a stack trace, but I couldn't use the debugger: the mouse wasn't working (probably related to how the game hides the mouse cursor).

debugger crash

It looks like bots have memory leaks when heading to some item pickups.

theonlypwner commented 8 years ago

Compiling in Release mode, I get a dialog box saying something about Couldn't open packages/maps/preview/acr_recreation.jpg, and the debugger breaks at main.cpp:21

void cleanup(char *msg)         // single program exit point;
{
    if(!msg)
    {
        cleanupclient();
        audiomgr.soundcleanup();
        cleanupserver();

        extern void cleargamma();
        cleargamma();
    }
    SDL_ShowCursor(1);
    if(msg)
    {
        #ifdef WIN32
        MessageBox(NULL, msg, "ACR fatal error", MB_OK|MB_SYSTEMMODAL|MB_ICONERROR);
        #else // <-- the debugger points here
        printf("%s", msg);
        #endif
    }
    SDL_Quit();
}

But if I break before that happens, I find that memory usage spikes up and the debugger points to the same place as in Debug mode. The trick is to set the map (for me, to ac_complex, but you might be able to use longhorn) and use /sleep 2000 "botbalance 256". Then quickly ALT+TAB out of the game so that it doesn't lock up your mouse. Also, in cube > Properties > Configuration Properties > Debugging, change Working Directory to ../.. and Command Arguments to --home=home --mod=acr --init.

release crash

Note that the this pointer is NULL this time, but I manually pressed break in the debugger. In the Debug version, it did an automatic break and the this pointer was not NULL.

I'm going to see if I can find the cause of this memory leak.

theonlypwner commented 8 years ago

I temporarily fixed it by checking the linked lists for cycles before copying them. The real source of the bug needs to be found though.

The linked lists are probably built incorrectly (there is a cycle when there should not be), or a flag (maybe bIsClosed) is not set properly.

I use this command before I ALT+TAB to the debugger: /sleep 2000 "dm ac_complex;botbalance 256;gamespeed 1000"

theonlypwner commented 8 years ago

Commit b31602a508b79e0491f5bed031073bf9443a19b5 fixes the crashes before addressing this issue (in 28ab7c0203466dbbb14c0e38d6ea73b6a5448971 before 9203225d1e15c676bb9ea047a09b4359bc2d64bd)

I tested on longhorn, but I couldn't get crashes like on ac_complex.

Not fixed yet: 28ab7c0203466dbbb14c0e38d6ea73b6a5448971 Temporarily fixed: 9203225d1e15c676bb9ea047a09b4359bc2d64bd ... Better temporary fix: b31602a508b79e0491f5bed031073bf9443a19b5

theonlypwner commented 8 years ago

This is temporarily fixed, but the actual fix is postponed to 2.6.4.

theonlypwner commented 6 years ago

The actual fix is postponed again.