nihilistzsche / LtnManager

A GUI for managing your Logistic Train Network. A mod for Factorio.
https://mods.factorio.com/mod/LtnManager
MIT License
49 stars 13 forks source link

Multiplayer / Dedicated server error : event registration error #19

Closed aoakeley closed 4 years ago

aoakeley commented 4 years ago

Can not join server, player disconnects with following error ( full log ):

` 34.155 Checksum for script LogisticTrainNetwork/control.lua: 2308678286

34.162 Checksum for script LtnManager/control.lua: 1048496621
34.166 Checksum for script __LTN_Combinator/control.lua: 2315148836
34.167 Checksum for script
LTN_Content_Reader__/control.lua: 3089594493
38.760 Error ClientMultiplayerManager.cpp:1106: mod-LtnManager was not registered for the following events when the map was saved but has registered them as a result of loading: Custom event (ID 223)
38.760 Error ClientMultiplayerManager.cpp:1108: mod-LtnManager was registered for the following events when the map was saved but has not re-registered them as a result of loading: Custom event (ID 221)
38.760 Error ClientMultiplayerManager.cpp:98: MultiplayerManager failed: "" + multiplayer.script-event-mismatch + " " + "
mod-LtnManager"
38.761 Info ClientMultiplayerManager.cpp:581: UpdateTick(28123446) changing state from(ConnectedLoadingMap) to(Failed)`

raiguard commented 4 years ago

Could you send me a save file containing all of your enabled mods so I can test this?

aoakeley commented 4 years ago

Here is the save I am trying to add LTN Manager too. I started a new blank save on the same server with the same mods and did not receive an error on join.

https://www.dropbox.com/s/znjynpwrjhzr2vw/Pepe_COVID_LIVE_HERE.zip?dl=0

raiguard commented 4 years ago

Hmm, when I try to replicate it by running two instances of the game on my PC, I can't get it to happen.

Guess it's time to learn how to host a server!

aoakeley commented 4 years ago

:) It's pretty easy but if you have any questions let me know. You'll have to set the server settings .json (../data/server-settings.json) and point the exe at the save game ( .\bin\x64\factorio --start-server "./saves/savegame.zip" --server-settings ./data/server-settings.json ) at a minimum to host an existing save game.

The server manager works well: https://github.com/mroote/factorio-server-manager but the readme could explicitly state where to put your steam ID/pwd for the mod's to download and update.

Download the headless from factorio.com I am using the latest experimental version ( 0.18.18 at this writing).

aoakeley commented 4 years ago

Well... somehow it's fixed now. I noticed from the first error log that RecipeBook was generating the same type of error, but only when I enabled LTNManager. I disabled LTNManager and restarted a few times and then RecipeBook started generating the event manager error. On a whim I disabled RecipeBook and enabled LTNManager (a combination I had already tried multiple times) and LTNManager now works.

I'll update this thread if I find any additional information but I had to guess it's a chance thing of events de-syncing during player join first time the mod is used?

Praise Kek a working LTN manager again!!! Thanks raiguard!

raiguard commented 4 years ago

O.o

I actually had this exact same issue with Recipe Book and Quick Item Search (one of my less popular mods), and it was being caused by the Death Markers mod. I never found the actual reason why it was erroring, just that enabling Death Markers made my event manager freak out. Maybe if I can set up my own dedicated server to use for testing I'll be able to pin it down.

aoakeley commented 4 years ago

Interesting. While troubleshooting I deleted some unused (disabled) mods and one of them was Death Markers, but as it was disabled I don't know if it's related. I tried re-enabling Recipe Book and both RB and LTNManager event handler error'ed again. Removing RB allows LTNM to work as previously.

raiguard commented 4 years ago

So I'm trying to follow the instructions for Windows (I have a Windows VM on my brother's server) and it says to download the Factorio Standalone Server. Is that the headless release, or is it just a copy of the game, or something else? Headless says it only supports Linux but the server manager says it supports windows and linux.

Nevermind, I got it working!

raiguard commented 4 years ago

I got it to reproduce by enabling Death Markers... I'm going to investigate and see what I can find. Though this kind of bug is extremely difficult to pin down. sigh

raiguard commented 4 years ago

WTF... now I can't reproduce it at all. I have Death Markers, Recipe Book, and Quick Item Search enabled, and no dice. I do have a sneaking suspicion as to what could be causing it, though...

It involves a bit of rewriting on my translation module, but it should be doable.

raiguard commented 4 years ago

I just pushed an update to RaiLuaLib. Could you please download it and see if the issue has been resolved?

raiguard commented 4 years ago

I also released an LTN Manager update as well.

aoakeley commented 4 years ago

I get a new error when I include RecipeBook [attempt to index local 'player_data' (a nil value)]. Without RecipeBook seems to be working great.

Client and server logs: link

raiguard commented 4 years ago

Oops! I'll fix that pronto. If it works after I release the patch I'll consider this issue solved.

In case you're interested, the issue was that my translation module had cross-mod synchronization capabilities. RaiLuaLib used to just be something I included in my mods instead of a separate mod, so I had to set up a system where one mod would act as the "host" mod while the others would communicate with it to get the information. This system stayed in place when I made the lualib a dedicated mod.

The reason I think this was happening was because the "host" mod would not be consistent between clients. Sometimes the game would load them in such an order as to change the host mod, so the event IDs would mismatch. At least, that's the only plausible reason I could think of.

The fix was to make RaiLuaLib itself be the "host" mod. Since any mods using the lualib have it as a dependency, it is guaranteed to load first, so that eliminates any mismatching ID desyncs.

Phew.

raiguard commented 4 years ago

I pushed the update to Recipe Book. Hopefully nothing broke!

aoakeley commented 4 years ago

That makes sense and would explain the behavior I observed. Fancy setup! Thanks 1000x's for all your hard work!!!

I'm still getting (I think) the same error I got earlier with RecipeBook updated and enabled:

2020/04/11 22:28:12 Factorio Server: 83.827 Info ServerMultiplayerManager.cpp:923: updateTick(31857759) received stateChanged peerID(1) oldState(TryingToCatchUp) newState(WaitingForCommandToStartSendingTickClosures) 2020/04/11 22:28:12 Factorio Server: 83.827 Info GameActionHandler.cpp:4334: UpdateTick (31857759) processed PlayerJoinGame peerID(1) playerIndex(0) mode(connect) 2020/04/11 22:28:12 Factorio Server: 83.828 Error MainLoop.cpp:1202: Exception at tick 31857759: The mod Recipe Book (1.2.3) caused a non-recoverable error. 2020/04/11 22:28:12 [83.828 Error MainLoop.cpp:1202: Exception at tick 31857759: The mod Recipe Book (1.2.3) caused a non-recoverable error.] 2020/04/11 22:28:12 Factorio Server: Please report this error to the mod author. 2020/04/11 22:28:12 Factorio Server: 2020/04/11 22:28:12 Factorio Server: Error while running event RecipeBook::on_player_joined_game (ID 43) 2020/04/11 22:28:12 Factorio Server: RaiLuaLib/lualib/translation.lua:168: attempt to index local 'player_data' (a nil value) 2020/04/11 22:28:12 Factorio Server: stack traceback: 2020/04/11 22:28:12 Factorio Server: RaiLuaLib/lualib/translation.lua:168: in function 'start' 2020/04/11 22:28:12 Factorio Server: RecipeBook/control.lua:103: in function 'run_translations' 2020/04/11 22:28:12 Factorio Server: RecipeBook/control.lua:165: in function 'handler' 2020/04/11 22:28:12 Factorio Server: RaiLuaLib/lualib/event.lua:127: in function <RaiLuaLib/lualib/event.lua:28> 2020/04/11 22:28:12 Factorio Server: 83.828 Error ServerMultiplayerManager.cpp:90: MultiplayerManager failed: "The mod Recipe Book (1.2.3) caused a non-recoverable error. 2020/04/11 22:28:12 [83.828 Error ServerMultiplayerManager.cpp:90: MultiplayerManager failed: "The mod Recipe Book (1.2.3) caused a non-recoverable error.] 2020/04/11 22:28:12 Factorio Server: Please report this error to the mod author. 2020/04/11 22:28:12 Factorio Server: 2020/04/11 22:28:12 Factorio Server: Error while running event RecipeBook::on_player_joined_game (ID 43) 2020/04/11 22:28:12 Factorio Server: RaiLuaLib/lualib/translation.lua:168: attempt to index local 'player_data' (a nil value) 2020/04/11 22:28:12 Factorio Server: stack traceback: 2020/04/11 22:28:12 Factorio Server: RaiLuaLib/lualib/translation.lua:168: in function 'start' 2020/04/11 22:28:12 Factorio Server: RecipeBook/control.lua:103: in function 'run_translations' 2020/04/11 22:28:12 Factorio Server: RecipeBook/control.lua:165: in function 'handler' 2020/04/11 22:28:12 Factorio Server: RaiLuaLib/lualib/event.lua:127: in function <RaiLuaLib/lualib/event.lua:28>" 2020/04/11 22:28:12 Factorio Server: 83.828 Info ServerMultiplayerManager.cpp:774: updateTick(31857759) changing state from(InGame) to(Failed) 2020/04/11 22:28:12 Factorio Server: 83.829 Quitting: multiplayer error.

raiguard commented 4 years ago

What the... I thought I fixed that! How strange.

raiguard commented 4 years ago

Oh... frick. I did fix it because it was actually a problem with RaiLuaLib, not Recipe Book. Then I accidentally undid the change somewhere and forgot about it.

Pushing the update soon.

EDIT: I just booted up a server with your save and it's running LTNM, RB, and QIS all at the same time without issues, so hopefully it's actually fixed now! Though I have discovered another issue with LTNM that I'm going to release a patch for as well.

raiguard commented 4 years ago

Sorry it took so long, I pushed the LtnManager update as well now. Hopefully everything should be good!

aoakeley commented 4 years ago

All is well here with Recipe Book included. Sorry for the bag of worms and thanks again!

raiguard commented 4 years ago

No problem! I'm glad we were able to get it sorted. This issue had been plaguing me for months.

And just in time too, since we just started a global Factorio modding library project and my translation engine will be a part of it. :D