Page 1 of 1

Missing upper limit for character_loot_pickup_distance_bonus

Posted: Tue Jul 18, 2017 7:19 pm
by Mooncat
Bug:
Setting LuaForce.character_loot_pickup_distance_bonus to a large number can possibly freeze the computer.
It may be the same as LuaControl::character_loot_pickup_distance_bonus.

Steps to reproduce:
Note - the following may freeze your computer, such that you may need to do a hard reboot if you can't kill Factorio.exe.

1. Start a game.
2. Set LuaForce.character_loot_pickup_distance_bonus to a large number, e.g. 1e+06 or even larger.

I have accidentally frozen my computer by setting force.character_loot_pickup_distance_bonus to 1e+06. I hard rebooted it 4 times before knowing what happened.
(I know why doing so cause this issue, but I didn't aware I did that.)

Expected behaviour:
Please throw me an error rather than freezing my computer if character_loot_pickup_distance_bonus is larger than 1e+05.
Image
(Or throw error if UPS is too low, etc.)

Edit: maybe also limit for LuaForce::character_item_pickup_distance_bonus and LuaControl::character_item_pickup_distance_bonus

Re: Missing upper limit for character_loot_pickup_distance_bonus

Posted: Tue Jul 18, 2017 7:32 pm
by TruePikachu
Does the process freeze with 0% single-core usage or 100% single-core usage?

Re: Missing upper limit for character_loot_pickup_distance_bonus

Posted: Tue Jul 18, 2017 7:35 pm
by Mooncat
TruePikachu wrote:Does the process freeze with 0% single-core usage or 100% single-core usage?
I don't know. Couldn't even open task manager.

Re: Missing upper limit for character_loot_pickup_distance_bonus

Posted: Tue Jul 18, 2017 9:43 pm
by Rseding91
TruePikachu wrote:Does the process freeze with 0% single-core usage or 100% single-core usage?
It would max the CPU to 100% of a single core and eat a ton of RAM :P

I'll add an artificial limit to it. I also fixed the loot mechanic to not create chunks when looking for loot around the player (which is why it locked up for you - ran out of RAM and started paging to disk).

Re: Missing upper limit for character_loot_pickup_distance_bonus

Posted: Tue Jul 18, 2017 11:04 pm
by Mooncat
Rseding91 wrote:
TruePikachu wrote:Does the process freeze with 0% single-core usage or 100% single-core usage?
It would max the CPU to 100% of a single core and eat a ton of RAM :P

I'll add an artificial limit to it. I also fixed the loot mechanic to not create chunks when looking for loot around the player (which is why it locked up for you - ran out of RAM and started paging to disk).
Thanks!