stephenjsweeney / blobwarsAttrition

A C source port of Blob Wars : Attrition
GNU General Public License v3.0
23 stars 6 forks source link

Random crash when quitting the mission #11

Closed thesourcehim closed 6 years ago

thesourcehim commented 6 years ago

Game crashes randomly after endgame when I enter and then exit any mission

0 0x00007ffff69c29a6 in __strlen_sse2 () from /lib64/libc.so.6

No symbol table info available.

1 0x000000000041a496 in cJSON_strdup (str=0x0) at src/json/cJSON.c:63

    len = 50891856
    copy = 0x3088be0 ""

2 0x000000000041d63a in cJSON_CreateString (string=0x0) at src/json/cJSON.c:1276

    item = 0x3088c50

3 0x000000000042d78a in save (root=0x3088a90) at src/entities/unit.c:322

    u = 0x30676f0

4 0x000000000043279d in saveEntities (root=0x30c90e0) at src/world/worldSaver.c:145

    entitiesJSON = 0x306e520
    entityJSON = 0x3088a90

5 0x00000000004323d0 in saveWorld () at src/world/worldSaver.c:55

    root = 0x30c90e0
    filename = 0x30c9130 "/home/thesource/.local/share/blobwarsAttrition/0/outpost5.json"
    out = 0x4239ab <updateMissionStatus+47> "\211\005\177\a#"

6 0x0000000000423932 in initPostMission () at src/hub/postMission.c:79

No locals.

7 0x0000000000430b6c in doWorldComplete () at src/world/world.c:535

No locals.

8 0x0000000000430216 in logic () at src/world/world.c:178

No locals.

9 0x000000000041fbe3 in main (argc=1, argv=0x7fffffffda78) at src/main.c:58

    then = 322954
    nextSecond = 323037
    frames = 55
stephenjsweeney commented 6 years ago

I'll see if I can reproduce this one. Could be tricky, though. From the look of it, the game is crashing when trying to save a unit (enemy), so it's possible the enemy was dying or dead when this happened. They shouldn't be in the linked list any longer, though.

thesourcehim commented 6 years ago

I can't reproduce the crash with the latest commit in develop (atomically save). Looks like it helped. Update: no, sorry, still crashes sometimes.

thesourcehim commented 6 years ago

Just in case, here's call stack with latest development commit

0 0x00007ffff69c29a6 in __strlen_sse2 () from /lib64/libc.so.6

No symbol table info available.

1 0x000000000041a46c in cJSON_strdup (str=0x0) at src/json/cJSON.c:63

    len = 37395936
    copy = 0x23a9d70 ""

2 0x000000000041d610 in cJSON_CreateString (string=0x0) at src/json/cJSON.c:1276

    item = 0x23a9de0

3 0x000000000042d880 in save (root=0x23a9c20) at src/entities/unit.c:322

    u = 0x30788e0

4 0x0000000000432862 in saveEntities (root=0x29cf2c0) at src/world/worldSaver.c:145

    entitiesJSON = 0x29cfc70
    entityJSON = 0x23a9c20

5 0x0000000000432495 in saveWorld () at src/world/worldSaver.c:55

    root = 0x29cf2c0
    filename = 0x2c39c60 "/home/thesource/.local/share/blobwarsAttrition/0/outpost5.json.tmp"
    out = 0x2439c00 ""

6 0x0000000000423942 in saveGameAndWorld () at src/hub/postMission.c:97

    src = 0x2397200 "outpost5"
    dest = 0xc <error: Cannot access memory at address 0xc>

7 0x000000000042390d in initPostMission () at src/hub/postMission.c:76

No locals.

8 0x0000000000430c31 in doWorldComplete () at src/world/world.c:535

No locals.

9 0x00000000004302db in logic () at src/world/world.c:178

No locals.

10 0x000000000041fbc8 in main (argc=1, argv=0x7fffffffda98) at src/main.c:58

    then = 201402
    nextSecond = 201485
    frames = 55
stephenjsweeney commented 6 years ago

Thanks for the trace. I can see what's going on, but I'm not sure why it's happening.

If you're still experiencing the crashes (looks like it's happening in Outpost 5), can you send me your save file? I'll take a look and see what I can find out.

stephenjsweeney commented 6 years ago

I have a hunch this might be due to Teeka being saved, when he's not supposed to be. I've updated the develop branch, but there may be an issue with the save file (that could be fixed by editing).

thesourcehim commented 6 years ago

0.tar.gz

With that commit I could not reproduce the crash for now, I'll test more. During testing I encountered another problem: one time when I pressed quit from mission, Bob disappeared, but mission never ended. Enemies continued to respawn from time to time, no buttons worked, not even escape to call menu. I could not reproduce this however, seems to be very rare.

stephenjsweeney commented 6 years ago

The mission not ending is possibly linked to a save delay mechanism that avoids saving the mission if something is in the process of dying or teleporting (or an MIA is in the middle of their rescue animation).

Do you know which level you were on when this happened? I've not experienced it myself and the code suggestions that it shouldn't block saving for more than a few seconds.

thesourcehim commented 6 years ago

One of the Beach front levels, don't remember which one, sorry.

stephenjsweeney commented 6 years ago

I suspect it might've been something like a laser trap keep an enemy alive by constantly bouncing them about. I've made some changes to develop to prevent that from happening.

thesourcehim commented 6 years ago

I tested more and could not reproduce the crash, I guess it's fixed. You were right about the trap, I just witnessed it happening on beach front 3 just to the right and down from the start, enemy was bouncing from the laser, but after your commit it collapsed after few bounces.