Opened 10 years ago

Closed 10 years ago

#2756 closed defect (fixed)

Game crashing when loading a map

Reported by: Stan Owned by: Itms
Priority: Must Have Milestone: Alpha 17
Component: Core engine Keywords:
Cc: Patch:

Description

Steps to reproduce :

1.Open a 2v2 Map 2.Set all the players to petra very hard 3.Set popcap to 100

  1. Tick All options
  2. Set all the civs to britons for instance
  3. Launch the game
  4. Wait till it crashes. (One or two minutes). Works if you run it on background.

Expected Output :

It shouldn't crash, cause I want to play :P

Possible Reasons :

I have petra set to debug (This is the only modified file in SVN)

What version of the product are you using? On what operating system?

Windows 8.1.1 64bits r15691

Attachments (5)

mainlog.html (43.7 KB ) - added by Stan 10 years ago.
crashlog.dmp (85.0 KB ) - added by Stan 10 years ago.
system_info.txt (17.2 KB ) - added by Stan 10 years ago.
crashlog.txt (18.6 KB ) - added by Stan 10 years ago.
fix.patch (2.0 KB ) - added by Itms 10 years ago.

Download all attachments as: .zip

Change History (8)

by Stan, 10 years ago

Attachment: mainlog.html added

by Stan, 10 years ago

Attachment: crashlog.dmp added

by Stan, 10 years ago

Attachment: system_info.txt added

by Stan, 10 years ago

Attachment: crashlog.txt added

comment:1 by mimo, 10 years ago

I've also experienced crashes on linux when loading the map. Running in the debugger, It seems to be connected to r15681

Program received signal SIGSEGV, Segmentation fault. 0x0000000000530c37 in operator++ (this=<synthetic pointer>) at ../../../source/simulation2/system/EntityMap.h:80 80 while (val->first == INVALID_ENTITY) ++val; skip any invalid entities

(gdb) where #0 0x0000000000530c37 in operator++ (this=<synthetic pointer>) at ../../../source/simulation2/system/EntityMap.h:80 #1 CCmpRangeManager::SeeExploredEntities (this=this@entry=0x2f314d0, p=p@entry=2) at ../../../source/simulation2/components/CCmpRangeManager.cpp:1648 #2 0x000000000053107f in CCmpRangeManager::ExploreTerritories (this=0x2f314d0) at ../../../source/simulation2/components/CCmpRangeManager.cpp:1638 #3 0x0000000000528662 in call<void (ICmpRangeManager::*)()> (fptr=&virtual ICmpRangeManager::ExploreTerritories(), c=<optimized out>)

at ../../../source/scriptinterface/NativeWrapperDefns.h:72

#4 ScriptInterface::callMethod<void, &class_ICmpRangeManager, ICmpRangeManager, &ICmpRangeManager::ExploreTerritories> (cx=0x2a42520, argc=<optimized out>,

vp=0xe69a38) at ../../../source/scriptinterface/NativeWrapperDefns.h:126

#5 0x00007ffff6d546a4 in CallJSNative (args=..., native=<optimized out>, cx=0x2a42520) at ../jscntxtinlines.h:321 #6 js::Invoke (cx=cx@entry=0x2a42520, args=..., construct=construct@entry=js::NO_CONSTRUCT)

at /data/kubuntu/jeux/0ad/svnbak/libraries/source/spidermonkey/mozjs24/js/src/vm/Interpreter.cpp:481

#7 0x00007ffff6d57247 in Interpret (cx=cx@entry=0x2a42520, state=...)

at /data/kubuntu/jeux/0ad/svnbak/libraries/source/spidermonkey/mozjs24/js/src/vm/Interpreter.cpp:2298

#8 0x00007ffff6d62508 in js::RunScript (cx=0x2a42520, state=...)

at /data/kubuntu/jeux/0ad/svnbak/libraries/source/spidermonkey/mozjs24/js/src/vm/Interpreter.cpp:438

#9 0x00007ffff6d5465a in js::Invoke (cx=cx@entry=0x2a42520, args=..., construct=construct@entry=js::NO_CONSTRUCT)

at /data/kubuntu/jeux/0ad/svnbak/libraries/source/spidermonkey/mozjs24/js/src/vm/Interpreter.cpp:500

#10 0x00007ffff6d64513 in js::Invoke (cx=cx@entry=0x2a42520, thisv=..., fval=..., argc=argc@entry=1, argv=argv@entry=0x7fffffffd4a8,

rval=rval@entry=0x7fffffffd460) at /data/kubuntu/jeux/0ad/svnbak/libraries/source/spidermonkey/mozjs24/js/src/vm/Interpreter.cpp:531

#11 0x00007ffff6e0d310 in JS_CallFunctionName (cx=0x2a42520, objArg=<optimized out>, name=name@entry=0x8f88ab "InitGame", argc=argc@entry=1,

argv=argv@entry=0x7fffffffd4a8, rval=rval@entry=0x7fffffffd460) at /data/kubuntu/jeux/0ad/svnbak/libraries/source/spidermonkey/mozjs24/js/src/jsapi.cpp:5625

#12 0x0000000000559cae in ScriptInterface::CallFunction_ (this=this@entry=0x2a42868, val=val@entry=..., name=name@entry=0x8f88ab "InitGame",

argc=argc@entry=1, argv=0x7fffffffd4a8, ret=ret@entry=...) at ../../../source/scriptinterface/ScriptInterface.cpp:945

#13 0x000000000046fd18 in ScriptInterface::CallFunctionVoid<CScriptVal> (this=0x2a42868, val=val@entry=..., name=name@entry=0x8f88ab "InitGame", a0=...)

at ../../../source/scriptinterface/ScriptInterface.h:489

#14 0x000000000046e321 in CSimulation2::InitGame (this=0x2a4e4a0, data=...) at ../../../source/simulation2/Simulation2.cpp:663 #15 0x0000000000593792 in CGame::ReallyStartGame (this=0x2a48890) at ../../../source/ps/Game.cpp:229 #16 0x00000000004258f7 in ProgressiveLoad () at ../../../source/main.cpp:223 #17 Frame () at ../../../source/main.cpp:316 #18 RunGameOrAtlas (argc=argc@entry=3, argv=argv@entry=0x7fffffffdb18) at ../../../source/main.cpp:510 #19 0x0000000000418f17 in main (argc=3, argv=0x7fffffffdb18) at ../../../source/main.cpp:554 (gdb)

comment:2 by Itms, 10 years ago

Owner: set to Itms

Thanks a lot for the backtrace. This is a mistake I already did before about fogging codes.

For information, one should never trigger code like "ForceMiraging" or post visibility update messages inside an iteration over the entities map, because these codes can lead to entities destruction (when mirages come into sight for example). So trying to access directly elements on the map can create segfaults.

I'll commit a fix tomorrow and I'll explain that somewhere in the source to prevent me or someone else from making the mistake later.

by Itms, 10 years ago

Attachment: fix.patch added

comment:3 by Itms, 10 years ago

Resolution: fixed
Status: newclosed

In 15692:

Don't call miraging codes while iterating through the range manager's entities map.
I already had made that mistake when working on the fogging system so I documented it in the code.

Fixes #2756

Note: See TracTickets for help on using tickets.