[0.12.30] [kovarex] crash after error message in multiplayer

This subforum contains all the issues which we already resolved.
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

[0.12.30] [kovarex] crash after error message in multiplayer

Post by prg »

Use something like

Code: Select all

require "defines"
script.on_event(defines.events.on_tick, function(event)
    if #game.players > 0 and event.tick % 60 == 0 then game.player.print("foo") end
end)
Start a new multiplayer game.
Have someone join.
Close the resulting error message on the second system. This properly returns to the menu.
Watch the "peers are not responding" bar fill.
Once the second player gets dropped, the game crashes with this helpful stacktrace:

Code: Select all

  44.844 Warning Thread.cpp:42: Thread exception: Error while running the event handler: __bla__/control.lua:9: Map doesn't contain 1 player, this function can't be used.
Factorio crashed. Generating symbolized stacktrace, please wait ...
#0  0x7f06ffd212f0 in ?? at ??:0
#1  0x7f070087abc9 in ?? at ??:0
  46.713 Error Util.cpp:78: Unexpected error occurred. You can help us to solve the problem by posting the contents of the log file on the Factorio forums.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
User avatar
TruePikachu
Filter Inserter
Filter Inserter
Posts: 978
Joined: Sat Apr 09, 2016 8:39 pm
Contact:

Re: [0.12.30] crash after error message in multiplayer

Post by TruePikachu »

Firstly, `game.player` is only usable in single player. I'll assume you know this, since you also reference `game.players` in your test code.
Is this the headless server?
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: [0.12.30] crash after error message in multiplayer

Post by prg »

TruePikachu wrote:Firstly, `game.player` is only usable in single player. I'll assume you know this, since you also reference `game.players` in your test code.
Yes, the error message itself is not the problem. The crash afterwards is.
TruePikachu wrote:Is this the headless server?
prg wrote:Watch the "peers are not responding" bar fill.
No, this is with the GUI client as host.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
User avatar
TruePikachu
Filter Inserter
Filter Inserter
Posts: 978
Joined: Sat Apr 09, 2016 8:39 pm
Contact:

Re: [0.12.30] crash after error message in multiplayer

Post by TruePikachu »

I'll see if I can reproduce in 0.12.29, and if so I'll have a debugger ready to try to get a better idea of what's happening (like why the callstack can't be symbolized automatically).

EDIT: Reproduced in 0.12.29, looks like a null pointer deref, getting call stack right now. The error message came up on both systems, I didn't close it on the server, which crashed into WinDbg.

EDIT: Full call stack, as seen by WinDbg under 0.12.29:

Code: Select all

0:017> kp
Child-SP          RetAddr           Call Site
00000000`0b4dd028 00000001`4068a85b atio6axx!DrvPresentBuffers+0x1c4dfa8
00000000`0b4dd030 00000001`4068aec5 Factorio!al_remove_opengl_fbo(struct ALLEGRO_BITMAP * bitmap = 0x00000000`387b62b0)+0x5b [c:\cygwin64\tmp\factorio-vbn8ul\libraries\allegro\src\opengl\ogl_bitmap.c @ 1248]
00000000`0b4dd060 00000001`405f81a8 Factorio!ogl_destroy_bitmap(struct ALLEGRO_BITMAP * bitmap = 0x00000000`387b62b0)+0xb5 [c:\cygwin64\tmp\factorio-vbn8ul\libraries\allegro\src\opengl\ogl_bitmap.c @ 699]
00000000`0b4dd090 00000001`40638508 Factorio!al_destroy_bitmap(struct ALLEGRO_BITMAP * bitmap = 0x00000000`387b62b0)+0xd8 [c:\cygwin64\tmp\factorio-vbn8ul\libraries\allegro\src\bitmap.c @ 234]
00000000`0b4dd0c0 00000001`405fe2d0 Factorio!_al_run_destructors(struct _AL_DTOR_LIST * dtors = 0x00000000`0d424670)+0x58 [c:\cygwin64\tmp\factorio-vbn8ul\libraries\allegro\src\dtor.c @ 119]
00000000`0b4dd0f0 00000001`40199347 Factorio!al_uninstall_system(void)+0x10 [c:\cygwin64\tmp\factorio-vbn8ul\libraries\allegro\src\system.c @ 314]
00000000`0b4dd120 00000001`40747358 Factorio!doexit(int code = 0n-1, int quick = 0n189657840, int retcaller = 0n0)+0xd3 [f:\dd\vctools\crt\crtw32\startup\crt0dat.c @ 628]
00000000`0b4dd190 00000001`401c7170 Factorio!`Thread::loop'::`1'::catch$1+0xc8 [c:\cygwin64\tmp\factorio-vbn8ul\src\util\thread.cpp @ 46]
00000000`0b4dd1e0 00000001`401a563d Factorio!_CallSettingFrame(void)+0x20 [f:\dd\vctools\crt\crtw32\eh\amd64\handlers.asm @ 51]
00000000`0b4dd210 00000000`774dd351 Factorio!__CxxCallCatchBlock(struct _EXCEPTION_RECORD * pExcept = 0x00000000`0b4ddf40)+0xf5 [f:\dd\vctools\crt\crtw32\eh\frame.cpp @ 1281]
00000000`0b4dd2e0 00000001`401e939b ntdll!RcFrameConsolidation+0x3
00000000`0b4dfb50 00000001`4012f883 Factorio!Thread::loop(void)+0xfb [c:\cygwin64\tmp\factorio-vbn8ul\src\util\thread.cpp @ 34]
00000000`0b4dfc70 00000001`401a0daf Factorio!boost::`anonymous namespace'::thread_start_function+0x43
00000000`0b4dfcb0 00000001`401a0f56 Factorio!_callthreadstartex(void)+0x17 [f:\dd\vctools\crt\crtw32\startup\threadex.c @ 376]
00000000`0b4dfce0 00000000`77285a4d Factorio!_threadstartex(void * ptd = 0x00000000`2ffe9b90)+0x102 [f:\dd\vctools\crt\crtw32\startup\threadex.c @ 354]
00000000`0b4dfd10 00000000`774bb831 kernel32!BaseThreadInitThunk+0xd
00000000`0b4dfd40 00000000`00000000 ntdll!RtlUserThreadStart+0x1d
The crash seems to be unrelated to the attempt to access `game.player`, but rather graphics-related when dropping a player while a dialog is on screen.

EDIT: Replaced the backtrace with one consistant to a memory dump I just made

EDIT: The issue appears to be a call to `glDeleteFramebuffers()` from a thread where `glContext` is null. Specifically, thread 17 issued the problematic call, while thread 0 is the only one which has a non-null `glContext`.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5290
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.12.30] crash after error message in multiplayer

Post by Klonan »

Thanks for the report,

Seems like setting a script to use game.player in a MP game causes it to crash...

Something like this

Code: Select all

/c script.on_event(defines.events.on_tick, function (event) game.player.print("hi") end)
Might crash in MP, very least cause a desync,
Can't reproduce on my own i guess
kovarex
Factorio Staff
Factorio Staff
Posts: 8207
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.12.30] [kovarex] crash after error message in multiplayer

Post by kovarex »

It required high will, but it is fixed for the next release.
Post Reply

Return to “Resolved Problems and Bugs”