Hi,
I develop a new mod, and trid -by mistake - to write in readonly values (i.e. entity.train and entity.train.status).
As a consequence, instead of displaying a little message, close the current game and let me reload it immediatly, the soft crashed.
Attached the log of the crash.
Thanks
Crash by writing in readonly value
Crash by writing in readonly value
- Attachments
-
- crash Factorio.txt
- (2.93 KiB) Downloaded 42 times
Re: Crash by writing in readonly value
It looks like you tried to write to the variables during an event - possibly train created?
If you want to get ahold of me I'm almost always on Discord.
Re: Crash by writing in readonly value
Hi,
I confirm that my code was wrong. My point is, it shouldn't crash, just display a message. Since, I had other issues, like writing a status of a train, adding an attribute to a LuaEntity that doesn't exist, with the same result: Crash of Factorio, instead of displaying a nice, friendly message and letting me try again.
Said otherwise, Factorio overreacts
Thanks
Niko
P.S: The event is raised by a combination of keys, and the purpose is to destroy entities to recreate them with a new picture.
I confirm that my code was wrong. My point is, it shouldn't crash, just display a message. Since, I had other issues, like writing a status of a train, adding an attribute to a LuaEntity that doesn't exist, with the same result: Crash of Factorio, instead of displaying a nice, friendly message and letting me try again.
Said otherwise, Factorio overreacts
Thanks
Niko
P.S: The event is raised by a combination of keys, and the purpose is to destroy entities to recreate them with a new picture.
Re: Crash by writing in readonly value
Yes, it's meant to show an error and put you back on the main menu. However, I'm trying to figure out how it crashed instead. Based off the stack trace in the log file you uploaded I'm speculating your code was running inside of some train related event when it errored?
And as such, it left the train in a partially invalid state and crashed later trying to use the invalid train?
And as such, it left the train in a partially invalid state and crashed later trying to use the invalid train?
If you want to get ahold of me I'm almost always on Discord.
Re: Crash by writing in readonly value
Sorry, I misunderstood your point.
I just made a test by removing every other mod related to trains (This one only reacts on combination of keys) and... same crash (In my example, this is because I try to iterate on a nil value). So this has nothing to do with events for trains. However, when this event is raised, a locomotive is destroyed and a new one is created, with my character in it. Besides, when I did the same with other vehicles (tank and car), no such crash.
So it is probably related to trains, at the end of the day.
I just made a test by removing every other mod related to trains (This one only reacts on combination of keys) and... same crash (In my example, this is because I try to iterate on a nil value). So this has nothing to do with events for trains. However, when this event is raised, a locomotive is destroyed and a new one is created, with my character in it. Besides, when I did the same with other vehicles (tank and car), no such crash.
So it is probably related to trains, at the end of the day.
Re: Crash by writing in readonly value
Can you upload a simple mod + steps that reproduces the issue?
If you want to get ahold of me I'm almost always on Discord.
Re: Crash by writing in readonly value
Attached the mod, and my sandbox game.
Just type "SHIFT+I", which triggers the event, and here comes the crash!
Just type "SHIFT+I", which triggers the event, and here comes the crash!
- Attachments
-
- sandbox_base.zip
- (1.92 MiB) Downloaded 47 times
-
- Ninjario_0.1.1.zip
- (44.57 KiB) Downloaded 49 times
Re: Crash by writing in readonly value
Thanks for the save and easy steps to reproduce it. It's now fixed for 0.17.
If you want to get ahold of me I'm almost always on Discord.
Re: Crash by writing in readonly value
Great, you are aweseome guys!
Thanks
Thanks