[0.16.51] Lua access violation crash

Things that has been reported already before.
dominis
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Oct 18, 2018 3:57 pm
Contact:

[0.16.51] Lua access violation crash

Post by dominis »

Hey, I ran into this crash developing a mod.

Steps to reproduce:

1. Run these three commands in succession
2. Game will crash on the third one (100% success rate for me)

Code: Select all

/c

function func()
  local sf = game.surfaces[1]
  local find_entities_filtered = sf.find_entities_filtered

  local find_entities_filtered_area = { {-10,-10}, {10,10} }
  local find_entities_filtered_params = { type = types, area = find_entities_filtered_area }

  local function fn()
    return find_entities_filtered(find_entities_filtered_params)
  end

  return fn
end

Code: Select all

/c f = func()

Code: Select all

/c

local N = 100000

for i = 1, N do
  f()
end
I don't think the game should crash here. Maybe if the reference to sf wasn't captured in a closure it'd make more sense. Looks like there's bug when accessing a cached member of a game object. This is reproducible with game.players[1].force.is_chunk_charted too, but its likely not limited to a particular method.
Attachments
factorio-current.log
(8.87 KiB) Downloaded 58 times
Bilka
Factorio Staff
Factorio Staff
Posts: 3310
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [0.16.51] Lua access violation crash

Post by Bilka »

Duplicate of 57490
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Post Reply

Return to “Duplicates”