MantisBT - Zandronum
View Issue Details
0001841Zandronum[All Projects] Bugpublic2014-06-16 17:092018-09-30 23:08
Zalewa 
Torr Samaho 
normalmajoralways
closedfixed 
MicrosoftWindowsXP/Vista/7
2.0-beta 
2.02.0 
0001841: Zandronum 2.0 r140112-1124: Memory leak and crash in offline Survival on MAPINFO/monsters
This is a memory leak in a something that looks like an infinite loop and it eventually leads to a crash. The provided WAD has two key elements: MAPINFO and 2 monsters. Although I didn't pinpoint the exact reason for the crash, I know of two alternative ways that this WAD can be fixed so that it won't cause the crash anymore:
a) Remove one of the monsters from the map so that only one remains.
b) Remove MAPINFO lump from the WAD.
1. Load attached WAD in Zandronum 2.0 r140112-1124 (offline mode).
2. Type "survival 1" in console.
3. Type "map map03" in console.
4. Wait until countdown finishes, don't do anything.
5. Game should freeze now.
This was originally discovered in a WAD called "ph_jstc.wad" by James "Phobus" Cresswell. I'm unable to find the original WAD on the web at the moment, although I managed to strip my version to the minimum.

Crash also happens when hosted on a server in which case it kicks the client and then kills the server.
No tags attached.
has duplicate 0001979closed  Russian Overkill causes a crash 
? memory_leak_crash_survival_zan_2.0.wad (6,161) 2014-06-16 17:09
/tracker/file_download.php?file_id=1230&type=bug
? ResetFreezeFix (897) 2014-11-30 20:49
/tracker/file_download.php?file_id=1336&type=bug
Issue History
2014-06-16 17:09ZalewaNew Issue
2014-06-16 17:09ZalewaFile Added: memory_leak_crash_survival_zan_2.0.wad
2014-06-16 17:10ZalewaAdditional Information Updatedbug_revision_view_page.php?rev_id=5015#r5015
2014-06-16 17:16ZalewaDescription Updatedbug_revision_view_page.php?rev_id=5017#r5017
2014-06-16 17:16ZalewaAdditional Information Updatedbug_revision_view_page.php?rev_id=5018#r5018
2014-06-16 17:41DuskNote Added: 0009523
2014-06-16 17:41DuskStatusnew => confirmed
2014-06-16 17:54DuskNote Added: 0009525
2014-06-16 17:59DuskNote Edited: 0009525bug_revision_view_page.php?bugnote_id=9525#r5020
2014-06-16 18:45Edward-sanNote Added: 0009526
2014-11-03 21:27DuskProduct Version2.0 => 2.0-beta
2014-11-03 21:30DuskRelationship addedhas duplicate 0001979
2014-11-23 14:33Torr SamahoNote Added: 0010942
2014-11-23 14:33Torr SamahoAssigned To => Torr Samaho
2014-11-23 14:33Torr SamahoStatusconfirmed => needs testing
2014-11-24 14:12ArcoNote Added: 0010952
2014-11-24 14:12ArcoStatusneeds testing => resolved
2014-11-24 14:12ArcoResolutionopen => fixed
2014-11-24 14:12ArcoFixed in Version => 2.0
2014-11-24 14:12ArcoTarget Version => 2.0
2014-11-24 19:16DuskNote Added: 0010955
2014-11-24 19:16DuskStatusresolved => feedback
2014-11-24 19:16DuskResolutionfixed => reopened
2014-11-24 19:18ArcoNote Edited: 0010952bug_revision_view_page.php?bugnote_id=10952#r6017
2014-11-24 19:21Torr SamahoNote Added: 0010958
2014-11-24 22:46DuskStatusfeedback => assigned
2014-11-24 22:46DuskFixed in Version2.0 =>
2014-11-30 20:49Torr SamahoFile Added: ResetFreezeFix
2014-11-30 20:50Torr SamahoNote Added: 0011014
2014-12-31 11:15Torr SamahoNote Added: 0011147
2014-12-31 11:16Torr SamahoStatusassigned => needs testing
2014-12-31 14:27Edward-sanNote Added: 0011154
2015-01-12 06:39DuskNote Added: 0011367
2015-01-12 06:39DuskStatusneeds testing => resolved
2015-01-12 06:39DuskFixed in Version => 2.0
2015-01-12 06:39DuskResolutionreopened => fixed
2018-09-30 23:08Blzut3Statusresolved => closed

Notes
(0009523)
Dusk   
2014-06-16 17:41   
Quote

[2014-16-06 20:40:24] <WaTaKiD> anyways i can confirm that ticket
[2014-16-06 20:40:26] <WaTaKiD> Execution could not continue.
[2014-16-06 20:40:27] <WaTaKiD> Could not malloc 712 bytes

[2014-16-06 20:40:56] <WaTaKiD> tried taking a screenshot of the error which seems different for online
[2014-16-06 20:41:03] <WaTaKiD> and it decided to crash again <_>
(0009525)
Dusk   
2014-06-16 17:54   
(edited on: 2014-06-16 17:59)
The crash happens during the map reset while trying to spawn one of the pinkies.


Program received signal SIGINT, Interrupt.
0x000000000070511e in ACTOR_GetNewNetID ()
    at /home/crimson/src/zandronum/src/p_mobj.cpp:4498
4498 } while ( g_NetIDList[g_ulFirstFreeNetID].bFree == false );
(gdb)
(gdb) bt
#0 0x000000000070511e in ACTOR_GetNewNetID ()
    at /home/crimson/src/zandronum/src/p_mobj.cpp:4498
#1 0x00000000007059a7 in AActor::StaticSpawn (type=0x1e97a90, ix=22806528,
    iy=-13828096, iz=-2147483648, allowreplacement=NO_REPLACE,
    SpawningMapThing=false) at /home/crimson/src/zandronum/src/p_mobj.cpp:4714
0000002 0x0000000000596c02 in Spawn (type=0x1e97a90, x=22806528, y=-13828096,
    z=-2147483648, allowreplacement=NO_REPLACE)
    at /home/crimson/src/zandronum/src/actor.h:1206
0000003 0x0000000000625b1a in GAME_ResetMap (bRunEnterScripts=false)
    at /home/crimson/src/zandronum/src/g_game.cpp:3829
0000004 0x00000000007c622a in SURVIVAL_DoFight ()
    at /home/crimson/src/zandronum/src/survival.cpp:253
0000005 0x00000000007c5f26 in SURVIVAL_Tick ()
    at /home/crimson/src/zandronum/src/survival.cpp:137
0000006 0x000000000061f405 in G_Ticker ()
    at /home/crimson/src/zandronum/src/g_game.cpp:1655
0000007 0x00000000005fbfca in TryRunTics ()
    at /home/crimson/src/zandronum/src/d_net.cpp:1864
0000008 0x00000000005f3aea in D_DoomLoop ()
    at /home/crimson/src/zandronum/src/d_main.cpp:1246
0000009 0x00000000005f6fc5 in D_DoomMain ()
    at /home/crimson/src/zandronum/src/d_main.cpp:2831
0000010 0x0000000000585857 in main (argc=3, argv=0x7fffffffe498)
    at /home/crimson/src/zandronum/src/sdl/i_main.cpp:288


(0009526)
Edward-san   
2014-06-16 18:45   
Yeah, the game is stuck inside the actor reloading loop inside GAME_ResetMap, as if there is an infinitely number of actors to iterate via ActorIterator.
(0010942)
Torr Samaho   
2014-11-23 14:33   
Interesting. In 2.0, TThinkerIterator<AActor> doesn't seem to like if we create new actors while iterating over all actors in the example wad. This should fix the issue.
(0010952)
Arco   
2014-11-24 14:12   
(edited on: 2014-11-24 19:18)
Issue fixed in r141117-2018.
 
EDIT:

[10:01] <Arco> I just used the latest beta a while ago and it was working.
[10:02] <Arco> I'll post the changeset.
[10:03] <Arco> Changeset: EF3A40828F3F
[10:05] <edward-san> I can still reproduce the problem
[10:05] <Arco> Huh.
[10:06] <edward-san> eh, the changeset matches
[10:06] <edward-san> which os?
[10:06] <Arco> I see.
[10:06] <Arco> It's a porblem with the os it seems.
[10:07] <Arco> Windows.
[10:07] <Arco> It looks like it's fixed on my end but not yours apparently.


(0010955)
Dusk   
2014-11-24 19:16   
It seems this crash is back.


Program received signal SIGINT, Interrupt.
0x0000000000664681 in AActor::StaticSpawn (type=<optimized out>, ix=14680064, iy=-16777216, iz=-2147483648, allowreplacement=<optimized out>,
    SpawningMapThing=<optimized out>) at /home/crimson/dev/zandronum-sandbox/src/p_mobj.cpp:4823
4823 if (level.flags & LEVEL_NOALLIES && !actor->player)
(gdb) bt
#0 0x0000000000664681 in AActor::StaticSpawn (type=<optimized out>, ix=14680064, iy=-16777216, iz=-2147483648, allowreplacement=<optimized out>,
    SpawningMapThing=<optimized out>) at /home/crimson/dev/zandronum-sandbox/src/p_mobj.cpp:4823
#1 0x00000000005b1c8d in Spawn (allowreplacement=<optimized out>, z=<optimized out>, y=<optimized out>, x=<optimized out>, type=<optimized out>)
    at /home/crimson/dev/zandronum-sandbox/src/./actor.h:1230
0000002 GAME_ResetMap (bRunEnterScripts=160, bRunEnterScripts@entry=false) at /home/crimson/dev/zandronum-sandbox/src/g_game.cpp:3883
0000003 0x00000000006f733c in SURVIVAL_DoFight () at /home/crimson/dev/zandronum-sandbox/src/survival.cpp:253
0000004 0x00000000005b4fe7 in G_Ticker () at /home/crimson/dev/zandronum-sandbox/src/g_game.cpp:1675
0000005 0x00000000005952b1 in TryRunTics () at /home/crimson/dev/zandronum-sandbox/src/d_net.cpp:1865
0000006 0x000000000059075d in D_DoomLoop () at /home/crimson/dev/zandronum-sandbox/src/d_main.cpp:1261
0000007 0x0000000000592a5f in D_DoomMain () at /home/crimson/dev/zandronum-sandbox/src/d_main.cpp:2994
0000008 0x000000000051d0b1 in main (argc=3, argv=0x7fffffffdbf8) at /home/crimson/dev/zandronum-sandbox/src/sdl/i_main.cpp:336
(0010958)
Torr Samaho   
2014-11-24 19:21   
I didn't commit the fix anywhere since it's still experimental. The only binary that contains the fix is the Windows binary I posted above, so it's not surprising if a build that you compiled yourself crashes.
(0011014)
Torr Samaho   
2014-11-30 20:50   
I attached the diff of the patch so that this can be tested under Linux.
(0011147)
Torr Samaho   
2014-12-31 11:15   
Since apparently nobody is going to test the diff I posted a month ago, I pushed the fix without further testing.
(0011154)
Edward-san   
2014-12-31 14:27   
Whoops, sorry for the missing feedback... it works with that patch in linux, too.
(0011367)
Dusk   
2015-01-12 06:39   
Works fine for me too.