[0.18.32] Crash iterating through all chunks: "LuaHelper::pushTilePosition"

This subforum contains all the issues which we already resolved.
calcwizard
Burner Inserter
Burner Inserter
Posts: 16
Joined: Sat Apr 20, 2019 6:30 am
Contact:

[0.18.32] Crash iterating through all chunks: "LuaHelper::pushTilePosition"

Post by calcwizard »

After creating a ChunkIterator with LuaSurface.get_chunks(), reading all the chunks from it (so that it returns nil), then generating new chunk and trying to read it again causes a game (not script) crash. Specifically, it looks like the new chunks have to be to the south-east, as just south or east doesn't seem cause a crash. Waiting for the chunk generator doesn't prevent the crash, so it doesn't appear to have to do with that.

Steps to recreate:
  1. Start a new map, ideally in sandbox
  2. run a command to create a new iterator and read all the chunks

    Code: Select all

    /c iterator = game.player.surface.get_chunks()
    while iterator() do end
  3. move far south-east to generate new chunks, about 10 chunks southeast of the initially-charted area works reliably
  4. run a command to access the iterator

    Code: Select all

    /c iterator()
Attachments
factorio-current.log
(13.27 KiB) Downloaded 157 times
justarandomgeek
Filter Inserter
Filter Inserter
Posts: 302
Joined: Fri Mar 18, 2016 4:34 pm
Contact:

Re: [0.18.32] Crash iterating through all chunks: "LuaHelper::pushTilePosition"

Post by justarandomgeek »

I also looked into this a little and it seems to me that what is happening is that when the InfiniteRectangleIterator is being re-initialized for a new call to iterator(), it sometimes takes a path that leaves ->position on it null, but does *not* set the ended status, which later leads to that null pointer being read in an attempt to push that position to lua. Also, the stack trace in the log lists the crash occurring in pushTilePosition, but it actually occurs in pushChunkPosition, the bodies of the two are identical apart from the kind of position type they take, I suspect this is just compilers being "clever".
Rseding91
Factorio Staff
Factorio Staff
Posts: 14594
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.18.32] Crash iterating through all chunks: "LuaHelper::pushTilePosition"

Post by Rseding91 »

Thanks for the report. It's now fixed for the next release.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved Problems and Bugs”