Opened 12 years ago

Closed 12 years ago

#1361 closed defect (fixed)

Qbot hangs ~2s into custom-made map

Reported by: vts Owned by:
Priority: Should Have Milestone: Alpha 10
Component: Core engine Keywords:
Cc: Patch:

Description (last modified by vts)

While developing the wall placement system, I created the attached map to do some basic testing. At some point during approximately the last two weeks (call it roughly between [11494] and [11672]), something changed that caused the game to go into what looks like an infinite JS loop about 2 seconds into the map, when using qbot as the AI. This happens only when the window has focus but regardless of the user's activity, and I haven't seen this happen on other maps, nor does it happen for other AIs like Jubot.

By "hangs", I mean becomes unresponsive and takes up 100% CPU, requiring to be killed from the process monitor. I've observed this happening for revision [11683], the most recent revision at the time of writing.

Attaching WinDbg in a debug build during the hang shows that it's hanging somewhere in SpiderMonkey as a result of a call to ScriptInterface::CallFunction_ while doing some AI work.

WARNING: Stack unwind information not available. Following frames may be wrong.
mozjs185_ps_debug_1_0!JS_StrictPropertyStub+0x41210
mozjs185_ps_debug_1_0!JS_StrictPropertyStub+0x84e55
mozjs185_ps_debug_1_0!JS_StrictPropertyStub+0xe488f
mozjs185_ps_debug_1_0!JS_StrictPropertyStub+0xd0306
mozjs185_ps_debug_1_0!JS_StrictPropertyStub+0xd0977
mozjs185_ps_debug_1_0!JS_StrictPropertyStub+0xd1a34
mozjs185_ps_debug_1_0!JS_StrictPropertyStub+0x2f889
pyrogenesis_dbg!ScriptInterface::CallFunction_(unsigned int64 val = 0xffff0007`0ed263f0, char * name = 0x011c7564 "HandleMessage", unsigned int argc = 1, unsigned int64 * argv = 0x0030e428, unsigned int64 * ret = 0x0030e438)+0xbf
pyrogenesis_dbg!ScriptInterface::CallFunctionVoid<CScriptVal>(unsigned int64 val = 0xffff0007`0ed263f0, char * name = 0x011c7564 "HandleMessage", class CScriptVal * a0 = 0x0030e46c)+0x62
pyrogenesis_dbg!CAIWorker::CAIPlayer::Run(class CScriptVal state = class CScriptVal)+0x3a
pyrogenesis_dbg!CAIWorker::PerformComputation(void)+0x1cd
pyrogenesis_dbg!CAIWorker::WaitToFinishComputation(void)+0x24
pyrogenesis_dbg!CAIWorker::GetCommands(class std::vector<CAIWorker::SCommandSets,std::allocator<CAIWorker::SCommandSets> > * commands = 0x0030e548)+0x20
pyrogenesis_dbg!CCmpAIManager::PushCommands(void)+0x6a
pyrogenesis_dbg!CSimulation2Impl::UpdateComponents(class CSimContext * simContext = 0x0ca83990, class CFixed<int,2147483647,32,15,16,65536> turnLengthFixed = class CFixed<int,2147483647,32,15,16,65536>, class std::vector<SimulationCommand,std::allocator<SimulationCommand> > * commands = 0x0030f0ac)+0xe3
pyrogenesis_dbg!CSimulation2Impl::Update(int turnLength = 0n200, class std::vector<SimulationCommand,std::allocator<SimulationCommand> > * commands = 0x0030f0ac)+0x23a
pyrogenesis_dbg!CSimulation2::Update(int turnLength = 0n200, class std::vector<SimulationCommand,std::allocator<SimulationCommand> > * commands = 0x0030f0ac)+0x20
pyrogenesis_dbg!CNetTurnManager::Update(float frameLength = 0.1439294964, unsigned int maxTurns = 1)+0x430
pyrogenesis_dbg!CGame::Update(double deltaTime = 0.14392949640750885, bool doInterpolate = true)+0xed
pyrogenesis_dbg!Frame(void)+0x2b3
pyrogenesis_dbg!RunGameOrAtlas(int argc = 0n1, char ** argv = 0x02846fb0)+0x637
pyrogenesis_dbg!main(int argc = 0n1, char ** argv = 0x02846fb0)+0x15
pyrogenesis_dbg!wmain(int argc = 0n1, wchar_t ** argv = 0x02845c20)+0xfa
pyrogenesis_dbg!__tmainCRTStartup(void)+0x1bf
pyrogenesis_dbg!wmainCRTStartup(void)+0xf
pyrogenesis_dbg!CallStartupWithinTryBlock(void)+0x54
pyrogenesis_dbg!wseh_EntryPoint(void)+0xd
kernel32!BaseThreadInitThunk+0x12
ntdll!RtlInitializeExceptionChain+0x63
ntdll!RtlInitializeExceptionChain+0x36

The code at CAIWorker::CAIPlayer::Run runs

m_ScriptInterface.CallFunctionVoid(m_Obj.get(), "HandleMessage", state);

Indicating that some AI computation in qbot is going into a loop.

Attaching to a release build shows similar results: also in SpiderMonkey, after a result to a script interface call with the HandleMessage function name.

Attachments (1)

WallTest.zip (3.0 KB ) - added by vts 12 years ago.
Contains WallTest.pmp and WallTest.xml.

Download all attachments as: .zip

Change History (7)

by vts, 12 years ago

Attachment: WallTest.zip added

Contains WallTest.pmp and WallTest.xml.

comment:1 by vts, 12 years ago

Description: modified (diff)

comment:2 by vts, 12 years ago

Description: modified (diff)

comment:3 by vts, 12 years ago

Description: modified (diff)

comment:4 by vts, 12 years ago

Description: modified (diff)
Summary: Game hangs ~2s into custom-made mapQbot hangs ~2s into custom-made map

comment:5 by vts, 12 years ago

Description: modified (diff)

comment:6 by Jonathan Waller, 12 years ago

Milestone: BacklogAlpha 10
Resolution: fixed
Status: newclosed

Fixed in [11684]

Note: See TracTickets for help on using tickets.