Page 1 of 1

SpriteDrawOrder segfault

Posted: Thu May 11, 2017 5:28 pm
by brejc8
Running 0.028 2017-05-11 18:18:02; Factorio 0.15.10 (build 29654, linux64, alpha)
I'm got a segfault during a game and the autosave for a minute earlier can reproduce it immediately upon loading.

Code: Select all

#3  0x00007fb66d730990 in ?? at ??:0
#4  0x00000000004b6166 in SpriteDrawOrder::SpriteDrawOrder(Sprite const&, RenderParameters const&, RealPosition const&, RealOrientation const&, Vector const&, float, float, int, ALLEGRO_COLOR, float, float, float, float) at /tmp/factorio-cm8NEd/src/Graphics/SpriteDrawOrder.cpp:14

Valgrind complains about an unrecognised instruction:

Code: Select all

vex amd64->IR: unhandled instruction bytes: 0xFB 0xF 0x11 0x7C 0x24 0x88 0x8B 0x41 0x4 0xF3
vex amd64->IR:   REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR:   VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=NONE
vex amd64->IR:   PFX.66=0 PFX.F2=0 PFX.F3=0
==3170== valgrind: Unrecognised instruction at address 0x4b6166.
==3170==    at 0x4B6166: SpriteDrawOrder::SpriteDrawOrder(Sprite const&, RenderParameters const&, RealPosition const&, RealOrientation const&, Vector const&, float, float, int, ALLEGRO_COLOR, float, float, float, float) [clone .constprop.114279] (SpriteDrawOrder.cpp:14)
==3170==    by 0x5C726C: create<SpriteDrawOrder, const Sprite&, const RenderParameters&, const RealPosition&, const RealOrientation&, const Vector&, double&, double&, int&, ALLEGRO_COLOR, int, int, short int, short int> (DrawQueue.cpp:98)
==3170==    by 0x5C726C: DrawQueue::drawScaled(Sprite const&, RealPosition const&, double, double, int, unsigned char, Vector const&, signed char) [clone .constprop.114277] (DrawQueue.cpp:490)
==3170==    by 0x7BE238: TileRenderer::renderTile(Tile const*, TilePosition&, ConstTileProxy&, Player const*, TilePosition, bool*, ID<TilePrototype, unsigned char>*, unsigned long) [clone .constprop.109065] (Tile.cpp:226)
==3170==    by 0x7BEDF8: TileRenderer::renderTilesInternal(ConstTileProxy&, Player const*, RealPosition, RealPosition) [clone .constprop.109064] (TileRenderer.cpp:483)
==3170==    by 0x7BF20F: TileRenderer::prepare(RenderData const&) (TileRenderer.cpp:57)
==3170==    by 0xAA5D1F: GameRenderer::prepare(RenderData const&) (GameRenderer.cpp:152)
==3170==    by 0xE3FC9F: MainLoop::prepare() (GameView.cpp:896)
==3170==    by 0xE42D64: MainLoop::run(boost::filesystem::path const&, boost::filesystem::path const&, bool, bool, bool, std::function<void ()>, boost::filesystem::path const&, MainLoop::HeavyMode) (MainLoop.cpp:396)
==3170==    by 0xEB2F45: main (Main.cpp:909)
To reproduce simply load the savegame

Re: SpriteDrawOrder segfault

Posted: Thu May 11, 2017 6:38 pm
by brejc8
OK, After a reboot the problem goes away. This is strange as it feels like the binary was temporarily corrupted. This is either a kernel bug or a memory issue but unlikely a factorio issue.

Re: SpriteDrawOrder segfault

Posted: Thu May 11, 2017 6:39 pm
by Rseding91
When I load the save it works just fine - no crashes. Are you sure that's the right save file?

Does it still happen if you load that save?

Re: SpriteDrawOrder segfault

Posted: Thu May 11, 2017 6:40 pm
by Rseding91
brejc8 wrote:OK, After a reboot the problem goes away. This is strange as it feels like the binary was temporarily corrupted. This is either a kernel bug or a memory issue but unlikely a factorio issue.
Try running this: http://www.memtest.org/

Re: SpriteDrawOrder segfault

Posted: Fri May 12, 2017 10:32 am
by brejc8
Hi. I left memtest running for a few hours and nothing came up.
Looking at the disassembly of the file:

Code: Select all

  4b6166:	f3 0f 11 7c 24 88    	movss  %xmm7,-0x78(%rsp)
  4b616c:	8b 41 04             	mov    0x4(%rcx),%eax
and comparing to the valgrind output

Code: Select all

unhandled instruction bytes: 0xFB 0xF 0x11 0x7C 0x24 0x88 0x8B 0x41 0x4 0xF3
it looks like a single bit flip from F3 to FB which must be a hardware fault. The kernel must have cached the binary in memory. I will leave memtest running overnight, but yeah this isn't a Factorio bug. Either a freak Alpha particle or factorio know how to stress my machine more than memtest.

Thanks for your help.

Re: SpriteDrawOrder segfault

Posted: Fri May 12, 2017 11:07 am
by Arch666Angel
brejc8 wrote:..Either a freak Alpha particle or factorio know how to stress my machine more than memtest..
Image

I hope that wont happen again for you.