[0.17.79] Crash while saving, in lua (table expected)

Things that we don't consider worth fixing at this moment.
Post Reply
User avatar
1000101
Burner Inserter
Burner Inserter
Posts: 13
Joined: Thu Oct 08, 2015 9:14 am
Contact:

[0.17.79] Crash while saving, in lua (table expected)

Post by 1000101 » Tue Dec 03, 2019 6:32 am

There's an old mod I absolutely love, Logistics Wagons, which was abandoned a long time ago. I have been working on updating it to 0.17 which has been going well and it work except...

When I place a wagon, drive the train, stop the train, save, drive the train, stop the train, save - it crashes on this second save. This isn't the game just throwing a lua error, it's doing a hard crash to desktop.

The log file gives virtually unusable information related to this error as follows (log is excerpted from the last valid save and the end of the crash):

Code: Select all

 107.121 Info AppManagerStates.cpp:1802: Saving finished
 110.217 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:removeProxy()
 110.217 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:emptyProxy()
 110.219 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:removeProxy()
 110.219 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:emptyProxy()
 110.219 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:removeProxy()
 110.219 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:emptyProxy()
 110.220 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:removeProxy()
 110.220 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:emptyProxy()
 110.220 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:removeProxy()
 110.220 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:emptyProxy()
 110.223 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:removeProxy()
 110.223 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:emptyProxy()
 110.223 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:removeProxy()
 110.223 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:emptyProxy()
 110.223 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:removeProxy()
 110.223 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:emptyProxy()
 110.224 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:removeProxy()
 110.224 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:emptyProxy()
 113.805 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:createProxy() :: lw-logistic-chest-storage-provider-trans
 113.805 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:getProxyPosition()
 113.805 Script @__LogisticsWagons__/control.lua:14: Creating lw-logistic-chest-storage-provider-trans at -84.3359375 108
 113.805 Script @__LogisticsWagons__/control.lua:14: Proxy created
 113.805 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:createProxy() :: lw-logistic-chest-storage-provider-trans
 113.805 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:getProxyPosition()
 113.805 Script @__LogisticsWagons__/control.lua:14: Creating lw-logistic-chest-storage-provider-trans at -77.3359375 108
 113.805 Script @__LogisticsWagons__/control.lua:14: Proxy created
 113.805 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:createProxy() :: lw-logistic-chest-storage-provider-trans
 113.805 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:getProxyPosition()
 113.805 Script @__LogisticsWagons__/control.lua:14: Creating lw-logistic-chest-storage-provider-trans at -70.3359375 108
 113.805 Script @__LogisticsWagons__/control.lua:14: Proxy created
 113.805 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:createProxy() :: lw-logistic-chest-storage-provider-trans
 113.805 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:getProxyPosition()
 113.805 Script @__LogisticsWagons__/control.lua:14: Creating lw-logistic-chest-storage-provider-trans at -56.3359375 108
 113.805 Script @__LogisticsWagons__/control.lua:14: Proxy created
 113.805 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:createProxy() :: lw-logistic-chest-storage-provider-trans
 113.805 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:getProxyPosition()
 113.805 Script @__LogisticsWagons__/control.lua:14: Creating lw-logistic-chest-storage-provider-trans at -49.3359375 108
 113.805 Script @__LogisticsWagons__/control.lua:14: Proxy created
 113.805 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:createProxy() :: lw-logistic-chest-storage-provider-trans
 113.805 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:getProxyPosition()
 113.806 Script @__LogisticsWagons__/control.lua:14: Creating lw-logistic-chest-storage-provider-trans at -42.3359375 108
 113.806 Script @__LogisticsWagons__/control.lua:14: Proxy created
 113.806 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:createProxy() :: lw-logistic-chest-storage-provider-trans
 113.806 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:getProxyPosition()
 113.806 Script @__LogisticsWagons__/control.lua:14: Creating lw-logistic-chest-storage-provider-trans at -35.3359375 108
 113.806 Script @__LogisticsWagons__/control.lua:14: Proxy created
 113.806 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:createProxy() :: lw-logistic-chest-storage-provider-trans
 113.806 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:getProxyPosition()
 113.806 Script @__LogisticsWagons__/control.lua:14: Creating lw-logistic-chest-storage-provider-trans at -28.3359375 108
 113.806 Script @__LogisticsWagons__/control.lua:14: Proxy created
 113.806 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:createProxy() :: lw-logistic-chest-storage-provider-trans
 113.806 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:getProxyPosition()
 113.806 Script @__LogisticsWagons__/control.lua:14: Creating lw-logistic-chest-storage-provider-trans at -63.3359375 108
 113.806 Script @__LogisticsWagons__/control.lua:14: Proxy created
 119.539 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.539 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.541 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.541 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.544 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.544 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.545 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.545 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.546 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.546 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.548 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.548 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.550 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.550 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.550 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.550 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.551 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.551 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.551 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.551 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.551 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.551 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.551 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.551 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.551 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.551 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.551 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.551 Script @__LogisticsWagons__/control.lua:14: ProxyWagon:updateDataSerialization()
 119.552 ((((t))->tt_) == (((5) | (1 << 6)))) table expected
Factorio crashed. Generating symbolized stacktrace, please wait ...
c:\cygwin64\tmp\factorio-build-kcbfya\libraries\stackwalker\stackwalker.cpp (924): StackWalker::ShowCallstack
c:\cygwin64\tmp\factorio-build-kcbfya\src\util\logger.cpp (537): Logger::writeStacktrace
c:\cygwin64\tmp\factorio-build-kcbfya\src\util\logger.cpp (544): Logger::logStacktrace
c:\cygwin64\tmp\factorio-build-kcbfya\src\util\crashhandler.cpp (184): CrashHandler::writeStackTrace
c:\cygwin64\tmp\factorio-build-kcbfya\src\util\crashhandler.cpp (612): CrashHandler::SignalHandler
minkernel\crts\ucrt\src\appcrt\misc\signal.cpp (541): raise
minkernel\crts\ucrt\src\appcrt\startup\abort.cpp (71): abort
c:\cygwin64\tmp\factorio-build-kcbfya\libraries\lua\lstate.c (280): lua_traceandabort
c:\cygwin64\tmp\factorio-build-kcbfya\libraries\lua\lapi.c (1224): lua_next
c:\cygwin64\tmp\factorio-build-kcbfya\src\util\luahelper.cpp (374): LuaHelper::clearTable
c:\cygwin64\tmp\factorio-build-kcbfya\src\script\luaobject.cpp (62): LuaObject::refresh
c:\cygwin64\tmp\factorio-build-kcbfya\src\script\luagamescript.cpp (687): LuaGameScript::saveScriptState
c:\cygwin64\tmp\factorio-build-kcbfya\src\script\luacontext.cpp (234): LuaContext::save
c:\cygwin64\tmp\factorio-build-kcbfya\src\scenario\scenario.cpp (880): Scenario::saveAs
c:\cygwin64\tmp\factorio-build-kcbfya\src\scenario\parallelscenariosaver.cpp (99): ParallelScenarioSaver::doSave
c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.15.26726\include\thr\xthread (230): std::_LaunchPad<std::unique_ptr<std::tuple<void (__cdecl RazerChromaController::*)(void),RazerChromaController *>,std::default_delete<std::tuple<void (__cdecl RazerChromaController::*)(void),RazerChromaController *> > > >::_Go
c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.15.26726\include\thr\xthread (209): std::_Pad::_Call_func
minkernel\crts\ucrt\src\appcrt\startup\thread.cpp (115): thread_start<unsigned int (__cdecl*)(void * __ptr64)>
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 000000007701652D)
000000007701652D (kernel32): (filename not available): BaseThreadInitThunk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 000000007724C521)
000000007724C521 (ntdll): (filename not available): RtlUserThreadStart
Stack trace logging done
 124.305 Error CrashHandler.cpp:189: Map tick at moment of crash: 7486773
 124.305 Error Util.cpp:97: Unexpected error occurred. If you're running the latest version of the game you can help us solve the problem by posting the contents of the log file on the Factorio forums.
Please also include the save file(s), any mods you may be using, and any steps you know of to reproduce the crash.
 132.881 Error CrashHandler.cpp:245: Heap validation: success.
 132.882 Creating crash dump.
 133.028 CrashDump success
The start of the second save (triggering the crash) is timestamped 119.552 which tells me "table expected" but what is shows isn't linked to anything (ie, table expected what, where, etc).

Code: Select all

119.552 ((((t))->tt_) == (((5) | (1 << 6)))) table expected
I am assuming the error is somewhere in the process of removing the proxy chest and updating the serialization for the second save, but I can't see what the issue is.

The mod is too big for a forum attachment apparently so a dropbox link is below, any help would be very much appreciated.

https://www.dropbox.com/s/bkdfg7oxnbp22 ... .0.7z?dl=0
Last edited by 1000101 on Tue Dec 03, 2019 10:23 pm, edited 1 time in total.
There are 10 kinds of people in this world, those that understand binary and those that don't.

Bilka
Factorio Staff
Factorio Staff
Posts: 2338
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Need help with crash on save (updating an older mod)

Post by Bilka » Tue Dec 03, 2019 7:02 am

Moved to bug reports because of the hard crash.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
1000101
Burner Inserter
Burner Inserter
Posts: 13
Joined: Thu Oct 08, 2015 9:14 am
Contact:

Re: [0.17.79] Crash while saving, in lua (table expected)

Post by 1000101 » Tue Dec 03, 2019 10:24 pm

It it helps, I can provide a crash dump and full log, but I think I provided enough steps to reproduce with the mod attached to the initial post.
There are 10 kinds of people in this world, those that understand binary and those that don't.

gabberworld
Long Handed Inserter
Long Handed Inserter
Posts: 62
Joined: Sat Aug 17, 2019 11:06 pm
Contact:

Re: [0.17.79] Crash while saving, in lua (table expected)

Post by gabberworld » Wed Dec 04, 2019 10:58 am

don't search that table expected error too long, that error message comes at from exe self

yeah it is bad error message, as it only tells table expected and nothing else

i think that it's not only error what comes at exe self what makes you scratch head

maybe you need remove some simple mistakes first like commas what not needed, maybe helps maybe not

Honktown
Filter Inserter
Filter Inserter
Posts: 309
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: [0.17.79] Crash while saving, in lua (table expected)

Post by Honktown » Wed Dec 04, 2019 6:37 pm

If I may be of assistance, it might be useful to add something like:
log(serpent.block(self)

to proxywagon, between line 32 and 33, just after update data serialization. I get the impression you have nine logistic trains, and update data serialization should run for each one, which implies there should only be nine runs of ProxyWagon:updateDataSerialization(). If that's the case, there's garbage data being saved/loaded/not-removed/etc, which would easily cause a crash.

Rseding91
Factorio Staff
Factorio Staff
Posts: 10038
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.79] Crash while saving, in lua (table expected)

Post by Rseding91 » Wed Dec 04, 2019 8:31 pm

Thanks for the report. I went to look over the mod and found 2 things:

1. It's overriding __pairs() on one of the tables it uses and trying to use coroutine - which is completely removed from the version of Lua that Factorio ships. If that line is ever executed it will just error on calling nil.

2. It's overriding __len() on one of the tables its using and mutating the data during the call. None of the Lua logic is setup to expect that calculating the length of a table invalidates other data and so it crashes because it's doing that.

Both of those should be just deleted from the mod. It doesn't need either of them and all of that functionality can be gotten by just using simple functions.

In this case, it's crashing because the mod decided to do something it should never have even tried to do and is over-complicating what should have been simple logic.
If you want to get ahold of me I'm almost always on Discord.

gabberworld
Long Handed Inserter
Long Handed Inserter
Posts: 62
Joined: Sat Aug 17, 2019 11:06 pm
Contact:

Re: [0.17.79] Crash while saving, in lua (table expected)

Post by gabberworld » Wed Dec 04, 2019 10:48 pm

this what happens when vandalize the original Lua, those who know that language sometime have no idea that some stuff missing by default at here

User avatar
1000101
Burner Inserter
Burner Inserter
Posts: 13
Joined: Thu Oct 08, 2015 9:14 am
Contact:

Re: [0.17.79] Crash while saving, in lua (table expected)

Post by 1000101 » Wed Dec 04, 2019 11:16 pm

Rseding91 wrote:In this case, it's crashing because the mod decided to do something it should never have even tried to do and is over-complicating what should have been simple logic.
I won't deny that the original mod over-complicated things.

Anyway, thanks for the help everyone, I'll see what I can do to remove all nonsense with the middle class and reduce the overall complexity of the mod.
There are 10 kinds of people in this world, those that understand binary and those that don't.

Honktown
Filter Inserter
Filter Inserter
Posts: 309
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: [0.17.79] Crash while saving, in lua (table expected)

Post by Honktown » Wed Dec 04, 2019 11:19 pm

gabberworld wrote:
Wed Dec 04, 2019 10:48 pm
this what happens when vandalize the original Lua, those who know that language sometime have no idea that some stuff missing by default at here
I'd blame the mod author and object orientation. For some reason he uses a file someone wrote in 2011 which does some crazy metatable bullshit.

User avatar
1000101
Burner Inserter
Burner Inserter
Posts: 13
Joined: Thu Oct 08, 2015 9:14 am
Contact:

Re: [0.17.79] Crash while saving, in lua (table expected)

Post by 1000101 » Thu Dec 05, 2019 2:57 am

Ok, I removed all the OOP crap, greatly simplified and reduced the code base and everything is working as it should.

Not sure why gnzzz decided all that crap was necessary when it wasn't. In any event, it's working now (well it worked before other than causing a crash when saving) and the total script size is less than half what it was.
There are 10 kinds of people in this world, those that understand binary and those that don't.

Honktown
Filter Inserter
Filter Inserter
Posts: 309
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: [0.17.79] Crash while saving, in lua (table expected)

Post by Honktown » Thu Dec 05, 2019 8:31 am

1000101 wrote:
Thu Dec 05, 2019 2:57 am
Ok, I removed all the OOP crap, greatly simplified and reduced the code base and everything is working as it should.

Not sure why gnzzz decided all that crap was necessary when it wasn't. In any event, it's working now (well it worked before other than causing a crash when saving) and the total script size is less than half what it was.
If you would, would you care to upload it to the mods portal? I'd like to check it out.

User avatar
1000101
Burner Inserter
Burner Inserter
Posts: 13
Joined: Thu Oct 08, 2015 9:14 am
Contact:

Re: [0.17.79] Crash while saving, in lua (table expected)

Post by 1000101 » Thu Dec 05, 2019 9:19 am

I do plan on doing that, atm I am still testing to make sure it's stable for release.
There are 10 kinds of people in this world, those that understand binary and those that don't.

Loewchen
Global Moderator
Global Moderator
Posts: 5516
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: [0.17.79] Crash while saving, in lua (table expected)

Post by Loewchen » Thu Dec 05, 2019 9:22 am

For further discussion about the mod, open a topic in mods instead please.

gabberworld
Long Handed Inserter
Long Handed Inserter
Posts: 62
Joined: Sat Aug 17, 2019 11:06 pm
Contact:

Re: [0.17.79] Crash while saving, in lua (table expected)

Post by gabberworld » Thu Dec 05, 2019 11:49 am

Honktown wrote:
Wed Dec 04, 2019 11:19 pm
gabberworld wrote:
Wed Dec 04, 2019 10:48 pm
this what happens when vandalize the original Lua, those who know that language sometime have no idea that some stuff missing by default at here
I'd blame the mod author and object orientation. For some reason he uses a file someone wrote in 2011 which does some crazy metatable bullshit.
i'm right to be angry, how many answers you get when you search this error at google

Code: Select all

((((t))->tt_) == (((5) | (1 << 6)))) table expected
does it tell that pairs not supported anymore ?

imagine if Visual studio starts pop you weird errors too all the time even if you think that all is correct

Rseding91
Factorio Staff
Factorio Staff
Posts: 10038
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.79] Crash while saving, in lua (table expected)

Post by Rseding91 » Thu Dec 05, 2019 3:07 pm

That specific error is a debug assert promoted to a runtime error which records the stack trace and terminates the program. Specifically because the entire Lua internals are fragile to these kinds of things.
If you want to get ahold of me I'm almost always on Discord.

User avatar
1000101
Burner Inserter
Burner Inserter
Posts: 13
Joined: Thu Oct 08, 2015 9:14 am
Contact:

Re: [0.17.79] Crash while saving, in lua (table expected)

Post by 1000101 » Fri Dec 06, 2019 6:00 am

Mod is now added to the portal.

https://mods.factorio.com/mod/LogisticsWagons
viewtopic.php?f=190&t=78709

I shan't be replying to this topic anymore.
There are 10 kinds of people in this world, those that understand binary and those that don't.

Post Reply

Return to “Won't fix.”

Who is online

Users browsing this forum: Google [Bot]